From f904803527f5d006f938d0398b7696e74ed39520 Mon Sep 17 00:00:00 2001 From: Petya Slavova Date: Tue, 27 May 2025 13:32:37 +0300 Subject: [PATCH 1/2] Fixing the return type hint for transaction method in standalone client --- redis/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/client.py b/redis/client.py index ea7f3d84de..e2733daa92 100755 --- a/redis/client.py +++ b/redis/client.py @@ -450,7 +450,7 @@ def pipeline(self, transaction=True, shard_hint=None) -> "Pipeline": def transaction( self, func: Callable[["Pipeline"], None], *watches, **kwargs - ) -> None: + ) -> Optional[Union[List[Any], Any]]: """ Convenience method for executing the callable `func` as a transaction while watching all keys specified in `watches`. The 'func' callable From 57e47eb32e300a447024cc7aee3314f77c230fc3 Mon Sep 17 00:00:00 2001 From: Petya Slavova Date: Thu, 29 May 2025 12:48:03 +0300 Subject: [PATCH 2/2] Changing Optional to explicitly adding None with Union - to improve clarity --- redis/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/client.py b/redis/client.py index e2733daa92..28e9a82f76 100755 --- a/redis/client.py +++ b/redis/client.py @@ -450,7 +450,7 @@ def pipeline(self, transaction=True, shard_hint=None) -> "Pipeline": def transaction( self, func: Callable[["Pipeline"], None], *watches, **kwargs - ) -> Optional[Union[List[Any], Any]]: + ) -> Union[List[Any], Any, None]: """ Convenience method for executing the callable `func` as a transaction while watching all keys specified in `watches`. The 'func' callable