(a)next only requires __(a)next__, not Iterator (#6036)

This commit is contained in:
Sebastian Rittau authored and GitHub committed 2021-09-14 11:43:21 +03:00
1 parent 8a704ab290
commit b562d233ae
2 files changed
+15 -5

No files matched your search

+9 -1
View File
@@ -6,7 +6,7 @@ import array
import mmap
import sys
from os import PathLike
from typing import AbstractSet, Any, Container, Iterable, Protocol, Tuple, TypeVar, Union
from typing import AbstractSet, Any, Awaitable, Container, Iterable, Protocol, Tuple, TypeVar, Union
from typing_extensions import Literal, final
_KT = TypeVar("_KT")
@@ -26,6 +26,14 @@ Self = TypeVar("Self") # noqa Y001
class IdentityFunction(Protocol):
def __call__(self, __x: _T) -> _T: ...
# stable
class SupportsNext(Protocol[_T_co]):
def __next__(self) -> _T_co: ...
# stable
class SupportsAnext(Protocol[_T_co]):
def __anext__(self) -> Awaitable[_T_co]: ...
class SupportsLessThan(Protocol):
def __lt__(self, __other: Any) -> bool: ...