allow any object with items

This commit is contained in:
maxbachmann 2020-05-21 08:39:13 +02:00
parent 2e29648ef4
commit f0f8247d02
No known key found for this signature in database
GPG Key ID: 60334E83C23820B8
2 changed files with 3 additions and 3 deletions

View File

@ -1 +1 @@
0.8.1 0.8.2

View File

@ -10,7 +10,7 @@ def iterExtract(query: str, choices: Iterable, scorer: Callable = fuzz.WRatio, p
score_cutoff: float = 0) -> Generator[Tuple[str, float], None, None]: score_cutoff: float = 0) -> Generator[Tuple[str, float], None, None]:
a = processor(query) if processor else query a = processor(query) if processor else query
if isinstance(choices, dict): if hasattr(choices, "items"):
for choice, match_choice in choices.items(): for choice, match_choice in choices.items():
b = processor(match_choice) if processor else match_choice b = processor(match_choice) if processor else match_choice
@ -135,7 +135,7 @@ def extractOne(query: str, choices: Iterable, scorer: Callable = fuzz.WRatio, pr
result_score = 0 result_score = 0
result_choice = "" result_choice = ""
if isinstance(choices, dict): if hasattr(choices, "items"):
choice_key = "" choice_key = ""
for choice, match_choice in choices.items(): for choice, match_choice in choices.items():
b = processor(match_choice) if processor else match_choice b = processor(match_choice) if processor else match_choice