Update fuzzy_compare default argument declarations

This commit is contained in:
Adriane Boyd 2022-11-28 10:27:21 +01:00
parent c3f446f71b
commit bde46b7db1
3 changed files with 2 additions and 4 deletions

View File

@ -78,5 +78,3 @@ cdef class Matcher:
cdef public object _extra_predicates cdef public object _extra_predicates
cdef public object _seen_attrs cdef public object _seen_attrs
cdef public object _fuzzy_compare cdef public object _fuzzy_compare
cpdef bint _default_fuzzy_compare(s1: str, s2: str, fuzzy: int)

View File

@ -53,4 +53,4 @@ class Matcher:
) -> List[Span]: ... ) -> List[Span]: ...
def _normalize_key(self, key: Any) -> Any: ... def _normalize_key(self, key: Any) -> Any: ...
def _default_fuzzy_compare(s1: str, s2: str, fuzzy: int) -> bool: ... def _default_fuzzy_compare(s1: str, s2: str, fuzzy: int = -1) -> bool: ...

View File

@ -1150,7 +1150,7 @@ def _get_extensions(spec, string_store, name2index):
return attr_values return attr_values
cpdef bint _default_fuzzy_compare(s1: str, s2: str, fuzzy: int): cpdef bint _default_fuzzy_compare(s1: str, s2: str, fuzzy: int = -1):
distance = min(len(s1), len(s2)) distance = min(len(s1), len(s2))
distance -= 1 # don't allow completely different tokens distance -= 1 # don't allow completely different tokens
if fuzzy == -1: # FUZZY operator with unspecified fuzzy if fuzzy == -1: # FUZZY operator with unspecified fuzzy