Fixes redis.asyncio.client: AsyncIterator cannot be async def in stubs. (#8961)

Without the `yield` statement in the method body, these are interpreted by mypy as coroutines that return an `AsyncIterator`.

Closes #8960
This commit is contained in:
Peter Schutt
2022-10-22 02:44:51 +10:00
committed by GitHub
parent 7ed599e848
commit 25810e1b11

View File

@@ -116,7 +116,7 @@ class Monitor:
async def __aenter__(self): ...
async def __aexit__(self, *args) -> None: ...
async def next_command(self) -> MonitorCommandInfo: ...
async def listen(self) -> AsyncIterator[MonitorCommandInfo]: ...
def listen(self) -> AsyncIterator[MonitorCommandInfo]: ...
class PubSub:
PUBLISH_MESSAGE_TYPES: ClassVar[tuple[str, ...]]
@@ -154,7 +154,7 @@ class PubSub:
def punsubscribe(self, *args: ChannelT) -> Awaitable[Any]: ...
async def subscribe(self, *args: ChannelT, **kwargs: Callable[..., Any]): ...
def unsubscribe(self, *args) -> Awaitable[Any]: ...
async def listen(self) -> AsyncIterator[Any]: ...
def listen(self) -> AsyncIterator[Any]: ...
async def get_message(self, ignore_subscribe_messages: bool = ..., timeout: float = ...): ...
def ping(self, message: Any | None = ...) -> Awaitable[Any]: ...
async def handle_message(self, response, ignore_subscribe_messages: bool = ...): ...