rapidfuzz / RapidFuzz

Rapid fuzzy string matching in Python using various string metrics

Home Page:https://rapidfuzz.github.io/RapidFuzz/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect type hinting in extract

Vioshim opened this issue · comments

in the recent update of the type hinting due to the lack of =WRatio in the extract procesor arguments, it leads to inconsistent behavior

Example:

from dataclasses import dataclass
from rapidfuzz import process

@dataclass(unsafe_hash=True)
class Foo:
    name: str
    
items: list[Foo] = [Foo("Test")]
check = {x: x.name for x in items}

result = process.extract("Test", check, limit=1, score_cutoff=60.0)
# No overloads for "extract" match the provided arguments
# Argument types: (str, dict[Foo, str], Literal[1], float)

assert result == [('Test', 100.0, Foo(name='Test'))]

I forgot to add the limit argument to some overloads. 9e56942 should fix this problem