mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
Remove many redundant inheritances from Generic[] (#10933)
This commit is contained in:
@@ -23,7 +23,7 @@ _Predicate: TypeAlias = Callable[[_T], object]
|
||||
|
||||
# Technically count can take anything that implements a number protocol and has an add method
|
||||
# but we can't enforce the add method
|
||||
class count(Iterator[_N], Generic[_N]):
|
||||
class count(Iterator[_N]):
|
||||
@overload
|
||||
def __new__(cls) -> count[int]: ...
|
||||
@overload
|
||||
@@ -33,12 +33,12 @@ class count(Iterator[_N], Generic[_N]):
|
||||
def __next__(self) -> _N: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
|
||||
class cycle(Iterator[_T], Generic[_T]):
|
||||
class cycle(Iterator[_T]):
|
||||
def __init__(self, __iterable: Iterable[_T]) -> None: ...
|
||||
def __next__(self) -> _T: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
|
||||
class repeat(Iterator[_T], Generic[_T]):
|
||||
class repeat(Iterator[_T]):
|
||||
@overload
|
||||
def __init__(self, object: _T) -> None: ...
|
||||
@overload
|
||||
@@ -47,7 +47,7 @@ class repeat(Iterator[_T], Generic[_T]):
|
||||
def __iter__(self) -> Self: ...
|
||||
def __length_hint__(self) -> int: ...
|
||||
|
||||
class accumulate(Iterator[_T], Generic[_T]):
|
||||
class accumulate(Iterator[_T]):
|
||||
if sys.version_info >= (3, 8):
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> None: ...
|
||||
@@ -59,7 +59,7 @@ class accumulate(Iterator[_T], Generic[_T]):
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
class chain(Iterator[_T], Generic[_T]):
|
||||
class chain(Iterator[_T]):
|
||||
def __init__(self, *iterables: Iterable[_T]) -> None: ...
|
||||
def __next__(self) -> _T: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
@@ -69,17 +69,17 @@ class chain(Iterator[_T], Generic[_T]):
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
|
||||
|
||||
class compress(Iterator[_T], Generic[_T]):
|
||||
class compress(Iterator[_T]):
|
||||
def __init__(self, data: Iterable[_T], selectors: Iterable[Any]) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
class dropwhile(Iterator[_T], Generic[_T]):
|
||||
class dropwhile(Iterator[_T]):
|
||||
def __init__(self, __predicate: _Predicate[_T], __iterable: Iterable[_T]) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
class filterfalse(Iterator[_T], Generic[_T]):
|
||||
class filterfalse(Iterator[_T]):
|
||||
def __init__(self, __predicate: _Predicate[_T] | None, __iterable: Iterable[_T]) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
@@ -92,7 +92,7 @@ class groupby(Iterator[tuple[_T, Iterator[_S]]], Generic[_T, _S]):
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> tuple[_T, Iterator[_S]]: ...
|
||||
|
||||
class islice(Iterator[_T], Generic[_T]):
|
||||
class islice(Iterator[_T]):
|
||||
@overload
|
||||
def __init__(self, __iterable: Iterable[_T], __stop: int | None) -> None: ...
|
||||
@overload
|
||||
@@ -100,19 +100,19 @@ class islice(Iterator[_T], Generic[_T]):
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
class starmap(Iterator[_T], Generic[_T]):
|
||||
class starmap(Iterator[_T]):
|
||||
def __init__(self, __function: Callable[..., _T], __iterable: Iterable[Iterable[Any]]) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
class takewhile(Iterator[_T], Generic[_T]):
|
||||
class takewhile(Iterator[_T]):
|
||||
def __init__(self, __predicate: _Predicate[_T], __iterable: Iterable[_T]) -> None: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
def tee(__iterable: Iterable[_T], __n: int = 2) -> tuple[Iterator[_T], ...]: ...
|
||||
|
||||
class zip_longest(Iterator[_T_co], Generic[_T_co]):
|
||||
class zip_longest(Iterator[_T_co]):
|
||||
# one iterable (fillvalue doesn't matter)
|
||||
@overload
|
||||
def __new__(cls, __iter1: Iterable[_T1], *, fillvalue: object = ...) -> zip_longest[tuple[_T1]]: ...
|
||||
@@ -192,7 +192,7 @@ class zip_longest(Iterator[_T_co], Generic[_T_co]):
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T_co: ...
|
||||
|
||||
class product(Iterator[_T_co], Generic[_T_co]):
|
||||
class product(Iterator[_T_co]):
|
||||
@overload
|
||||
def __new__(cls, __iter1: Iterable[_T1]) -> product[tuple[_T1]]: ...
|
||||
@overload
|
||||
@@ -246,7 +246,7 @@ class permutations(Iterator[tuple[_T, ...]], Generic[_T]):
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> tuple[_T, ...]: ...
|
||||
|
||||
class combinations(Iterator[_T_co], Generic[_T_co]):
|
||||
class combinations(Iterator[_T_co]):
|
||||
@overload
|
||||
def __new__(cls, iterable: Iterable[_T], r: Literal[2]) -> combinations[tuple[_T, _T]]: ...
|
||||
@overload
|
||||
@@ -266,7 +266,7 @@ class combinations_with_replacement(Iterator[tuple[_T, ...]], Generic[_T]):
|
||||
def __next__(self) -> tuple[_T, ...]: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
class pairwise(Iterator[_T_co], Generic[_T_co]):
|
||||
class pairwise(Iterator[_T_co]):
|
||||
def __new__(cls, __iterable: Iterable[_T]) -> pairwise[tuple[_T, _T]]: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T_co: ...
|
||||
|
||||
Reference in New Issue
Block a user