summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaltozzy <14139502+Galtozzy@users.noreply.github.com>2023-02-15 16:05:47 +0300
committerGitHub <noreply@github.com>2023-02-15 15:05:47 +0200
commite9ad2a3ec0f403373fe2c01d2ab3a71c69ec884c (patch)
treef2ed16a9ca2443198034e9d5921856193d775f8c
parentfd7a79dca3d10af88a2ef79f81471a63376c081f (diff)
downloadredis-py-e9ad2a3ec0f403373fe2c01d2ab3a71c69ec884c.tar.gz
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.
-rw-r--r--redis/commands/core.py12
1 files changed, 10 insertions, 2 deletions
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``.