From e9ad2a3ec0f403373fe2c01d2ab3a71c69ec884c Mon Sep 17 00:00:00 2001 From: Galtozzy <14139502+Galtozzy@users.noreply.github.com> Date: Wed, 15 Feb 2023 16:05:47 +0300 Subject: Fix for `lpop` and `rpop` return typing (#2590) Right now there is an annoying warning that these methods can't be awaited when using `redis.asyncio`, even tho it does work with no problems. --- redis/commands/core.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'redis/commands/core.py') diff --git a/redis/commands/core.py b/redis/commands/core.py index b07f12d..28dab81 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -2667,7 +2667,11 @@ class ListCommands(CommandsProtocol): """ return self.execute_command("LLEN", name) - def lpop(self, name: str, count: Optional[int] = None) -> Union[str, List, None]: + def lpop( + self, + name: str, + count: Optional[int] = None, + ) -> Union[Awaitable[Union[str, List, None]], Union[str, List, None]]: """ Removes and returns the first elements of the list ``name``. @@ -2744,7 +2748,11 @@ class ListCommands(CommandsProtocol): """ return self.execute_command("LTRIM", name, start, end) - def rpop(self, name: str, count: Optional[int] = None) -> Union[str, List, None]: + def rpop( + self, + name: str, + count: Optional[int] = None, + ) -> Union[Awaitable[Union[str, List, None]], Union[str, List, None]]: """ Removes and returns the last elements of the list ``name``. -- cgit v1.2.1