Provide more precise type hints for itertools.permutations (#11019)

This commit is contained in:
Serious-senpai
2023-11-11 21:23:11 +07:00
committed by GitHub
parent 571cc6d77a
commit 676446569d

View File

@@ -241,10 +241,19 @@ class product(Iterator[_T_co]):
def __iter__(self) -> Self: ...
def __next__(self) -> _T_co: ...
class permutations(Iterator[tuple[_T, ...]], Generic[_T]):
def __init__(self, iterable: Iterable[_T], r: int | None = ...) -> None: ...
class permutations(Iterator[_T_co]):
@overload
def __new__(cls, iterable: Iterable[_T], r: Literal[2]) -> permutations[tuple[_T, _T]]: ...
@overload
def __new__(cls, iterable: Iterable[_T], r: Literal[3]) -> permutations[tuple[_T, _T, _T]]: ...
@overload
def __new__(cls, iterable: Iterable[_T], r: Literal[4]) -> permutations[tuple[_T, _T, _T, _T]]: ...
@overload
def __new__(cls, iterable: Iterable[_T], r: Literal[5]) -> permutations[tuple[_T, _T, _T, _T, _T]]: ...
@overload
def __new__(cls, iterable: Iterable[_T], r: int | None = ...) -> permutations[tuple[_T, ...]]: ...
def __iter__(self) -> Self: ...
def __next__(self) -> tuple[_T, ...]: ...
def __next__(self) -> _T_co: ...
class combinations(Iterator[_T_co]):
@overload