[stdlib] Add default values part 2 (#14769)

This commit is contained in:
Semyon Moroz
2026-01-11 19:08:32 +00:00
committed by GitHub
parent a4eeb5c05b
commit 3593e35df4
12 changed files with 142 additions and 117 deletions
+6 -6
View File
@@ -32,7 +32,7 @@ class count(Generic[_N]):
@overload
def __new__(cls) -> count[int]: ...
@overload
def __new__(cls, start: _N, step: _Step = ...) -> count[_N]: ...
def __new__(cls, start: _N, step: _Step = 1) -> count[_N]: ...
@overload
def __new__(cls, *, step: _N) -> count[_N]: ...
def __next__(self) -> _N: ...
@@ -57,9 +57,9 @@ class repeat(Generic[_T]):
@disjoint_base
class accumulate(Generic[_T]):
@overload
def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> Self: ...
def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = None) -> Self: ...
@overload
def __new__(cls, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = ...) -> Self: ...
def __new__(cls, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = None) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> _T: ...
@@ -105,7 +105,7 @@ class islice(Generic[_T]):
@overload
def __new__(cls, iterable: Iterable[_T], stop: int | None, /) -> Self: ...
@overload
def __new__(cls, iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = ..., /) -> Self: ...
def __new__(cls, iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = 1, /) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> _T: ...
@@ -126,7 +126,7 @@ def tee(iterable: Iterable[_T], n: int = 2, /) -> tuple[Iterator[_T], ...]: ...
class zip_longest(Generic[_T_co]):
# one iterable (fillvalue doesn't matter)
@overload
def __new__(cls, iter1: Iterable[_T1], /, *, fillvalue: object = ...) -> zip_longest[tuple[_T1]]: ...
def __new__(cls, iter1: Iterable[_T1], /, *, fillvalue: object = None) -> zip_longest[tuple[_T1]]: ...
# two iterables
@overload
# In the overloads without fillvalue, all of the tuple members could theoretically be None,
@@ -298,7 +298,7 @@ class permutations(Generic[_T_co]):
@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 __new__(cls, iterable: Iterable[_T], r: int | None = None) -> permutations[tuple[_T, ...]]: ...
def __iter__(self) -> Self: ...
def __next__(self) -> _T_co: ...