Skip to content
This repository has been archived by the owner on Dec 27, 2021. It is now read-only.

Commit

Permalink
add overload to difflib.get_close_matches (python#3908)
Browse files Browse the repository at this point in the history
Fixes python#3906. Fixes python#2067.
  • Loading branch information
JelleZijlstra authored Apr 5, 2020
1 parent 12b53fa commit 23e380a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion stdlib/2and3/difflib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys
from typing import (
Any, TypeVar, Callable, Iterable, Iterator, List, NamedTuple, Sequence, Tuple,
Generic, Optional, Text, Union, AnyStr
Generic, Optional, Text, Union, AnyStr, overload
)

_T = TypeVar('_T')
Expand Down Expand Up @@ -38,6 +38,11 @@ class SequenceMatcher(Generic[_T]):
def quick_ratio(self) -> float: ...
def real_quick_ratio(self) -> float: ...

# mypy thinks the signatures of the overloads overlap, but the types still work fine
@overload
def get_close_matches(word: AnyStr, possibilities: Iterable[AnyStr], # type: ignore
n: int = ..., cutoff: float = ...) -> List[AnyStr]: ...
@overload
def get_close_matches(word: Sequence[_T], possibilities: Iterable[Sequence[_T]],
n: int = ..., cutoff: float = ...) -> List[Sequence[_T]]: ...

Expand Down

0 comments on commit 23e380a

Please sign in to comment.