1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-19 04:33:34 +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

View File

@@ -4,7 +4,6 @@ from ebook_converter import replace_entities
from ebook_converter.ebooks.metadata.toc import TOC
from ebook_converter.ebooks.mobi.reader.headers import NULL_INDEX
from ebook_converter.ebooks.mobi.reader.index import read_index
from ebook_converter.polyglot.builtins import iteritems
__license__ = 'GPL v3'
@@ -53,8 +52,7 @@ def read_ncx(sections, index, codec):
if index != NULL_INDEX:
table, cncx = read_index(sections, index, codec)
for num, x in enumerate(iteritems(table)):
text, tag_map = x
for num, (text, tag_map) in enumerate(table.items()):
entry = default_entry.copy()
entry['name'] = text
entry['num'] = num
@@ -68,9 +66,9 @@ def read_ncx(sections, index, codec):
# offset
fieldvalue = tuple(tag_map[tag])
entry[fieldname] = fieldvalue
for which, name in iteritems({3:'text', 5:'kind', 70:'description',
71:'author', 72:'image_caption',
73:'image_attribution'}):
for which, name in {3:'text', 5:'kind', 70:'description',
71:'author', 72:'image_caption',
73:'image_attribution'}.items():
if tag == which:
entry[name] = cncx.get(fieldvalue,
default_entry[name])