Skip to content

Use async def instead of def ... -> Awaitable in typing #7105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions stdlib/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...

Expand Down
14 changes: 7 additions & 7 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down