Skip to content

Commit

Permalink
ignore type checker failing to deal with zips
Browse files Browse the repository at this point in the history
  • Loading branch information
fgregg committed Jul 1, 2020
1 parent d798868 commit ed172e7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions dedupe/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
Any,
Type,
Iterable)
from dedupe._typing import (RecordPairs, RecordID, Blocks, Data, Literal)
from dedupe._typing import (RecordPairs,
RecordID,
RecordDict,
Blocks,
Data,
Literal)

import numpy
import multiprocessing
Expand Down Expand Up @@ -135,7 +140,9 @@ def __call__(self) -> None:

def fieldDistance(self, record_pairs: RecordPairs) -> Optional[Tuple]:

record_ids, records = zip(*(zip(*record_pair) for record_pair in record_pairs))
record_ids: Sequence[Tuple[RecordID, RecordID]]
records: Sequence[Tuple[RecordDict, RecordDict]]
record_ids, records = zip(*(zip(*record_pair) for record_pair in record_pairs)) # type: ignore

if records:

Expand Down Expand Up @@ -293,7 +300,9 @@ def __init__(self, data_model, classifier):

def __call__(self, block: RecordPairs) -> numpy.ndarray:

record_ids, records = zip(*(zip(*each) for each in block))
record_ids: Sequence[Tuple[RecordID, RecordID]]
records: Sequence[Tuple[RecordDict, RecordDict]]
record_ids, records = zip(*(zip(*each) for each in block)) # type: ignore

distances = self.data_model.distances(records)
scores = self.classifier.predict_proba(distances)[:, -1]
Expand Down

0 comments on commit ed172e7

Please sign in to comment.