88 AsyncIterator ,
99 Awaitable ,
1010 Callable ,
11- Dict ,
1211 Iterable ,
1312 Iterator ,
1413 List ,
@@ -2153,7 +2152,7 @@ def pttl(self, name: KeyT) -> ResponseT:
21532152
21542153 def hrandfield (
21552154 self , key : str , count : int = None , withvalues : bool = False
2156- ) -> Union [ bytes , List [ bytes ], None ] :
2155+ ) -> ResponseT :
21572156 """
21582157 Return a random field from the hash value stored at key.
21592158
@@ -2995,7 +2994,7 @@ def scan(
29952994 count : Union [int , None ] = None ,
29962995 _type : Union [str , None ] = None ,
29972996 ** kwargs ,
2998- ) -> Tuple [ int , List [ bytes ]] :
2997+ ) -> ResponseT :
29992998 """
30002999 Incrementally return lists of key names. Also return a cursor
30013000 indicating the scan position.
@@ -3055,7 +3054,7 @@ def sscan(
30553054 cursor : int = 0 ,
30563055 match : Union [PatternT , None ] = None ,
30573056 count : Union [int , None ] = None ,
3058- ) -> Tuple [ int , List [ bytes ]] :
3057+ ) -> ResponseT :
30593058 """
30603059 Incrementally return lists of elements in a set. Also return a cursor
30613060 indicating the scan position.
@@ -3099,7 +3098,7 @@ def hscan(
30993098 match : Union [PatternT , None ] = None ,
31003099 count : Union [int , None ] = None ,
31013100 no_values : Union [bool , None ] = None ,
3102- ) -> Tuple [ int , Dict [ bytes , bytes ]] :
3101+ ) -> ResponseT :
31033102 """
31043103 Incrementally return key/value slices in a hash. Also return a cursor
31053104 indicating the scan position.
@@ -3155,7 +3154,7 @@ def zscan(
31553154 match : Union [PatternT , None ] = None ,
31563155 count : Union [int , None ] = None ,
31573156 score_cast_func : Union [type , Callable ] = float ,
3158- ) -> Tuple [ int , List [ Tuple [ bytes , float ]]] :
3157+ ) -> ResponseT :
31593158 """
31603159 Incrementally return lists of elements in a sorted set. Also return a
31613160 cursor indicating the scan position.
@@ -4944,63 +4943,69 @@ class HashCommands(CommandsProtocol):
49444943 see: https://valkey.io/topics/data-types-intro#valkey-hashes
49454944 """
49464945
4947- def hdel (self , name : str , * keys : str ) -> int :
4946+ def hdel (self , name : str , * keys : str ) -> Union [ Awaitable [ int ], int ] :
49484947 """
49494948 Delete ``keys`` from hash ``name``
49504949
49514950 For more information see https://valkey.io/commands/hdel
49524951 """
49534952 return self .execute_command ("HDEL" , name , * keys )
49544953
4955- def hexists (self , name : str , key : str ) -> bool :
4954+ def hexists (self , name : str , key : str ) -> Union [ Awaitable [ bool ], bool ] :
49564955 """
49574956 Returns a boolean indicating if ``key`` exists within hash ``name``
49584957
49594958 For more information see https://valkey.io/commands/hexists
49604959 """
49614960 return self .execute_command ("HEXISTS" , name , key , keys = [name ])
49624961
4963- def hget (self , name : str , key : str ) -> Optional [bytes ]:
4962+ def hget (
4963+ self , name : str , key : str
4964+ ) -> Union [Awaitable [Optional [str ]], Optional [str ]]:
49644965 """
49654966 Return the value of ``key`` within the hash ``name``
49664967
49674968 For more information see https://valkey.io/commands/hget
49684969 """
49694970 return self .execute_command ("HGET" , name , key , keys = [name ])
49704971
4971- def hgetall (self , name : str ) -> dict :
4972+ def hgetall (self , name : str ) -> Union [ Awaitable [ dict ], dict ] :
49724973 """
49734974 Return a Python dict of the hash's name/value pairs
49744975
49754976 For more information see https://valkey.io/commands/hgetall
49764977 """
49774978 return self .execute_command ("HGETALL" , name , keys = [name ])
49784979
4979- def hincrby (self , name : str , key : str , amount : int = 1 ) -> int :
4980+ def hincrby (
4981+ self , name : str , key : str , amount : int = 1
4982+ ) -> Union [Awaitable [int ], int ]:
49804983 """
49814984 Increment the value of ``key`` in hash ``name`` by ``amount``
49824985
49834986 For more information see https://valkey.io/commands/hincrby
49844987 """
49854988 return self .execute_command ("HINCRBY" , name , key , amount )
49864989
4987- def hincrbyfloat (self , name : str , key : str , amount : float = 1.0 ) -> float :
4990+ def hincrbyfloat (
4991+ self , name : str , key : str , amount : float = 1.0
4992+ ) -> Union [Awaitable [float ], float ]:
49884993 """
49894994 Increment the value of ``key`` in hash ``name`` by floating ``amount``
49904995
49914996 For more information see https://valkey.io/commands/hincrbyfloat
49924997 """
49934998 return self .execute_command ("HINCRBYFLOAT" , name , key , amount )
49944999
4995- def hkeys (self , name : str ) -> List [ bytes ]:
5000+ def hkeys (self , name : str ) -> Union [ Awaitable [ List ], List ]:
49965001 """
49975002 Return the list of keys within hash ``name``
49985003
49995004 For more information see https://valkey.io/commands/hkeys
50005005 """
50015006 return self .execute_command ("HKEYS" , name , keys = [name ])
50025007
5003- def hlen (self , name : str ) -> int :
5008+ def hlen (self , name : str ) -> Union [ Awaitable [ int ], int ] :
50045009 """
50055010 Return the number of elements in hash ``name``
50065011
@@ -5015,7 +5020,7 @@ def hset(
50155020 value : Optional [str ] = None ,
50165021 mapping : Optional [dict ] = None ,
50175022 items : Optional [list ] = None ,
5018- ) -> int :
5023+ ) -> Union [ Awaitable [ int ], int ] :
50195024 """
50205025 Set ``key`` to ``value`` within hash ``name``,
50215026 ``mapping`` accepts a dict of key/value pairs that will be
@@ -5039,7 +5044,7 @@ def hset(
50395044
50405045 return self .execute_command ("HSET" , name , * pieces )
50415046
5042- def hsetnx (self , name : str , key : str , value : str ) -> int :
5047+ def hsetnx (self , name : str , key : str , value : str ) -> Union [ Awaitable [ bool ], bool ] :
50435048 """
50445049 Set ``key`` to ``value`` within hash ``name`` if ``key`` does not
50455050 exist. Returns 1 if HSETNX created a field, otherwise 0.
@@ -5048,7 +5053,7 @@ def hsetnx(self, name: str, key: str, value: str) -> int:
50485053 """
50495054 return self .execute_command ("HSETNX" , name , key , value )
50505055
5051- def hmset (self , name : str , mapping : dict ) -> bool :
5056+ def hmset (self , name : str , mapping : dict ) -> Union [ Awaitable [ str ], str ] :
50525057 """
50535058 Set key to value within hash ``name`` for each corresponding
50545059 key and value from the ``mapping`` dict.
@@ -5068,7 +5073,7 @@ def hmset(self, name: str, mapping: dict) -> bool:
50685073 items .extend (pair )
50695074 return self .execute_command ("HMSET" , name , * items )
50705075
5071- def hmget (self , name : str , keys : List , * args : List ) -> List [ bytes ]:
5076+ def hmget (self , name : str , keys : List , * args : List ) -> Union [ Awaitable [ List ], List ]:
50725077 """
50735078 Returns a list of values ordered identically to ``keys``
50745079
@@ -5077,15 +5082,15 @@ def hmget(self, name: str, keys: List, *args: List) -> List[bytes]:
50775082 args = list_or_args (keys , args )
50785083 return self .execute_command ("HMGET" , name , * args , keys = [name ])
50795084
5080- def hvals (self , name : str ) -> List [ bytes ]:
5085+ def hvals (self , name : str ) -> Union [ Awaitable [ List ], List ]:
50815086 """
50825087 Return the list of values within hash ``name``
50835088
50845089 For more information see https://valkey.io/commands/hvals
50855090 """
50865091 return self .execute_command ("HVALS" , name , keys = [name ])
50875092
5088- def hstrlen (self , name : str , key : str ) -> int :
5093+ def hstrlen (self , name : str , key : str ) -> Union [ Awaitable [ int ], int ] :
50895094 """
50905095 Return the number of bytes stored in the value of ``key``
50915096 within hash ``name``
0 commit comments