Skip to content

Commit c855921

Browse files
committed
[#158] Add type hints and tweak documentation for core.comparison.generate_comparison()
1 parent 0fd0552 commit c855921

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

hlink/linking/core/comparison.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,23 @@ def _get_comp_leaf(comp: dict[str, Any], comp_leaves: list[dict[str, Any]]) -> N
3232
return comp_leaves
3333

3434

35-
def generate_comparisons(comp, features, id_col):
35+
def generate_comparisons(
36+
comp: dict[str, Any], features: list[dict[str, Any]], id_col: str
37+
) -> str:
3638
"""Creates the comparison SQL clause given a comparison and a list of comparison features.
3739
3840
Parameters
3941
----------
40-
comp: dictionary
42+
comp:
4143
the config dictionary containing the comparison definition
42-
features: dictionary
43-
the config dictionary containing the comparison features
44-
id_col: string
44+
features:
45+
the config list containing the comparison features
46+
id_col:
4547
the id column
4648
4749
Returns
4850
-------
49-
A string of the sql clause to be used for comparison
50-
filtering after blocking.
51+
The sql clause to be used for comparison filtering after blocking.
5152
"""
5253
if comp != {}:
5354
if "comp_a" in comp:

hlink/tests/core/comparison_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_generate_comparisons_empty_input() -> None:
8383
generate_comparisons() returns an empty string for empty input.
8484
"""
8585
comparisons = {}
86-
features = {}
86+
features = []
8787
id_col = ""
8888
assert generate_comparisons(comparisons, features, id_col) == ""
8989

0 commit comments

Comments
 (0)