Add missing __class_getitem__ method to itertools.chain (#6389)

This commit is contained in:
Alex Waygood
2021-11-26 19:50:49 +00:00
committed by GitHub
parent 80425e8fcd
commit 8431e6c7c3

View File

@@ -17,6 +17,9 @@ from typing import (
)
from typing_extensions import Literal, SupportsIndex
if sys.version_info >= (3, 9):
from types import GenericAlias
_T = TypeVar("_T")
_S = TypeVar("_S")
_N = TypeVar("_N", int, float, SupportsFloat, SupportsInt, SupportsIndex, SupportsComplex)
@@ -67,6 +70,8 @@ class chain(Iterator[_T], Generic[_T]):
@classmethod
# We use Type and not Type[_S] to not lose the type inference from __iterable
def from_iterable(cls: Type[Any], __iterable: Iterable[Iterable[_S]]) -> Iterator[_S]: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...
class compress(Iterator[_T], Generic[_T]):
def __init__(self, data: Iterable[_T], selectors: Iterable[Any]) -> None: ...