mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 20:01:29 +08:00
Provide more precise type hints for itertools.permutations (#11019)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user