mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix mypy violations
This commit is contained in:
parent
5433d5c03d
commit
779d25f7f1
@ -707,9 +707,9 @@ class EpubBuilder(StandaloneHTMLBuilder):
|
||||
"""
|
||||
logger.info('writing %s file...', outname)
|
||||
epub_filename = path.join(outdir, outname)
|
||||
with ZipFile(epub_filename, 'w', ZIP_DEFLATED) as epub: # type: ignore
|
||||
epub.write(path.join(outdir, 'mimetype'), 'mimetype', ZIP_STORED) # type: ignore
|
||||
with ZipFile(epub_filename, 'w', ZIP_DEFLATED) as epub:
|
||||
epub.write(path.join(outdir, 'mimetype'), 'mimetype', ZIP_STORED)
|
||||
for filename in [u'META-INF/container.xml', u'content.opf', u'toc.ncx']:
|
||||
epub.write(path.join(outdir, filename), filename, ZIP_DEFLATED) # type: ignore
|
||||
epub.write(path.join(outdir, filename), filename, ZIP_DEFLATED)
|
||||
for filename in self.files:
|
||||
epub.write(path.join(outdir, filename), filename, ZIP_DEFLATED) # type: ignore
|
||||
epub.write(path.join(outdir, filename), filename, ZIP_DEFLATED)
|
||||
|
@ -43,7 +43,7 @@ def extract_zip(filename, targetdir):
|
||||
"""Extract zip file to target directory."""
|
||||
ensuredir(targetdir)
|
||||
|
||||
with ZipFile(filename) as archive: # type: ignore
|
||||
with ZipFile(filename) as archive:
|
||||
for name in archive.namelist():
|
||||
if name.endswith('/'):
|
||||
continue
|
||||
@ -155,7 +155,7 @@ def is_archived_theme(filename):
|
||||
# type: (unicode) -> bool
|
||||
"""Check the specified file is an archived theme file or not."""
|
||||
try:
|
||||
with ZipFile(filename) as f: # type: ignore
|
||||
with ZipFile(filename) as f:
|
||||
return THEMECONF in f.namelist()
|
||||
except Exception:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user