Skip to content

Commit

Permalink
Merge pull request #471 from moj-analytical-services/more_type_hinting
Browse files Browse the repository at this point in the history
type hint cc
  • Loading branch information
RobinL authored May 17, 2022
2 parents 1972c9e + 75da19b commit ab33cc1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions splink/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ def __init__(self, comparison_dict, settings_obj: "Settings" = None):
# Protected because we don't want to modify
self._comparison_dict = comparison_dict
comparison_level_list = comparison_dict["comparison_levels"]
self.comparison_levels = [
self.comparison_levels: list[ComparisonLevel] = [
ComparisonLevel(i, self, settings_obj) for i in comparison_level_list
]
self._settings_obj = settings_obj
self._settings_obj: "Settings" = settings_obj

# Assign comparison vector values starting at highest level, count down to 0
num_levels = len([cl for cl in self.comparison_levels if not cl.is_null_level])
Expand Down
4 changes: 3 additions & 1 deletion splink/duckdb/duckdb_linker.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ def __init__(
"""
)

def _table_to_splink_dataframe(self, templated_name, physical_name):
def _table_to_splink_dataframe(
self, templated_name, physical_name
) -> DuckDBLinkerDataFrame:
return DuckDBLinkerDataFrame(templated_name, physical_name, self)

def _execute_sql(self, sql, templated_name, physical_name, transpile=True):
Expand Down
4 changes: 3 additions & 1 deletion splink/linker.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ def _initialise_df_concat_with_tf(self, materialise=True):
if materialise:
self._execute_sql_pipeline(materialise_as_hash=False)

def _table_to_splink_dataframe(self, templated_name, physical_name):
def _table_to_splink_dataframe(
self, templated_name, physical_name
) -> SplinkDataFrame:
"""Create a SplinkDataframe from a table in the underlying database called
`physical_name`.
Expand Down
2 changes: 1 addition & 1 deletion splink/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, settings_dict):
s_else_d = self.from_settings_dict_else_default
self._sql_dialect = s_else_d("sql_dialect")

self.comparisons = []
self.comparisons: list[Comparison] = []
for cc in ccs:
if type(cc) is dict:
self.comparisons.append(Comparison(cc, self))
Expand Down

0 comments on commit ab33cc1

Please sign in to comment.