@@ -331,9 +331,15 @@ def parse_xinfo_stream(response, **options):
331331 data ["last-entry" ] = (last [0 ], pairs_to_dict (last [1 ]))
332332 else :
333333 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+ ]
337343 return data
338344
339345
@@ -581,14 +587,15 @@ def parse_command_resp3(response, **options):
581587 cmd_name = str_if_bytes (command [0 ])
582588 cmd_dict ["name" ] = cmd_name
583589 cmd_dict ["arity" ] = command [1 ]
584- cmd_dict ["flags" ] = command [2 ]
590+ cmd_dict ["flags" ] = { str_if_bytes ( flag ) for flag in command [2 ]}
585591 cmd_dict ["first_key_pos" ] = command [3 ]
586592 cmd_dict ["last_key_pos" ] = command [4 ]
587593 cmd_dict ["step_count" ] = command [5 ]
588594 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 ]
592599
593600 commands [cmd_name ] = cmd_dict
594601 return commands
@@ -626,17 +633,20 @@ def parse_acl_getuser(response, **options):
626633 if data ["channels" ] == ["" ]:
627634 data ["channels" ] = []
628635 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+ ]
632645
633646 # split 'commands' into separate 'categories' and 'commands' lists
634647 commands , categories = [], []
635648 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 )
640650
641651 data ["commands" ] = commands
642652 data ["categories" ] = categories
0 commit comments