rapidfuzz/RapidFuzz

Incorrect type hinting in extract

Vioshim opened this issue · 1 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