Skip to content

Commit

Permalink
fix typing complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
fgregg committed Feb 17, 2023
1 parent cd8a4d3 commit 91d3a5e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
26 changes: 23 additions & 3 deletions dedupe/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,18 @@ def partition(self, data, threshold=0.5): # pragma: no cover
_cleanup_scores(pair_scores)
return clusters_eval

@overload
@staticmethod
def _add_singletons(all_ids: Iterable[int], clusters: ClustersInt) -> ClustersInt:
...

@overload
@staticmethod
def _add_singletons(all_ids: Iterable[str], clusters: ClustersStr) -> ClustersStr:
...

@staticmethod
def _add_singletons(all_ids: Iterable[RecordID], clusters: Clusters) -> Clusters:
def _add_singletons(all_ids, clusters):
singletons = set(all_ids)

for record_ids, score in clusters:
Expand Down Expand Up @@ -997,9 +1007,19 @@ def search(
else:
return list(results)

@overload
def _format_search_results(
self, search_d: Data, results: ArrayLinks
) -> LookupResults:
self, search_d: DataInt, results: ArrayLinks
) -> LookupResultsInt:
...

@overload
def _format_search_results(
self, search_d: DataStr, results: ArrayLinks
) -> LookupResultsStr:
...

def _format_search_results(self, search_d, results):
seen: set[RecordID] = set()

for result in results:
Expand Down
2 changes: 1 addition & 1 deletion dedupe/clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def cluster(
for cluster in clusters.values():
if len(cluster) > 1:
scores = confidences(cluster, squared_distances, N)
yield tuple(i_to_id[i] for i in cluster), scores
yield tuple(i_to_id[i] for i in cluster), scores # type: ignore[misc]

else:
((ids, score),) = sub_graph
Expand Down

0 comments on commit 91d3a5e

Please sign in to comment.