prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  `HashCommandsMixin.hset()` doesn't support multiple field=value pairs
  > As of Redis 4.0.0, HSET is variadic and allows for multiple field/value pairs.
  
  https://redis.io/commands/hset
  
  And also info about HMSET usage:
  > As per Redis 4.0.0, HMSET is considered deprecated. Please use HSET in new code.
  
  https://redis.io/commands/hmset
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `aioredis/commands/hash.py`
  Content:
  ```
  1 from itertools import chain
  2 
  3 from aioredis.util import (
  4     wait_ok,
  5     wait_convert,
  6     wait_make_dict,
  7     _NOTSET,
  8     _ScanIter,
  9 )
  10 
  11 
  12 class HashCommandsMixin:
  13     """Hash commands mixin.
  14 
  15     For commands details see: http://redis.io/commands#hash
  16     """
  17 
  18     def hdel(self, key, field, *fields):
  19         """Delete one or more hash fields."""
  20         return self.execute(b"HDEL", key, field, *fields)
  21 
  22     def hexists(self, key, field):
  23         """Determine if hash field exists."""
  24         fut = self.execute(b"HEXISTS", key, field)
  25         return wait_convert(fut, bool)
  26 
  27     def hget(self, key, field, *, encoding=_NOTSET):
  28         """Get the value of a hash field."""
  29         return self.execute(b"HGET", key, field, encoding=encoding)
  30 
  31     def hgetall(self, key, *, encoding=_NOTSET):
  32         """Get all the fields and values in a hash."""
  33         fut = self.execute(b"HGETALL", key, encoding=encoding)
  34         return wait_make_dict(fut)
  35 
  36     def hincrby(self, key, field, increment=1):
  37         """Increment the integer value of a hash field by the given number."""
  38         return self.execute(b"HINCRBY", key, field, increment)
  39 
  40     def hincrbyfloat(self, key, field, increment=1.0):
  41         """Increment the float value of a hash field by the given number."""
  42         fut = self.execute(b"HINCRBYFLOAT", key, field, increment)
  43         return wait_convert(fut, float)
  44 
  45     def hkeys(self, key, *, encoding=_NOTSET):
  46         """Get all the fields in a hash."""
  47         return self.execute(b"HKEYS", key, encoding=encoding)
  48 
  49     def hlen(self, key):
  50         """Get the number of fields in a hash."""
  51         return self.execute(b"HLEN", key)
  52 
  53     def hmget(self, key, field, *fields, encoding=_NOTSET):
  54         """Get the values of all the given fields."""
  55         return self.execute(b"HMGET", key, field, *fields, encoding=encoding)
  56 
  57     def hmset(self, key, field, value, *pairs):
  58         """Set multiple hash fields to multiple values."""
  59         if len(pairs) % 2 != 0:
  60             raise TypeError("length of pairs must be even number")
  61         return wait_ok(self.execute(b"HMSET", key, field, value, *pairs))
  62 
  63     def hmset_dict(self, key, *args, **kwargs):
  64         """Set multiple hash fields to multiple values.
  65 
  66         dict can be passed as first positional argument:
  67 
  68         >>> await redis.hmset_dict(
  69         ...     'key', {'field1': 'value1', 'field2': 'value2'})
  70 
  71         or keyword arguments can be used:
  72 
  73         >>> await redis.hmset_dict(
  74         ...     'key', field1='value1', field2='value2')
  75 
  76         or dict argument can be mixed with kwargs:
  77 
  78         >>> await redis.hmset_dict(
  79         ...     'key', {'field1': 'value1'}, field2='value2')
  80 
  81         .. note:: ``dict`` and ``kwargs`` not get mixed into single dictionary,
  82            if both specified and both have same key(s) -- ``kwargs`` will win:
  83 
  84            >>> await redis.hmset_dict('key', {'foo': 'bar'}, foo='baz')
  85            >>> await redis.hget('key', 'foo', encoding='utf-8')
  86            'baz'
  87 
  88         """
  89         if not args and not kwargs:
  90             raise TypeError("args or kwargs must be specified")
  91         pairs = ()
  92         if len(args) > 1:
  93             raise TypeError("single positional argument allowed")
  94         elif len(args) == 1:
  95             if not isinstance(args[0], dict):
  96                 raise TypeError("args[0] must be dict")
  97             elif not args[0] and not kwargs:
  98                 raise ValueError("args[0] is empty dict")
  99             pairs = chain.from_iterable(args[0].items())
  100         kwargs_pairs = chain.from_iterable(kwargs.items())
  101         return wait_ok(self.execute(b"HMSET", key, *chain(pairs, kwargs_pairs)))
  102 
  103     def hset(self, key, field, value):
  104         """Set the string value of a hash field."""
  105         return self.execute(b"HSET", key, field, value)
  106 
  107     def hsetnx(self, key, field, value):
  108         """Set the value of a hash field, only if the field does not exist."""
  109         return self.execute(b"HSETNX", key, field, value)
  110 
  111     def hvals(self, key, *, encoding=_NOTSET):
  112         """Get all the values in a hash."""
  113         return self.execute(b"HVALS", key, encoding=encoding)
  114 
  115     def hscan(self, key, cursor=0, match=None, count=None):
  116         """Incrementally iterate hash fields and associated values."""
  117         args = [key, cursor]
  118         match is not None and args.extend([b"MATCH", match])
  119         count is not None and args.extend([b"COUNT", count])
  120         fut = self.execute(b"HSCAN", *args)
  121         return wait_convert(fut, _make_pairs)
  122 
  123     def ihscan(self, key, *, match=None, count=None):
  124         """Incrementally iterate sorted set items using async for.
  125 
  126         Usage example:
  127 
  128         >>> async for name, val in redis.ihscan(key, match='something*'):
  129         ...     print('Matched:', name, '->', val)
  130 
  131         """
  132         return _ScanIter(lambda cur: self.hscan(key, cur, match=match, count=count))
  133 
  134     def hstrlen(self, key, field):
  135         """Get the length of the value of a hash field."""
  136         return self.execute(b"HSTRLEN", key, field)
  137 
  138 
  139 def _make_pairs(obj):
  140     it = iter(obj[1])
  141     return (int(obj[0]), list(zip(it, it)))
  142
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/aioredis/commands/hash.py b/aioredis/commands/hash.py
  --- a/aioredis/commands/hash.py
  +++ b/aioredis/commands/hash.py
  @@ -1,3 +1,4 @@
  +import warnings
   from itertools import chain
   
   from aioredis.util import (
  @@ -55,7 +56,17 @@
           return self.execute(b"HMGET", key, field, *fields, encoding=encoding)
   
       def hmset(self, key, field, value, *pairs):
  -        """Set multiple hash fields to multiple values."""
  +        """Set multiple hash fields to multiple values.
  +
  +        .. deprecated::
  +            HMSET is deprecated since redis 4.0.0, use HSET instead.
  +
  +        """
  +        warnings.warn(
  +            "%s.hmset() is deprecated since redis 4.0.0, use %s.hset() instead"
  +            % (self.__class__.__name__, self.__class__.__name__),
  +            DeprecationWarning
  +        )
           if len(pairs) % 2 != 0:
               raise TypeError("length of pairs must be even number")
           return wait_ok(self.execute(b"HMSET", key, field, value, *pairs))
  @@ -63,6 +74,9 @@
       def hmset_dict(self, key, *args, **kwargs):
           """Set multiple hash fields to multiple values.
   
  +        .. deprecated::
  +            HMSET is deprecated since redis 4.0.0, use HSET instead.
  +
           dict can be passed as first positional argument:
   
           >>> await redis.hmset_dict(
  @@ -86,6 +100,12 @@
              'baz'
   
           """
  +        warnings.warn(
  +            "%s.hmset() is deprecated since redis 4.0.0, use %s.hset() instead"
  +            % (self.__class__.__name__, self.__class__.__name__),
  +            DeprecationWarning
  +        )
  +
           if not args and not kwargs:
               raise TypeError("args or kwargs must be specified")
           pairs = ()
  @@ -100,9 +120,31 @@
           kwargs_pairs = chain.from_iterable(kwargs.items())
           return wait_ok(self.execute(b"HMSET", key, *chain(pairs, kwargs_pairs)))
   
  -    def hset(self, key, field, value):
  -        """Set the string value of a hash field."""
  -        return self.execute(b"HSET", key, field, value)
  +    def hset(self, key, field=None, value=None, mapping=None):
  +        """Set multiple hash fields to multiple values.
  +
  +        Setting a single hash field to a value:
  +        >>> await redis.hset('key', 'some_field', 'some_value')
  +
  +        Setting values for multipe has fields at once:
  +        >>> await redis.hset('key', mapping={'field1': 'abc', 'field2': 'def'})
  +
  +        .. note:: Using both the field/value pair and mapping at the same time
  +           will also work.
  +
  +        """
  +        if not field and not mapping:
  +            raise ValueError("hset needs either a field/value pair or mapping")
  +        if mapping and not isinstance(mapping, dict):
  +            raise TypeError("'mapping' should be dict")
  +
  +        items = []
  +        if field:
  +            items.extend((field, value))
  +        if mapping:
  +            for item in mapping.items():
  +                items.extend(item)
  +        return self.execute(b"HSET", key, *items)
   
       def hsetnx(self, key, field, value):
           """Set the value of a hash field, only if the field does not exist."""
  
verification_info: {"golden_diff": "diff --git a/aioredis/commands/hash.py b/aioredis/commands/hash.py\n--- a/aioredis/commands/hash.py\n+++ b/aioredis/commands/hash.py\n@@ -1,3 +1,4 @@\n+import warnings\n from itertools import chain\n \n from aioredis.util import (\n@@ -55,7 +56,17 @@\n         return self.execute(b\"HMGET\", key, field, *fields, encoding=encoding)\n \n     def hmset(self, key, field, value, *pairs):\n-        \"\"\"Set multiple hash fields to multiple values.\"\"\"\n+        \"\"\"Set multiple hash fields to multiple values.\n+\n+        .. deprecated::\n+            HMSET is deprecated since redis 4.0.0, use HSET instead.\n+\n+        \"\"\"\n+        warnings.warn(\n+            \"%s.hmset() is deprecated since redis 4.0.0, use %s.hset() instead\"\n+            % (self.__class__.__name__, self.__class__.__name__),\n+            DeprecationWarning\n+        )\n         if len(pairs) % 2 != 0:\n             raise TypeError(\"length of pairs must be even number\")\n         return wait_ok(self.execute(b\"HMSET\", key, field, value, *pairs))\n@@ -63,6 +74,9 @@\n     def hmset_dict(self, key, *args, **kwargs):\n         \"\"\"Set multiple hash fields to multiple values.\n \n+        .. deprecated::\n+            HMSET is deprecated since redis 4.0.0, use HSET instead.\n+\n         dict can be passed as first positional argument:\n \n         >>> await redis.hmset_dict(\n@@ -86,6 +100,12 @@\n            'baz'\n \n         \"\"\"\n+        warnings.warn(\n+            \"%s.hmset() is deprecated since redis 4.0.0, use %s.hset() instead\"\n+            % (self.__class__.__name__, self.__class__.__name__),\n+            DeprecationWarning\n+        )\n+\n         if not args and not kwargs:\n             raise TypeError(\"args or kwargs must be specified\")\n         pairs = ()\n@@ -100,9 +120,31 @@\n         kwargs_pairs = chain.from_iterable(kwargs.items())\n         return wait_ok(self.execute(b\"HMSET\", key, *chain(pairs, kwargs_pairs)))\n \n-    def hset(self, key, field, value):\n-        \"\"\"Set the string value of a hash field.\"\"\"\n-        return self.execute(b\"HSET\", key, field, value)\n+    def hset(self, key, field=None, value=None, mapping=None):\n+        \"\"\"Set multiple hash fields to multiple values.\n+\n+        Setting a single hash field to a value:\n+        >>> await redis.hset('key', 'some_field', 'some_value')\n+\n+        Setting values for multipe has fields at once:\n+        >>> await redis.hset('key', mapping={'field1': 'abc', 'field2': 'def'})\n+\n+        .. note:: Using both the field/value pair and mapping at the same time\n+           will also work.\n+\n+        \"\"\"\n+        if not field and not mapping:\n+            raise ValueError(\"hset needs either a field/value pair or mapping\")\n+        if mapping and not isinstance(mapping, dict):\n+            raise TypeError(\"'mapping' should be dict\")\n+\n+        items = []\n+        if field:\n+            items.extend((field, value))\n+        if mapping:\n+            for item in mapping.items():\n+                items.extend(item)\n+        return self.execute(b\"HSET\", key, *items)\n \n     def hsetnx(self, key, field, value):\n         \"\"\"Set the value of a hash field, only if the field does not exist.\"\"\"\n", "issue": "`HashCommandsMixin.hset()` doesn't support multiple field=value pairs\n> As of Redis 4.0.0, HSET is variadic and allows for multiple field/value pairs.\r\n\r\nhttps://redis.io/commands/hset\r\n\r\nAnd also info about HMSET usage:\r\n> As per Redis 4.0.0, HMSET is considered deprecated. Please use HSET in new code.\r\n\r\nhttps://redis.io/commands/hmset\n", "before_files": [{"content": "from itertools import chain\n\nfrom aioredis.util import (\n    wait_ok,\n    wait_convert,\n    wait_make_dict,\n    _NOTSET,\n    _ScanIter,\n)\n\n\nclass HashCommandsMixin:\n    \"\"\"Hash commands mixin.\n\n    For commands details see: http://redis.io/commands#hash\n    \"\"\"\n\n    def hdel(self, key, field, *fields):\n        \"\"\"Delete one or more hash fields.\"\"\"\n        return self.execute(b\"HDEL\", key, field, *fields)\n\n    def hexists(self, key, field):\n        \"\"\"Determine if hash field exists.\"\"\"\n        fut = self.execute(b\"HEXISTS\", key, field)\n        return wait_convert(fut, bool)\n\n    def hget(self, key, field, *, encoding=_NOTSET):\n        \"\"\"Get the value of a hash field.\"\"\"\n        return self.execute(b\"HGET\", key, field, encoding=encoding)\n\n    def hgetall(self, key, *, encoding=_NOTSET):\n        \"\"\"Get all the fields and values in a hash.\"\"\"\n        fut = self.execute(b\"HGETALL\", key, encoding=encoding)\n        return wait_make_dict(fut)\n\n    def hincrby(self, key, field, increment=1):\n        \"\"\"Increment the integer value of a hash field by the given number.\"\"\"\n        return self.execute(b\"HINCRBY\", key, field, increment)\n\n    def hincrbyfloat(self, key, field, increment=1.0):\n        \"\"\"Increment the float value of a hash field by the given number.\"\"\"\n        fut = self.execute(b\"HINCRBYFLOAT\", key, field, increment)\n        return wait_convert(fut, float)\n\n    def hkeys(self, key, *, encoding=_NOTSET):\n        \"\"\"Get all the fields in a hash.\"\"\"\n        return self.execute(b\"HKEYS\", key, encoding=encoding)\n\n    def hlen(self, key):\n        \"\"\"Get the number of fields in a hash.\"\"\"\n        return self.execute(b\"HLEN\", key)\n\n    def hmget(self, key, field, *fields, encoding=_NOTSET):\n        \"\"\"Get the values of all the given fields.\"\"\"\n        return self.execute(b\"HMGET\", key, field, *fields, encoding=encoding)\n\n    def hmset(self, key, field, value, *pairs):\n        \"\"\"Set multiple hash fields to multiple values.\"\"\"\n        if len(pairs) % 2 != 0:\n            raise TypeError(\"length of pairs must be even number\")\n        return wait_ok(self.execute(b\"HMSET\", key, field, value, *pairs))\n\n    def hmset_dict(self, key, *args, **kwargs):\n        \"\"\"Set multiple hash fields to multiple values.\n\n        dict can be passed as first positional argument:\n\n        >>> await redis.hmset_dict(\n        ...     'key', {'field1': 'value1', 'field2': 'value2'})\n\n        or keyword arguments can be used:\n\n        >>> await redis.hmset_dict(\n        ...     'key', field1='value1', field2='value2')\n\n        or dict argument can be mixed with kwargs:\n\n        >>> await redis.hmset_dict(\n        ...     'key', {'field1': 'value1'}, field2='value2')\n\n        .. note:: ``dict`` and ``kwargs`` not get mixed into single dictionary,\n           if both specified and both have same key(s) -- ``kwargs`` will win:\n\n           >>> await redis.hmset_dict('key', {'foo': 'bar'}, foo='baz')\n           >>> await redis.hget('key', 'foo', encoding='utf-8')\n           'baz'\n\n        \"\"\"\n        if not args and not kwargs:\n            raise TypeError(\"args or kwargs must be specified\")\n        pairs = ()\n        if len(args) > 1:\n            raise TypeError(\"single positional argument allowed\")\n        elif len(args) == 1:\n            if not isinstance(args[0], dict):\n                raise TypeError(\"args[0] must be dict\")\n            elif not args[0] and not kwargs:\n                raise ValueError(\"args[0] is empty dict\")\n            pairs = chain.from_iterable(args[0].items())\n        kwargs_pairs = chain.from_iterable(kwargs.items())\n        return wait_ok(self.execute(b\"HMSET\", key, *chain(pairs, kwargs_pairs)))\n\n    def hset(self, key, field, value):\n        \"\"\"Set the string value of a hash field.\"\"\"\n        return self.execute(b\"HSET\", key, field, value)\n\n    def hsetnx(self, key, field, value):\n        \"\"\"Set the value of a hash field, only if the field does not exist.\"\"\"\n        return self.execute(b\"HSETNX\", key, field, value)\n\n    def hvals(self, key, *, encoding=_NOTSET):\n        \"\"\"Get all the values in a hash.\"\"\"\n        return self.execute(b\"HVALS\", key, encoding=encoding)\n\n    def hscan(self, key, cursor=0, match=None, count=None):\n        \"\"\"Incrementally iterate hash fields and associated values.\"\"\"\n        args = [key, cursor]\n        match is not None and args.extend([b\"MATCH\", match])\n        count is not None and args.extend([b\"COUNT\", count])\n        fut = self.execute(b\"HSCAN\", *args)\n        return wait_convert(fut, _make_pairs)\n\n    def ihscan(self, key, *, match=None, count=None):\n        \"\"\"Incrementally iterate sorted set items using async for.\n\n        Usage example:\n\n        >>> async for name, val in redis.ihscan(key, match='something*'):\n        ...     print('Matched:', name, '->', val)\n\n        \"\"\"\n        return _ScanIter(lambda cur: self.hscan(key, cur, match=match, count=count))\n\n    def hstrlen(self, key, field):\n        \"\"\"Get the length of the value of a hash field.\"\"\"\n        return self.execute(b\"HSTRLEN\", key, field)\n\n\ndef _make_pairs(obj):\n    it = iter(obj[1])\n    return (int(obj[0]), list(zip(it, it)))\n", "path": "aioredis/commands/hash.py"}], "after_files": [{"content": "import warnings\nfrom itertools import chain\n\nfrom aioredis.util import (\n    wait_ok,\n    wait_convert,\n    wait_make_dict,\n    _NOTSET,\n    _ScanIter,\n)\n\n\nclass HashCommandsMixin:\n    \"\"\"Hash commands mixin.\n\n    For commands details see: http://redis.io/commands#hash\n    \"\"\"\n\n    def hdel(self, key, field, *fields):\n        \"\"\"Delete one or more hash fields.\"\"\"\n        return self.execute(b\"HDEL\", key, field, *fields)\n\n    def hexists(self, key, field):\n        \"\"\"Determine if hash field exists.\"\"\"\n        fut = self.execute(b\"HEXISTS\", key, field)\n        return wait_convert(fut, bool)\n\n    def hget(self, key, field, *, encoding=_NOTSET):\n        \"\"\"Get the value of a hash field.\"\"\"\n        return self.execute(b\"HGET\", key, field, encoding=encoding)\n\n    def hgetall(self, key, *, encoding=_NOTSET):\n        \"\"\"Get all the fields and values in a hash.\"\"\"\n        fut = self.execute(b\"HGETALL\", key, encoding=encoding)\n        return wait_make_dict(fut)\n\n    def hincrby(self, key, field, increment=1):\n        \"\"\"Increment the integer value of a hash field by the given number.\"\"\"\n        return self.execute(b\"HINCRBY\", key, field, increment)\n\n    def hincrbyfloat(self, key, field, increment=1.0):\n        \"\"\"Increment the float value of a hash field by the given number.\"\"\"\n        fut = self.execute(b\"HINCRBYFLOAT\", key, field, increment)\n        return wait_convert(fut, float)\n\n    def hkeys(self, key, *, encoding=_NOTSET):\n        \"\"\"Get all the fields in a hash.\"\"\"\n        return self.execute(b\"HKEYS\", key, encoding=encoding)\n\n    def hlen(self, key):\n        \"\"\"Get the number of fields in a hash.\"\"\"\n        return self.execute(b\"HLEN\", key)\n\n    def hmget(self, key, field, *fields, encoding=_NOTSET):\n        \"\"\"Get the values of all the given fields.\"\"\"\n        return self.execute(b\"HMGET\", key, field, *fields, encoding=encoding)\n\n    def hmset(self, key, field, value, *pairs):\n        \"\"\"Set multiple hash fields to multiple values.\n\n        .. deprecated::\n            HMSET is deprecated since redis 4.0.0, use HSET instead.\n\n        \"\"\"\n        warnings.warn(\n            \"%s.hmset() is deprecated since redis 4.0.0, use %s.hset() instead\"\n            % (self.__class__.__name__, self.__class__.__name__),\n            DeprecationWarning\n        )\n        if len(pairs) % 2 != 0:\n            raise TypeError(\"length of pairs must be even number\")\n        return wait_ok(self.execute(b\"HMSET\", key, field, value, *pairs))\n\n    def hmset_dict(self, key, *args, **kwargs):\n        \"\"\"Set multiple hash fields to multiple values.\n\n        .. deprecated::\n            HMSET is deprecated since redis 4.0.0, use HSET instead.\n\n        dict can be passed as first positional argument:\n\n        >>> await redis.hmset_dict(\n        ...     'key', {'field1': 'value1', 'field2': 'value2'})\n\n        or keyword arguments can be used:\n\n        >>> await redis.hmset_dict(\n        ...     'key', field1='value1', field2='value2')\n\n        or dict argument can be mixed with kwargs:\n\n        >>> await redis.hmset_dict(\n        ...     'key', {'field1': 'value1'}, field2='value2')\n\n        .. note:: ``dict`` and ``kwargs`` not get mixed into single dictionary,\n           if both specified and both have same key(s) -- ``kwargs`` will win:\n\n           >>> await redis.hmset_dict('key', {'foo': 'bar'}, foo='baz')\n           >>> await redis.hget('key', 'foo', encoding='utf-8')\n           'baz'\n\n        \"\"\"\n        warnings.warn(\n            \"%s.hmset() is deprecated since redis 4.0.0, use %s.hset() instead\"\n            % (self.__class__.__name__, self.__class__.__name__),\n            DeprecationWarning\n        )\n\n        if not args and not kwargs:\n            raise TypeError(\"args or kwargs must be specified\")\n        pairs = ()\n        if len(args) > 1:\n            raise TypeError(\"single positional argument allowed\")\n        elif len(args) == 1:\n            if not isinstance(args[0], dict):\n                raise TypeError(\"args[0] must be dict\")\n            elif not args[0] and not kwargs:\n                raise ValueError(\"args[0] is empty dict\")\n            pairs = chain.from_iterable(args[0].items())\n        kwargs_pairs = chain.from_iterable(kwargs.items())\n        return wait_ok(self.execute(b\"HMSET\", key, *chain(pairs, kwargs_pairs)))\n\n    def hset(self, key, field=None, value=None, mapping=None):\n        \"\"\"Set multiple hash fields to multiple values.\n\n        Setting a single hash field to a value:\n        >>> await redis.hset('key', 'some_field', 'some_value')\n\n        Setting values for multipe has fields at once:\n        >>> await redis.hset('key', mapping={'field1': 'abc', 'field2': 'def'})\n\n        .. note:: Using both the field/value pair and mapping at the same time\n           will also work.\n\n        \"\"\"\n        if not field and not mapping:\n            raise ValueError(\"hset needs either a field/value pair or mapping\")\n        if mapping and not isinstance(mapping, dict):\n            raise TypeError(\"'mapping' should be dict\")\n\n        items = []\n        if field:\n            items.extend((field, value))\n        if mapping:\n            for item in mapping.items():\n                items.extend(item)\n        return self.execute(b\"HSET\", key, *items)\n\n    def hsetnx(self, key, field, value):\n        \"\"\"Set the value of a hash field, only if the field does not exist.\"\"\"\n        return self.execute(b\"HSETNX\", key, field, value)\n\n    def hvals(self, key, *, encoding=_NOTSET):\n        \"\"\"Get all the values in a hash.\"\"\"\n        return self.execute(b\"HVALS\", key, encoding=encoding)\n\n    def hscan(self, key, cursor=0, match=None, count=None):\n        \"\"\"Incrementally iterate hash fields and associated values.\"\"\"\n        args = [key, cursor]\n        match is not None and args.extend([b\"MATCH\", match])\n        count is not None and args.extend([b\"COUNT\", count])\n        fut = self.execute(b\"HSCAN\", *args)\n        return wait_convert(fut, _make_pairs)\n\n    def ihscan(self, key, *, match=None, count=None):\n        \"\"\"Incrementally iterate sorted set items using async for.\n\n        Usage example:\n\n        >>> async for name, val in redis.ihscan(key, match='something*'):\n        ...     print('Matched:', name, '->', val)\n\n        \"\"\"\n        return _ScanIter(lambda cur: self.hscan(key, cur, match=match, count=count))\n\n    def hstrlen(self, key, field):\n        \"\"\"Get the length of the value of a hash field.\"\"\"\n        return self.execute(b\"HSTRLEN\", key, field)\n\n\ndef _make_pairs(obj):\n    it = iter(obj[1])\n    return (int(obj[0]), list(zip(it, it)))\n", "path": "aioredis/commands/hash.py"}]}