mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-03-26 20:43:32 +01:00
Removed iteritems and itervalues, which are redundant
This commit is contained in:
@@ -10,7 +10,6 @@ import pkg_resources
|
||||
|
||||
from ebook_converter.utils.lock import ExclusiveFile
|
||||
from ebook_converter.constants import config_dir, CONFIG_DIR_MODE, ispy3, preferred_encoding, filesystem_encoding, iswindows
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
|
||||
plugin_dir = os.path.join(config_dir, 'plugins')
|
||||
|
||||
@@ -92,7 +91,7 @@ def force_unicode_recursive(obj):
|
||||
if isinstance(obj, (list, tuple)):
|
||||
return type(obj)(map(force_unicode_recursive, obj))
|
||||
if isinstance(obj, dict):
|
||||
return {force_unicode_recursive(k): force_unicode_recursive(v) for k, v in iteritems(obj)}
|
||||
return {force_unicode_recursive(k): force_unicode_recursive(v) for k, v in obj.items()}
|
||||
return obj
|
||||
|
||||
|
||||
@@ -569,7 +568,7 @@ def make_unicode(obj):
|
||||
if isinstance(obj, (list, tuple)):
|
||||
return list(map(make_unicode, obj))
|
||||
if isinstance(obj, dict):
|
||||
return {make_unicode(k): make_unicode(v) for k, v in iteritems(obj)}
|
||||
return {make_unicode(k): make_unicode(v) for k, v in obj.items()}
|
||||
return obj
|
||||
|
||||
|
||||
@@ -577,7 +576,7 @@ def normalize_tweak(val):
|
||||
if isinstance(val, (list, tuple)):
|
||||
return tuple(map(normalize_tweak, val))
|
||||
if isinstance(val, dict):
|
||||
return {k: normalize_tweak(v) for k, v in iteritems(val)}
|
||||
return {k: normalize_tweak(v) for k, v in val.items()}
|
||||
return val
|
||||
|
||||
|
||||
@@ -586,7 +585,7 @@ def write_custom_tweaks(tweaks_dict):
|
||||
tweaks_dict = make_unicode(tweaks_dict)
|
||||
changed_tweaks = {}
|
||||
default_tweaks = exec_tweaks(default_tweaks_raw())
|
||||
for key, cval in iteritems(tweaks_dict):
|
||||
for key, cval in tweaks_dict.items():
|
||||
if key in default_tweaks and normalize_tweak(cval) == normalize_tweak(default_tweaks[key]):
|
||||
continue
|
||||
changed_tweaks[key] = cval
|
||||
|
||||
Reference in New Issue
Block a user