mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
stdlib: Improve many __iter__ and constructor methods (#7112)
This commit is contained in:
@@ -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, ...]: ...
|
||||
|
||||
Reference in New Issue
Block a user