Provide precise type hints for combinations_with_replacement (#11068)

This commit is contained in:
Serious-senpai
2023-11-25 00:46:39 +07:00
committed by GitHub
parent 81633e2709
commit b1d5f2f8d5

View File

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