From 800805abd06a78c3956063adfb29235c8afdbf62 Mon Sep 17 00:00:00 2001 From: Galtozzy <14139502+Galtozzy@users.noreply.github.com> Date: Tue, 14 Feb 2023 02:07:36 +0300 Subject: [PATCH] Fix for `lpop` and `rpop` return typing 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/redis/commands/core.py b/redis/commands/core.py index b07f12d854..a8649c04b4 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -2667,7 +2667,9 @@ def llen(self, name: str) -> Union[Awaitable[int], int]: """ 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 +2746,9 @@ def ltrim(self, name: str, start: int, end: int) -> Union[Awaitable[str], str]: """ 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``.