@@ -331,9 +331,15 @@ def parse_xinfo_stream(response, **options):
331
331
data ["last-entry" ] = (last [0 ], pairs_to_dict (last [1 ]))
332
332
else :
333
333
data ["entries" ] = {_id : pairs_to_dict (entry ) for _id , entry in data ["entries" ]}
334
- data ["groups" ] = [
335
- pairs_to_dict (group , decode_keys = True ) for group in data ["groups" ]
336
- ]
334
+ if isinstance (data ["groups" ][0 ], list ):
335
+ data ["groups" ] = [
336
+ pairs_to_dict (group , decode_keys = True ) for group in data ["groups" ]
337
+ ]
338
+ else :
339
+ data ["groups" ] = [
340
+ {str_if_bytes (k ): v for k , v in group .items ()}
341
+ for group in data ["groups" ]
342
+ ]
337
343
return data
338
344
339
345
@@ -581,14 +587,15 @@ def parse_command_resp3(response, **options):
581
587
cmd_name = str_if_bytes (command [0 ])
582
588
cmd_dict ["name" ] = cmd_name
583
589
cmd_dict ["arity" ] = command [1 ]
584
- cmd_dict ["flags" ] = command [2 ]
590
+ cmd_dict ["flags" ] = { str_if_bytes ( flag ) for flag in command [2 ]}
585
591
cmd_dict ["first_key_pos" ] = command [3 ]
586
592
cmd_dict ["last_key_pos" ] = command [4 ]
587
593
cmd_dict ["step_count" ] = command [5 ]
588
594
cmd_dict ["acl_categories" ] = command [6 ]
589
- cmd_dict ["tips" ] = command [7 ]
590
- cmd_dict ["key_specifications" ] = command [8 ]
591
- cmd_dict ["subcommands" ] = command [9 ]
595
+ if len (command ) > 7 :
596
+ cmd_dict ["tips" ] = command [7 ]
597
+ cmd_dict ["key_specifications" ] = command [8 ]
598
+ cmd_dict ["subcommands" ] = command [9 ]
592
599
593
600
commands [cmd_name ] = cmd_dict
594
601
return commands
@@ -626,17 +633,20 @@ def parse_acl_getuser(response, **options):
626
633
if data ["channels" ] == ["" ]:
627
634
data ["channels" ] = []
628
635
if "selectors" in data :
629
- data ["selectors" ] = [
630
- list (map (str_if_bytes , selector )) for selector in data ["selectors" ]
631
- ]
636
+ if data ["selectors" ] != [] and isinstance (data ["selectors" ][0 ], list ):
637
+ data ["selectors" ] = [
638
+ list (map (str_if_bytes , selector )) for selector in data ["selectors" ]
639
+ ]
640
+ elif data ["selectors" ] != []:
641
+ data ["selectors" ] = [
642
+ {str_if_bytes (k ): str_if_bytes (v ) for k , v in selector .items ()}
643
+ for selector in data ["selectors" ]
644
+ ]
632
645
633
646
# split 'commands' into separate 'categories' and 'commands' lists
634
647
commands , categories = [], []
635
648
for command in data ["commands" ].split (" " ):
636
- if "@" in command :
637
- categories .append (command )
638
- else :
639
- commands .append (command )
649
+ categories .append (command ) if "@" in command else commands .append (command )
640
650
641
651
data ["commands" ] = commands
642
652
data ["categories" ] = categories
0 commit comments