Skip to content

Commit

Permalink
add_upgrade_boot_entry: make sure to not expand unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Hecko committed Aug 14, 2024
1 parent e61f179 commit a8a2476
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ def fmt_single_arg(arg_pair):
def flatten_arguments(arg_pair):
""" Expand multi-valued values into an iterable (key, value1), (key, value2) """
key, value = arg_pair
if isinstance(value, str) or value is None:
yield (key, value) # Just a single (key, value) pair
else:
if isinstance(value, (tuple, list)):
# value is multi-valued (a tuple of values)
for value_elem in value: # yield from is not available in python2.7
yield (key, value_elem)
else:
yield (key, value) # Just a single (key, value) pair

arg_sequence = itertools.chain(*(flatten_arguments(arg_pair) for arg_pair in args_dict.items()))

Expand Down

0 comments on commit a8a2476

Please sign in to comment.