stdlib: Improve many __iter__ and constructor methods (#7112)

This commit is contained in:
Alex Waygood
2022-02-02 18:14:57 +00:00
committed by GitHub
parent b327f64d9a
commit 7ccbbdb30a
11 changed files with 36 additions and 24 deletions

View File

@@ -964,7 +964,7 @@ class frozenset(AbstractSet[_T_co], Generic[_T_co]):
class enumerate(Iterator[tuple[int, _T]], Generic[_T]):
def __init__(self, iterable: Iterable[_T], start: int = ...) -> None: ...
def __iter__(self) -> Iterator[tuple[int, _T]]: ...
def __iter__(self: Self) -> Self: ...
def __next__(self) -> tuple[int, _T]: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
@@ -1095,7 +1095,7 @@ class filter(Iterator[_T], Generic[_T]):
def __init__(self, __function: Callable[[_S], TypeGuard[_T]], __iterable: Iterable[_S]) -> None: ...
@overload
def __init__(self, __function: Callable[[_T], Any], __iterable: Iterable[_T]) -> None: ...
def __iter__(self) -> Iterator[_T]: ...
def __iter__(self: Self) -> Self: ...
def __next__(self) -> _T: ...
def format(__value: object, __format_spec: str = ...) -> str: ... # TODO unicode
@@ -1186,7 +1186,7 @@ class map(Iterator[_S], Generic[_S]):
__iter6: Iterable[Any],
*iterables: Iterable[Any],
) -> None: ...
def __iter__(self) -> Iterator[_S]: ...
def __iter__(self: Self) -> Self: ...
def __next__(self) -> _S: ...
@overload
@@ -1699,7 +1699,7 @@ if sys.version_info >= (3, 11):
_SplitCondition = type[BaseException] | tuple[type[BaseException], ...] | Callable[[BaseException], bool]
class BaseExceptionGroup(BaseException):
def __new__(cls, __message: str, __exceptions: Sequence[BaseException]) -> BaseExceptionGroup | ExceptionGroup: ...
def __new__(cls: type[Self], __message: str, __exceptions: Sequence[BaseException]) -> Self: ...
@property
def message(self) -> str: ...
@property
@@ -1709,6 +1709,6 @@ if sys.version_info >= (3, 11):
def derive(self: Self, __excs: Sequence[BaseException]) -> Self: ...
class ExceptionGroup(BaseExceptionGroup, Exception):
def __new__(cls, __message: str, __exceptions: Sequence[Exception]) -> ExceptionGroup: ...
def __new__(cls: type[Self], __message: str, __exceptions: Sequence[Exception]) -> Self: ...
@property
def exceptions(self) -> tuple[Exception, ...]: ...