glh123456/OmniGIRL huggingface dataset:
Repository: redis/redis-py (Python)

Issue:
"bug" about acl_genpass method
Thanks for wanting to report an issue you've found in redis-py.    Please delete this text and fill in the template below.
It is of course not always possible to reduce your code to a small test case, but it's highly appreciated to have as much data as possible.    Thank you!

**Version**: 5.0.1, "bug" about acl_genpass method

**Platform**: win11

**Description**: Refer to the following demo

demo:

```python
from redis import Redis

url = "redis://localhost:6379/1"
rdb = Redis.from_url(url)

print(rdb.acl_genpass(32))
```

This script is similar to `ACL GENPASS [bits]`, we will get an 8-digit password. But what we got didn't meet expectations.

Your source code might get the desired result this way:

```python
    def acl_genpass(self, bits: Union[int, None] = None, **kwargs) -> ResponseT:
        """Generate a random password value.
        If ``bits`` is supplied then use this number of bits, rounded to
        the next multiple of 4.
        See: https://redis.io/commands/acl-genpass
        """
        pieces = []
        if bits is not None:
            try:
                b = int(bits)
                if b < 0 or b > 4096:
                    raise ValueError
                pieces.append(b)
            except ValueError:
                raise DataError(
                    "genpass optionally accepts a bits argument, between 0 and 4096."
                )
        return self.execute_command("ACL GENPASS", *pieces, **kwargs)
```




Hints:

Patch:
diff --git a/redis/commands/core.py b/redis/commands/core.py
--- a/redis/commands/core.py
+++ b/redis/commands/core.py
@@ -97,6 +97,7 @@ def acl_genpass(self, bits: Union[int, None] = None, **kwargs) -> ResponseT:
                 b = int(bits)
                 if b < 0 or b > 4096:
                     raise ValueError
+                pieces.append(b)
             except ValueError:
                 raise DataError(
                     "genpass optionally accepts a bits argument, between 0 and 4096."


Test patch:
diff --git a/tests/test_commands.py b/tests/test_commands.py
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -201,8 +201,9 @@ def test_acl_genpass(self, r):
             r.acl_genpass(-5)
             r.acl_genpass(5555)
 
-        r.acl_genpass(555)
+        password = r.acl_genpass(555)
         assert isinstance(password, (str, bytes))
+        assert len(password) == 139
 
     @skip_if_server_version_lt("7.0.0")
     @skip_if_redis_enterprise()
Repository: redis/redis-py (Python)

Issue:
Discrepancy in `INFO` response parsing
**Version**: `5.0.0`

**Description**: The code for parsing the `INFO` response is creating a discrepancy in the new RediSearch index field types field, e.g., `search_fields_text`.
If there is more than one section to this field its corresponding value (e.g., `TEXT=1, SORTABLE=1`) is returned as a dictionary (as expected), while if there is only one value for it (e.g., `TEXT=1`) it is returned as a string!

This is bad since we later use this value assuming that it is a dictionary, and thus face failures in the case that it is not.
The wanted behavior: We always get a dictionary back, whether we have only one section for this value or more.

Example: We have one section for the `TEXT` field, and two for the `TAG` field, and this is what we get:
![image](https://github.com/redis/redis-py/assets/74051729/51282024-7e1c-4d2a-bae8-04dcaf0fc53e)

The source of the problem is in the `parse_info()` function, [here](https://github.com/redis/redis-py/blob/19b55c62389c890a96dd611e28aaaedba7506720/redis/_parsers/helpers.py#L35-L36).

Thanks!



Hints:

Patch:
diff --git a/redis/_parsers/helpers.py b/redis/_parsers/helpers.py
--- a/redis/_parsers/helpers.py
+++ b/redis/_parsers/helpers.py
@@ -38,7 +38,7 @@ def parse_info(response):
     response = str_if_bytes(response)
 
     def get_value(value):
-        if "," not in value or "=" not in value:
+        if "," not in value and "=" not in value:
             try:
                 if "." in value:
                     return float(value)


Test patch:
diff --git a/tests/test_parsers/test_helpers.py b/tests/test_parsers/test_helpers.py
new file mode 100644
--- /dev/null
+++ b/tests/test_parsers/test_helpers.py
@@ -0,0 +1,35 @@
+from redis._parsers.helpers import parse_info
+
+
+def test_parse_info():
+    info_output = """
+# Modules
+module:name=search,ver=999999,api=1,filters=0,usedby=[],using=[ReJSON],options=[handle-io-errors]
+
+# search_fields_statistics
+search_fields_text:Text=3
+search_fields_tag:Tag=2,Sortable=1
+
+# search_version
+search_version:99.99.99
+search_redis_version:7.2.2 - oss
+
+# search_runtime_configurations
+search_query_timeout_ms:500
+    """
+    info = parse_info(info_output)
+
+    assert isinstance(info["modules"], list)
+    assert isinstance(info["modules"][0], dict)
+    assert info["modules"][0]["name"] == "search"
+
+    assert isinstance(info["search_fields_text"], dict)
+    assert info["search_fields_text"]["Text"] == 3
+
+    assert isinstance(info["search_fields_tag"], dict)
+    assert info["search_fields_tag"]["Tag"] == 2
+    assert info["search_fields_tag"]["Sortable"] == 1
+
+    assert info["search_version"] == "99.99.99"
+    assert info["search_redis_version"] == "7.2.2 - oss"
+    assert info["search_query_timeout_ms"] == 500