Improve various signatures that shouldn't be async def, but currently are (#7491)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
This commit is contained in:
Alex Waygood
2022-03-19 03:54:39 +00:00
committed by GitHub
parent 37a981920f
commit 5c44ae4f8c
10 changed files with 44 additions and 17 deletions

View File

@@ -752,26 +752,22 @@ class AsyncIterable(Protocol[_T_co]):
@runtime_checkable
class AsyncIterator(AsyncIterable[_T_co], Protocol[_T_co]):
@abstractmethod
async def __anext__(self) -> _T_co: ...
def __anext__(self) -> Awaitable[_T_co]: ...
def __aiter__(self) -> AsyncIterator[_T_co]: ...
class AsyncGenerator(AsyncIterator[_T_co], Generic[_T_co, _T_contra]):
def __anext__(self) -> Awaitable[_T_co]: ...
@abstractmethod
async def __anext__(self) -> _T_co: ...
@abstractmethod
async def asend(self, __value: _T_contra) -> _T_co: ...
def asend(self, __value: _T_contra) -> Awaitable[_T_co]: ...
@overload
@abstractmethod
async def athrow(
def athrow(
self, __typ: Type[BaseException], __val: BaseException | object = ..., __tb: TracebackType | None = ...
) -> _T_co: ...
) -> Awaitable[_T_co]: ...
@overload
@abstractmethod
async def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> _T_co: ...
@abstractmethod
async def aclose(self) -> None: ...
@abstractmethod
def __aiter__(self) -> AsyncGenerator[_T_co, _T_contra]: ...
def athrow(self, __typ: BaseException, __val: None = ..., __tb: TracebackType | None = ...) -> Awaitable[_T_co]: ...
def aclose(self) -> Awaitable[None]: ...
@property
def ag_await(self) -> Any: ...
@property