mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-20 21:21:35 +02:00
Removed superfluous lopen builtin
This commit is contained in:
@@ -217,7 +217,7 @@ def cleanup_markup(log, root, styles, dest_dir, detect_cover, XPath):
|
||||
if os.path.exists(path) and before_count(root, img, limit=10) < 5:
|
||||
from ebook_converter.utils.imghdr import identify
|
||||
try:
|
||||
with lopen(path, 'rb') as imf:
|
||||
with open(path, 'rb') as imf:
|
||||
fmt, width, height = identify(imf)
|
||||
except:
|
||||
width, height, fmt = 0, 0, None # noqa
|
||||
|
||||
@@ -372,11 +372,11 @@ class Convert(object):
|
||||
def write(self, doc):
|
||||
toc = create_toc(doc, self.body, self.resolved_link_map, self.styles, self.object_map, self.log, self.namespace)
|
||||
raw = html.tostring(self.html, encoding='utf-8', doctype='<!DOCTYPE html>')
|
||||
with lopen(os.path.join(self.dest_dir, 'index.html'), 'wb') as f:
|
||||
with open(os.path.join(self.dest_dir, 'index.html'), 'wb') as f:
|
||||
f.write(raw)
|
||||
css = self.styles.generate_css(self.dest_dir, self.docx, self.notes_nopb, self.nosupsub)
|
||||
if css:
|
||||
with lopen(os.path.join(self.dest_dir, 'docx.css'), 'wb') as f:
|
||||
with open(os.path.join(self.dest_dir, 'docx.css'), 'wb') as f:
|
||||
f.write(css.encode('utf-8'))
|
||||
|
||||
opf = OPFCreator(self.dest_dir, self.mi)
|
||||
@@ -394,7 +394,7 @@ class Convert(object):
|
||||
guide.append(E.reference(
|
||||
href='index.html#' + self.toc_anchor, title=_('Table of Contents'), type='toc'))
|
||||
toc_file = os.path.join(self.dest_dir, 'toc.ncx')
|
||||
with lopen(os.path.join(self.dest_dir, 'metadata.opf'), 'wb') as of, open(toc_file, 'wb') as ncx:
|
||||
with open(os.path.join(self.dest_dir, 'metadata.opf'), 'wb') as of, open(toc_file, 'wb') as ncx:
|
||||
opf.render(of, ncx, 'toc.ncx', process_guide=process_guide)
|
||||
if os.path.getsize(toc_file) == 0:
|
||||
os.remove(toc_file)
|
||||
|
||||
Reference in New Issue
Block a user