@@ -4944,63 +4944,69 @@ class HashCommands(CommandsProtocol):
49444944 see: https://valkey.io/topics/data-types-intro#valkey-hashes
49454945 """
49464946
4947- def hdel (self , name : str , * keys : str ) -> int :
4947+ def hdel (self , name : str , * keys : str ) -> Union [ Awaitable [ int ], int ] :
49484948 """
49494949 Delete ``keys`` from hash ``name``
49504950
49514951 For more information see https://valkey.io/commands/hdel
49524952 """
49534953 return self .execute_command ("HDEL" , name , * keys )
49544954
4955- def hexists (self , name : str , key : str ) -> bool :
4955+ def hexists (self , name : str , key : str ) -> Union [ Awaitable [ bool ], bool ] :
49564956 """
49574957 Returns a boolean indicating if ``key`` exists within hash ``name``
49584958
49594959 For more information see https://valkey.io/commands/hexists
49604960 """
49614961 return self .execute_command ("HEXISTS" , name , key , keys = [name ])
49624962
4963- def hget (self , name : str , key : str ) -> Optional [bytes ]:
4963+ def hget (
4964+ self , name : str , key : str
4965+ ) -> Union [Awaitable [Optional [str ]], Optional [str ]]:
49644966 """
49654967 Return the value of ``key`` within the hash ``name``
49664968
49674969 For more information see https://valkey.io/commands/hget
49684970 """
49694971 return self .execute_command ("HGET" , name , key , keys = [name ])
49704972
4971- def hgetall (self , name : str ) -> dict :
4973+ def hgetall (self , name : str ) -> Union [ Awaitable [ dict ], dict ] :
49724974 """
49734975 Return a Python dict of the hash's name/value pairs
49744976
49754977 For more information see https://valkey.io/commands/hgetall
49764978 """
49774979 return self .execute_command ("HGETALL" , name , keys = [name ])
49784980
4979- def hincrby (self , name : str , key : str , amount : int = 1 ) -> int :
4981+ def hincrby (
4982+ self , name : str , key : str , amount : int = 1
4983+ ) -> Union [Awaitable [int ], int ]:
49804984 """
49814985 Increment the value of ``key`` in hash ``name`` by ``amount``
49824986
49834987 For more information see https://valkey.io/commands/hincrby
49844988 """
49854989 return self .execute_command ("HINCRBY" , name , key , amount )
49864990
4987- def hincrbyfloat (self , name : str , key : str , amount : float = 1.0 ) -> float :
4991+ def hincrbyfloat (
4992+ self , name : str , key : str , amount : float = 1.0
4993+ ) -> Union [Awaitable [float ], float ]:
49884994 """
49894995 Increment the value of ``key`` in hash ``name`` by floating ``amount``
49904996
49914997 For more information see https://valkey.io/commands/hincrbyfloat
49924998 """
49934999 return self .execute_command ("HINCRBYFLOAT" , name , key , amount )
49945000
4995- def hkeys (self , name : str ) -> List [ bytes ]:
5001+ def hkeys (self , name : str ) -> Union [ Awaitable [ List ], List ]:
49965002 """
49975003 Return the list of keys within hash ``name``
49985004
49995005 For more information see https://valkey.io/commands/hkeys
50005006 """
50015007 return self .execute_command ("HKEYS" , name , keys = [name ])
50025008
5003- def hlen (self , name : str ) -> int :
5009+ def hlen (self , name : str ) -> Union [ Awaitable [ int ], int ] :
50045010 """
50055011 Return the number of elements in hash ``name``
50065012
@@ -5015,7 +5021,7 @@ def hset(
50155021 value : Optional [str ] = None ,
50165022 mapping : Optional [dict ] = None ,
50175023 items : Optional [list ] = None ,
5018- ) -> int :
5024+ ) -> Union [ Awaitable [ int ], int ] :
50195025 """
50205026 Set ``key`` to ``value`` within hash ``name``,
50215027 ``mapping`` accepts a dict of key/value pairs that will be
@@ -5039,7 +5045,7 @@ def hset(
50395045
50405046 return self .execute_command ("HSET" , name , * pieces )
50415047
5042- def hsetnx (self , name : str , key : str , value : str ) -> int :
5048+ def hsetnx (self , name : str , key : str , value : str ) -> Union [ Awaitable [ bool ], bool ] :
50435049 """
50445050 Set ``key`` to ``value`` within hash ``name`` if ``key`` does not
50455051 exist. Returns 1 if HSETNX created a field, otherwise 0.
@@ -5048,7 +5054,7 @@ def hsetnx(self, name: str, key: str, value: str) -> int:
50485054 """
50495055 return self .execute_command ("HSETNX" , name , key , value )
50505056
5051- def hmset (self , name : str , mapping : dict ) -> bool :
5057+ def hmset (self , name : str , mapping : dict ) -> Union [ Awaitable [ str ], str ] :
50525058 """
50535059 Set key to value within hash ``name`` for each corresponding
50545060 key and value from the ``mapping`` dict.
@@ -5068,7 +5074,7 @@ def hmset(self, name: str, mapping: dict) -> bool:
50685074 items .extend (pair )
50695075 return self .execute_command ("HMSET" , name , * items )
50705076
5071- def hmget (self , name : str , keys : List , * args : List ) -> List [ bytes ]:
5077+ def hmget (self , name : str , keys : List , * args : List ) -> Union [ Awaitable [ List ], List ]:
50725078 """
50735079 Returns a list of values ordered identically to ``keys``
50745080
@@ -5077,15 +5083,15 @@ def hmget(self, name: str, keys: List, *args: List) -> List[bytes]:
50775083 args = list_or_args (keys , args )
50785084 return self .execute_command ("HMGET" , name , * args , keys = [name ])
50795085
5080- def hvals (self , name : str ) -> List [ bytes ]:
5086+ def hvals (self , name : str ) -> Union [ Awaitable [ List ], List ]:
50815087 """
50825088 Return the list of values within hash ``name``
50835089
50845090 For more information see https://valkey.io/commands/hvals
50855091 """
50865092 return self .execute_command ("HVALS" , name , keys = [name ])
50875093
5088- def hstrlen (self , name : str , key : str ) -> int :
5094+ def hstrlen (self , name : str , key : str ) -> Union [ Awaitable [ int ], int ] :
50895095 """
50905096 Return the number of bytes stored in the value of ``key``
50915097 within hash ``name``
0 commit comments