1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-03-12 04:25:48 +01: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

@@ -6,7 +6,6 @@ import pkg_resources
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
from ebook_converter import guess_type
from ebook_converter.polyglot.builtins import iteritems
__license__ = 'GPL v3'
@@ -105,7 +104,7 @@ class FB2Input(InputFormatPlugin):
notes = {a.get('href')[1:]: a for a in result.xpath('//a[@link_note and @href]') if a.get('href').startswith('#')}
cites = {a.get('link_cite'): a for a in result.xpath('//a[@link_cite]') if not a.get('href', '')}
all_ids = {x for x in result.xpath('//*/@id')}
for cite, a in iteritems(cites):
for cite, a in cites.items():
note = notes.get(cite, None)
if note:
c = 1

View File

@@ -6,7 +6,6 @@ import glob, os
from ebook_converter.customize.conversion import (OutputFormatPlugin,
OptionRecommendation)
from ebook_converter.ptempfile import TemporaryDirectory
from ebook_converter.polyglot.builtins import iteritems
__license__ = 'GPL 3'
@@ -234,7 +233,7 @@ class PDFOutput(OutputFormatPlugin):
self.process_fonts()
if self.opts.pdf_use_document_margins and self.stored_page_margins:
for href, margins in iteritems(self.stored_page_margins):
for href, margins in self.stored_page_margins.items():
item = oeb_book.manifest.hrefs.get(href)
if item is not None:
root = item.data

View File

@@ -2,7 +2,7 @@ import os, glob, re, textwrap
import pkg_resources
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
from ebook_converter.polyglot.builtins import iteritems, as_bytes
from ebook_converter.polyglot.builtins import as_bytes
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
@@ -147,7 +147,7 @@ class RTFInput(InputFormatPlugin):
def convert_images(self, imap):
self.default_img = None
for count, val in iteritems(imap):
for count, val in imap.items():
try:
imap[count] = self.convert_image(val)
except:
@@ -212,7 +212,7 @@ class RTFInput(InputFormatPlugin):
css += '\n'+'\n'.join(font_size_classes)
css += '\n' +'\n'.join(color_classes)
for cls, val in iteritems(border_styles):
for cls, val in border_styles.items():
css += '\n\n.%s {\n%s\n}'%(cls, val)
with open(u'styles.css', 'ab') as f: