1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-22 06:01:32 +02:00

Removed iteritems and itervalues, which are redundant

This commit is contained in:
2020-04-21 18:20:08 +02:00
parent 9e076e0af4
commit 3234e4de27
82 changed files with 382 additions and 457 deletions
+5 -6
View File
@@ -7,7 +7,6 @@ from ebook_converter.ebooks.docx.names import barename
from ebook_converter.utils.filenames import ascii_filename
from ebook_converter.utils.img import resize_to_fit, image_to_data
from ebook_converter.utils.imghdr import what
from ebook_converter.polyglot.builtins import iteritems, itervalues
__license__ = 'GPL v3'
@@ -63,7 +62,7 @@ def get_image_properties(parent, XPath, get):
def get_image_margins(elem):
ans = {}
for w, css in iteritems({'L':'left', 'T':'top', 'R':'right', 'B':'bottom'}):
for w, css in {'L':'left', 'T':'top', 'R':'right', 'B':'bottom'}.items():
val = elem.get('dist%s' % w, None)
if val is not None:
try:
@@ -154,7 +153,7 @@ class Images(object):
return raw, base
def unique_name(self, base):
exists = frozenset(itervalues(self.used))
exists = frozenset(self.used.values())
c = 1
name = base
while name in exists:
@@ -239,7 +238,7 @@ class Images(object):
ans = self.pic_to_img(pic, alt, inline, title)
if ans is not None:
if style:
ans.set('style', '; '.join('%s: %s' % (k, v) for k, v in iteritems(style)))
ans.set('style', '; '.join('%s: %s' % (k, v) for k, v in style.items()))
yield ans
# Now process the floats
@@ -250,7 +249,7 @@ class Images(object):
ans = self.pic_to_img(pic, alt, anchor, title)
if ans is not None:
if style:
ans.set('style', '; '.join('%s: %s' % (k, v) for k, v in iteritems(style)))
ans.set('style', '; '.join('%s: %s' % (k, v) for k, v in style.items()))
yield ans
def pict_to_html(self, pict, page):
@@ -272,7 +271,7 @@ class Images(object):
style['margin-left'] = '0' if align == 'left' else 'auto'
style['margin-right'] = 'auto' if align == 'left' else '0'
if style:
hr.set('style', '; '.join(('%s:%s' % (k, v) for k, v in iteritems(style))))
hr.set('style', '; '.join(('%s:%s' % (k, v) for k, v in style.items())))
yield hr
for imagedata in XPath('descendant::v:imagedata[@r:id]')(pict):