py3: use proper dict.keys() handling

This commit is contained in:
Eli Schwartz 2019-05-20 00:48:23 -04:00
parent 4b0e241555
commit a8a74b7c53
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6

View File

@ -608,12 +608,10 @@ if another paragraph_def is found, the state changes to collect_tokens.
# when determining uniqueness for a style, ingorne these values, since
# they don't tell us if the style is unique
ignore_values = ['style-num', 'nest-level', 'in-table']
keys = self.__att_val_dict.keys()
keys.sort()
for key in keys:
if key in ignore_values:
for k, v in self.__att_val_dict.items():
if k in ignore_values:
continue
my_string += '%s:%s' % (key, self.__att_val_dict[key])
my_string += '%s:%s' % (k, v)
if my_string in self.__style_num_strings:
num = self.__style_num_strings.index(my_string)
num += 1 # since indexing starts at zero, rather than 1
@ -637,12 +635,9 @@ if another paragraph_def is found, the state changes to collect_tokens.
the_value = self.__att_val_dict['tabs']
# the_value = the_value[:-1]
style_string += ('<%s>%s' % ('tabs', the_value))
keys = self.__att_val_dict.keys()
keys.sort()
for key in keys:
if key != 'name' and key !='style-num' and key != 'in-table'\
and key not in tabs_list:
style_string += ('<%s>%s' % (key, self.__att_val_dict[key]))
for k, v in self.__att_val_dict.items():
if k not in ['name', 'style-num', 'in-table'] + tabs_list:
style_string += ('<%s>%s' % (k, v))
style_string += '\n'
self.__body_style_strings.append(style_string)
@ -690,11 +685,9 @@ if another paragraph_def is found, the state changes to collect_tokens.
the_value = self.__att_val_dict['tabs']
# the_value = the_value[:-1]
self.__write_obj.write('<%s>%s' % ('tabs', the_value))
keys = self.__att_val_dict.keys()
keys.sort()
keys = sorted(self.__att_val_dict.keys())
for key in keys:
if key != 'name' and key !='style-num' and key != 'in-table'\
and key not in tabs_list:
if key not in ['name', 'style-num', 'in-table'] + tabs_list:
self.__write_obj.write('<%s>%s' % (key, self.__att_val_dict[key]))
self.__write_obj.write('\n')
self.__write_obj.write(self.__start2_marker)