From 970b8a676c1835b0b06f0a4fa4c37647b66ae415 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Wed, 2 Feb 2022 15:14:08 +0300 Subject: [PATCH] Use `async def` instead of `def ... -> Awaitable` in `typing` (#7105) --- stdlib/types.pyi | 12 ++++++------ stdlib/typing.pyi | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/stdlib/types.pyi b/stdlib/types.pyi index e6fa40578cd5..761dc8095b0a 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -232,15 +232,15 @@ class AsyncGeneratorType(AsyncGenerator[_T_co, _T_contra]): ag_running: bool ag_code: CodeType def __aiter__(self) -> AsyncGeneratorType[_T_co, _T_contra]: ... - def __anext__(self) -> Awaitable[_T_co]: ... - def asend(self, __val: _T_contra) -> Awaitable[_T_co]: ... + async def __anext__(self) -> _T_co: ... + async def asend(self, __val: _T_contra) -> _T_co: ... @overload - def athrow( + async def athrow( self, __typ: type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ... - ) -> Awaitable[_T_co]: ... + ) -> _T_co: ... @overload - def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> Awaitable[_T_co]: ... - def aclose(self) -> Awaitable[None]: ... + async def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ... + async def aclose(self) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, __item: Any) -> GenericAlias: ... diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index d515764288d9..45819c811ed9 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -284,24 +284,24 @@ class AsyncIterable(Protocol[_T_co]): @runtime_checkable class AsyncIterator(AsyncIterable[_T_co], Protocol[_T_co]): @abstractmethod - def __anext__(self) -> Awaitable[_T_co]: ... + async def __anext__(self) -> _T_co: ... def __aiter__(self) -> AsyncIterator[_T_co]: ... class AsyncGenerator(AsyncIterator[_T_co], Generic[_T_co, _T_contra]): @abstractmethod - def __anext__(self) -> Awaitable[_T_co]: ... + async def __anext__(self) -> _T_co: ... @abstractmethod - def asend(self, __value: _T_contra) -> Awaitable[_T_co]: ... + async def asend(self, __value: _T_contra) -> _T_co: ... @overload @abstractmethod - def athrow( + async def athrow( self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ... - ) -> Awaitable[_T_co]: ... + ) -> _T_co: ... @overload @abstractmethod - def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> Awaitable[_T_co]: ... + async def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ... @abstractmethod - def aclose(self) -> Awaitable[None]: ... + async def aclose(self) -> None: ... @abstractmethod def __aiter__(self) -> AsyncGenerator[_T_co, _T_contra]: ... @property