mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
[itertools] More specific type hints for batched(..., strict=True) (#15277)
This commit is contained in:
+18
-3
@@ -343,9 +343,24 @@ if sys.version_info >= (3, 12):
|
||||
@disjoint_base
|
||||
class batched(Generic[_T_co]):
|
||||
if sys.version_info >= (3, 13):
|
||||
def __new__(cls, iterable: Iterable[_T_co], n: int, *, strict: bool = False) -> Self: ...
|
||||
@overload
|
||||
def __new__(cls, iterable: Iterable[_T], n: Literal[1], *, strict: Literal[True]) -> batched[tuple[_T]]: ...
|
||||
@overload
|
||||
def __new__(cls, iterable: Iterable[_T], n: Literal[2], *, strict: Literal[True]) -> batched[tuple[_T, _T]]: ...
|
||||
@overload
|
||||
def __new__(cls, iterable: Iterable[_T], n: Literal[3], *, strict: Literal[True]) -> batched[tuple[_T, _T, _T]]: ...
|
||||
@overload
|
||||
def __new__(
|
||||
cls, iterable: Iterable[_T], n: Literal[4], *, strict: Literal[True]
|
||||
) -> batched[tuple[_T, _T, _T, _T]]: ...
|
||||
@overload
|
||||
def __new__(
|
||||
cls, iterable: Iterable[_T], n: Literal[5], *, strict: Literal[True]
|
||||
) -> batched[tuple[_T, _T, _T, _T, _T]]: ...
|
||||
@overload
|
||||
def __new__(cls, iterable: Iterable[_T], n: int, *, strict: bool = False) -> batched[tuple[_T, ...]]: ...
|
||||
else:
|
||||
def __new__(cls, iterable: Iterable[_T_co], n: int) -> Self: ...
|
||||
def __new__(cls, iterable: Iterable[_T], n: int) -> batched[tuple[_T, ...]]: ...
|
||||
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> tuple[_T_co, ...]: ...
|
||||
def __next__(self) -> _T_co: ...
|
||||
|
||||
Reference in New Issue
Block a user