Skip to content

Commit 79ffec0

Browse files
committed
add AsyncGenerator to typing.pyi
This parallels python/typing#346
1 parent 2195b9d commit 79ffec0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

stdlib/3/typing.pyi

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,24 @@ class AsyncIterator(AsyncIterable[_T_co],
151151
def __anext__(self) -> Awaitable[_T_co]: ...
152152
def __aiter__(self) -> 'AsyncIterator[_T_co]': ...
153153

154+
if sys.version_info >= (3, 6):
155+
class AsyncGenerator(AsyncIterator[_T_co], Generic[_T_co, _T_contra]):
156+
@abstractmethod
157+
def __anext__(self) -> Awaitable[_T_co]: ...
158+
159+
@abstractmethod
160+
def asend(self, value: _T_contra) -> Awaitable[_T_co]: ...
161+
162+
@abstractmethod
163+
def athrow(self, typ: Type[BaseException], val: Optional[BaseException] = None,
164+
tb: Any = None) -> Awaitable[None]: ...
165+
166+
@abstractmethod
167+
def aclose(self) -> Awaitable[None]: ...
168+
169+
@abstractmethod
170+
def __aiter__(self) -> 'AsyncGenerator[_T_co, _T_contra]': ...
171+
154172
class Container(Generic[_T_co]):
155173
@abstractmethod
156174
def __contains__(self, x: object) -> bool: ...

0 commit comments

Comments
 (0)