1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-22 14:11:31 +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
+4 -5
View File
@@ -2,7 +2,6 @@ from lxml.html.builder import TABLE, TR, TD
from ebook_converter.ebooks.docx.block_styles import inherit, read_shd as rs, read_border, binary_property, border_props, ParagraphStyle, border_to_css
from ebook_converter.ebooks.docx.char_styles import RunStyle
from ebook_converter.polyglot.builtins import iteritems, itervalues
__license__ = 'GPL v3'
@@ -82,7 +81,7 @@ def read_spacing(parent, dest, XPath, get):
def read_float(parent, dest, XPath, get):
ans = inherit
for x in XPath('./w:tblpPr')(parent):
ans = {k.rpartition('}')[-1]: v for k, v in iteritems(x.attrib)}
ans = {k.rpartition('}')[-1]: v for k, v in x.attrib.items()}
setattr(dest, 'float', ans)
@@ -614,7 +613,7 @@ class Table(object):
def __iter__(self):
for p in self.paragraphs:
yield p
for t in itervalues(self.sub_tables):
for t in self.sub_tables.values():
for p in t:
yield p
@@ -661,7 +660,7 @@ class Table(object):
table_style = self.table_style.css
if table_style:
table.set('class', self.styles.register(table_style, 'table'))
for elem, style in iteritems(style_map):
for elem, style in style_map.items():
css = style.css
if css:
elem.set('class', self.styles.register(css, elem.tag))
@@ -682,7 +681,7 @@ class Tables(object):
self.sub_tables |= set(self.tables[-1].sub_tables)
def apply_markup(self, object_map, page_map):
rmap = {v:k for k, v in iteritems(object_map)}
rmap = {v:k for k, v in object_map.items()}
for table in self.tables:
table.apply_markup(rmap, page_map[table.tbl])