Skip to content

Commit 0a5caa5

Browse files
authored
Adding missing stubs (#27)
1 parent a237202 commit 0a5caa5

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

src/Levenshtein/__init__.pyi

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Tuple, Union, Optional, overload
1+
from typing import Callable, Hashable, List, Sequence, Tuple, Union, Optional, overload
22

33
__author__: str
44
__license__: str
@@ -9,12 +9,6 @@ _Opcodes = List[Tuple[str, int, int, int, int]]
99
_MatchingBlocks = List[Tuple[int, int, int]]
1010
_AnyEditops = Union[_Editops, _Opcodes]
1111

12-
from rapidfuzz.distance.Levenshtein import distance as distance
13-
from rapidfuzz.distance.Indel import normalized_similarity as ratio
14-
from rapidfuzz.distance.Hamming import distance as hamming
15-
from rapidfuzz.distance.Jaro import similarity as jaro
16-
from rapidfuzz.distance.JaroWinkler import similarity as jaro_winkler
17-
1812
def inverse(edit_operations: list) -> list: ...
1913

2014
@overload
@@ -58,3 +52,40 @@ def setratio(
5852
def seqratio(
5953
strlist1: List[Union[str, bytes]], strlist2: List[Union[str, bytes]]
6054
) -> float: ...
55+
def distance(
56+
s1: Sequence[Hashable],
57+
s2: Sequence[Hashable],
58+
*,
59+
weights: Optional[Tuple[int, int, int]] = (1, 1, 1),
60+
processor: Optional[Callable] = None,
61+
score_cutoff: Optional[float] = None,
62+
) -> int: ...
63+
def ratio(
64+
s1: Sequence[Hashable],
65+
s2: Sequence[Hashable],
66+
*,
67+
processor: Optional[Callable] = None,
68+
score_cutoff: Optional[float] = None,
69+
) -> float: ...
70+
def hamming(
71+
s1: Sequence[Hashable],
72+
s2: Sequence[Hashable],
73+
*,
74+
processor: Optional[Callable] = None,
75+
score_cutoff: Optional[float] = None,
76+
) -> int: ...
77+
def jaro(
78+
s1: Sequence[Hashable],
79+
s2: Sequence[Hashable],
80+
*,
81+
processor: Optional[Callable] = None,
82+
score_cutoff: Optional[float] = None,
83+
) -> float: ...
84+
def jaro_winkler(
85+
s1: Sequence[Hashable],
86+
s2: Sequence[Hashable],
87+
*,
88+
prefix_weight: Optional[float] = 0.1,
89+
processor: Optional[Callable] = None,
90+
score_cutoff: Optional[float] = None,
91+
) -> float: ...

0 commit comments

Comments
 (0)