Skip to content

Remove redundant inheritances from Iterator in builtins #12851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ class slice:
def __hash__(self) -> int: ...
else:
__hash__: ClassVar[None] # type: ignore[assignment]

def indices(self, len: SupportsIndex, /) -> tuple[int, int, int]: ...

class tuple(Sequence[_T_co]):
Expand Down Expand Up @@ -1215,7 +1216,7 @@ class frozenset(AbstractSet[_T_co]):
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...

class enumerate(Iterator[tuple[int, _T]]):
class enumerate(Generic[_T]):
def __new__(cls, iterable: Iterable[_T], start: int = 0) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> tuple[int, _T]: ...
Expand Down Expand Up @@ -1409,7 +1410,7 @@ else:

def exit(code: sys._ExitCode = None) -> NoReturn: ...

class filter(Iterator[_T]):
class filter(Generic[_T]):
@overload
def __new__(cls, function: None, iterable: Iterable[_T | None], /) -> Self: ...
@overload
Expand Down Expand Up @@ -1470,7 +1471,7 @@ def len(obj: Sized, /) -> int: ...
def license() -> None: ...
def locals() -> dict[str, Any]: ...

class map(Iterator[_S]):
class map(Generic[_S]):
@overload
def __new__(cls, func: Callable[[_T1], _S], iter1: Iterable[_T1], /) -> Self: ...
@overload
Expand Down Expand Up @@ -1712,7 +1713,7 @@ def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = None) -> Any: ...
def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex: ...
def quit(code: sys._ExitCode = None) -> NoReturn: ...

class reversed(Iterator[_T]):
class reversed(Generic[_T]):
@overload
def __new__(cls, sequence: Reversible[_T], /) -> Iterator[_T]: ... # type: ignore[misc]
@overload
Expand Down Expand Up @@ -1773,7 +1774,7 @@ def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
@overload
def vars(object: Any = ..., /) -> dict[str, Any]: ...

class zip(Iterator[_T_co]):
class zip(Generic[_T_co]):
if sys.version_info >= (3, 10):
@overload
def __new__(cls, *, strict: bool = ...) -> zip[Any]: ...
Expand Down
Loading