Skip to content

Commit 86893da

Browse files
author
Roy Williams
committed
Add Async classes to typing stub.
1 parent 30af935 commit 86893da

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

stdlib/3/typing.pyi

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,27 @@ class Hashable(metaclass=ABCMeta):
8787
@abstractmethod
8888
def __hash__(self) -> int: ...
8989

90+
class Awaitable(Generic[_T_co]):
91+
@abstractmethod
92+
def __await__(self) -> Iterator[_T_co]:...
93+
94+
class AsyncIterable(Generic[_T_co]):
95+
@abstractmethod
96+
def __anext__(self) -> Awaitable[_T_co]:...
97+
98+
class AsyncIterator(AsyncIterable[_T_co], Generic[_T_co]):
99+
@abstractmethod
100+
def __anext__(self) -> Awaitable[_T_co]:...
101+
def __aiter__(self) -> 'AsyncIterator'[_T_co]:...
102+
90103
class Iterable(Generic[_T_co]):
91104
@abstractmethod
92105
def __iter__(self) -> Iterator[_T_co]: ...
93106

94107
class Iterator(Iterable[_T_co], Generic[_T_co]):
95108
@abstractmethod
96109
def __next__(self) -> _T_co: ...
97-
def __iter__(self) -> Iterator[_T_co]: ...
110+
def __iter__(self) -> 'Iterator'[_T_co]: ...
98111

99112
class Container(Generic[_T_co]):
100113
@abstractmethod

0 commit comments

Comments
 (0)