Skip to content

Commit d7b41f2

Browse files
committed
chore: Lint tests and scripts folders
1 parent 8b7f21d commit d7b41f2

File tree

6 files changed

+19
-25
lines changed

6 files changed

+19
-25
lines changed

.github/workflows/lint.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ jobs:
99
- uses: actions/checkout@v3
1010
- uses: psf/black@stable
1111
with:
12-
src: ./bdikit/
12+
src: |
13+
./bdikit/
14+
./tests/
15+
./scripts/

Makefile

-14
This file was deleted.

scripts/format_schema/format_synapse.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44

55
RAW_SYNAPSE_PATH = join(dirname(__file__), "./synapse_raw_schema.json")
6-
FORMATTED_SYNAPSE_PATH = join(dirname(__file__), "../../bdikit/resource/synapse_schema.json")
6+
FORMATTED_SYNAPSE_PATH = join(
7+
dirname(__file__), "../../bdikit/resource/synapse_schema.json"
8+
)
79

8-
data = {'entity':{}, 'subschema':{}}
10+
data = {"entity": {}, "subschema": {}}
911

1012

1113
with open(RAW_SYNAPSE_PATH) as json_file:
@@ -16,20 +18,22 @@
1618
entry_description = entry.get("rdfs:comment", "")
1719
entry_parents = entry.get("rdfs:subClassOf", [{}])
1820

19-
if entry_parents[0]['@id'] == "bts:Thing":
21+
if entry_parents[0]["@id"] == "bts:Thing":
2022

2123
if entry_name.endswith("Enum"):
2224
continue
2325
values = entry.get("schema:rangeIncludes", [])
2426
new_entry = {
2527
"column_description": entry_description,
26-
"value_data": {x["@id"].replace("bts:", ""): "" for x in values}
28+
"value_data": {x["@id"].replace("bts:", ""): "" for x in values},
2729
}
28-
data['entity'][entry_name] = new_entry
30+
data["entity"][entry_name] = new_entry
2931

3032
if entry_name.endswith("Template") and "sms:requiresDependency" in entry:
31-
dependencies = [x["@id"].replace("bts:", "") for x in entry["sms:requiresDependency"]]
32-
data['subschema'][entry_name] = dependencies
33+
dependencies = [
34+
x["@id"].replace("bts:", "") for x in entry["sms:requiresDependency"]
35+
]
36+
data["subschema"][entry_name] = dependencies
3337

3438
with open(FORMATTED_SYNAPSE_PATH, "w") as f:
3539
json.dump(data, f, indent=4)

tests/test_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def test_preview_domain():
286286
preview = bdi.preview_domain(source, "age")
287287

288288
# then
289-
# preview must contain only the column "value_name" and the unique
289+
# preview must contain only the column "value_name" and the unique
290290
# values of the column "age"
291291
assert preview is not None
292292
assert isinstance(preview, pd.DataFrame)

tests/test_schema_matching.py

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from bdikit.schema_matching.twophase import TwoPhase
1111
from bdikit.schema_matching.contrastivelearning import ContrastiveLearning
1212

13+
1314
def test_basic_schema_matching_algorithms():
1415
for column_matcher in [
1516
SimFlood(),

tests/test_value_matching.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def test_textual_transformation_value_matching_algorithms():
1212
TFIDF(threshold=threshold),
1313
EditDistance(threshold=threshold),
1414
]:
15-
15+
1616
# given
1717
source_values = ["Red Apple", "Banana", "Oorange", "dragon-fruits"]
1818
target_values = ["apple", "banana", "orange", "kiwi"]
@@ -74,4 +74,4 @@ def test_semantic_value_matching_algorithms():
7474
assert mapped_matches["Display"][0] == "Monitor"
7575

7676
scores = [match[2] for match in matches]
77-
assert all(score > threshold for score in scores)
77+
assert all(score > threshold for score in scores)

0 commit comments

Comments
 (0)