summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
authorAgustin Marquez <agusdmb@gmail.com>2021-10-25 08:28:50 +0200
committerGitHub <noreply@github.com>2021-10-25 09:28:50 +0300
commit36e00ec4e22a9f947e099affdfdc79862ac7ca08 (patch)
tree033f6af87bc7726b5d431015ea8b6c05c2053ec7 /redis/client.py
parentcf5c5865bb9947498f3810b028628f3d2ab14030 (diff)
downloadredis-py-36e00ec4e22a9f947e099affdfdc79862ac7ca08.tar.gz
Add FULL option to XINFO SUMMARY (#1638)
Diffstat (limited to 'redis/client.py')
-rwxr-xr-xredis/client.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/redis/client.py b/redis/client.py
index fde153d..a6bd183 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -308,14 +308,24 @@ def parse_xautoclaim(response, **options):
return parse_stream_list(response[1])
-def parse_xinfo_stream(response):
+def parse_xinfo_stream(response, **options):
data = pairs_to_dict(response, decode_keys=True)
- first = data['first-entry']
- if first is not None:
- data['first-entry'] = (first[0], pairs_to_dict(first[1]))
- last = data['last-entry']
- if last is not None:
- data['last-entry'] = (last[0], pairs_to_dict(last[1]))
+ if not options.get('full', False):
+ first = data['first-entry']
+ if first is not None:
+ data['first-entry'] = (first[0], pairs_to_dict(first[1]))
+ last = data['last-entry']
+ if last is not None:
+ data['last-entry'] = (last[0], pairs_to_dict(last[1]))
+ else:
+ data['entries'] = {
+ _id: pairs_to_dict(entry)
+ for _id, entry in data['entries']
+ }
+ data['groups'] = [
+ pairs_to_dict(group, decode_keys=True)
+ for group in data['groups']
+ ]
return data