aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.style.yapf6
-rw-r--r--Makefile5
-rw-r--r--fuzzycat/status.py1
-rw-r--r--fuzzycat/utils.py3
-rw-r--r--setup.py2
-rw-r--r--tests/test_utils.py21
6 files changed, 28 insertions, 10 deletions
diff --git a/.style.yapf b/.style.yapf
new file mode 100644
index 0000000..e061956
--- /dev/null
+++ b/.style.yapf
@@ -0,0 +1,6 @@
+[style]
+
+based_on_style = pep8
+split_before_logical_operator = true
+column_limit = 160
+
diff --git a/Makefile b/Makefile
index 5e2bab1..ab20988 100644
--- a/Makefile
+++ b/Makefile
@@ -18,8 +18,9 @@ data/release_export_expanded.json.gz: ## Download release export
.PHONY: style
style: ## Apply import sorting and black source formatting on all files
- isort -c --atomic .
- find . -name "*.py" -exec black {} \;
+ isort --atomic .
+ yapf -p -i -r fuzzycat
+ yapf -p -i -r tests
.PHONY: dist
dist: ## Create source distribution and wheel
diff --git a/fuzzycat/status.py b/fuzzycat/status.py
index cbafd32..f87c4e6 100644
--- a/fuzzycat/status.py
+++ b/fuzzycat/status.py
@@ -1,5 +1,6 @@
from enum import Enum
+
class MatchStatus(Enum):
"""
When matching two entities, use these levels to express match strength.
diff --git a/fuzzycat/utils.py b/fuzzycat/utils.py
index 6692a20..3a4be99 100644
--- a/fuzzycat/utils.py
+++ b/fuzzycat/utils.py
@@ -5,7 +5,6 @@ import itertools
import re
import string
from typing import Any, Callable, DefaultDict, Dict, List, Optional, Sequence
-
"""
A couple of utilities, may be split up into separate modules.
"""
@@ -26,7 +25,6 @@ class StringPipeline:
input and output
"""
-
def __init__(self, fs: List[Callable[[str], str]]):
self.fs = fs
@@ -73,7 +71,6 @@ class StringAnnotator:
* string_utils.py or similar
* maybe adopt SpaCy or similar
"""
-
def __init__(self, fs: List[Callable[[str], Dict[str, Any]]]):
self.fs = fs
diff --git a/setup.py b/setup.py
index 4258244..dfbef87 100644
--- a/setup.py
+++ b/setup.py
@@ -24,5 +24,5 @@ with open("README.md", "r") as fh:
zip_safe=False,
entry_points={"console_scripts": ["fuzzycat=fuzzycat.main:main",],},
install_requires=[],
- extras_require={"dev": ["black", "twine", "isort", "pytest"],},
+ extras_require={"dev": ["yapf", "twine", "isort", "pytest"],},
)
diff --git a/tests/test_utils.py b/tests/test_utils.py
index ed206dd..cc7fae0 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -1,6 +1,7 @@
# coding: utf-8
from typing import List, NamedTuple
+
import pytest
from fuzzycat.utils import *
@@ -105,10 +106,22 @@ def test_keys_with_values():
cases = (
Case({}, []),
Case({"a": "v"}, ["a"]),
- Case({"a": "", "b": "v"}, ["b"]),
- Case({"a": None, "b": "v"}, ["b"]),
- Case({"a": [], "b": "v"}, ["b"]),
- Case({"a": 0, "b": "v"}, ["b"]),
+ Case({
+ "a": "",
+ "b": "v"
+ }, ["b"]),
+ Case({
+ "a": None,
+ "b": "v"
+ }, ["b"]),
+ Case({
+ "a": [],
+ "b": "v"
+ }, ["b"]),
+ Case({
+ "a": 0,
+ "b": "v"
+ }, ["b"]),
)
for case in cases:
result = keys_with_values(case.d)