diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-12-13 01:33:14 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-12-15 02:42:42 +0900 |
commit | 53917f228f9bfbb4607b6441119baeb129869b93 (patch) | |
tree | 4e87e2e8a2fc209f74a3675dc0f079bda78b6a3b /sphinx/builders/changes.py | |
parent | f8a2e7aa8af27b9d90330d9d795ef20fe0158001 (diff) | |
download | sphinx-git-53917f228f9bfbb4607b6441119baeb129869b93.tar.gz |
Move to py3 mode for mypy (and remove many "type: ignore" comments)
Diffstat (limited to 'sphinx/builders/changes.py')
-rw-r--r-- | sphinx/builders/changes.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sphinx/builders/changes.py b/sphinx/builders/changes.py index 5bf6ad6bb..5f1999003 100644 --- a/sphinx/builders/changes.py +++ b/sphinx/builders/changes.py @@ -113,11 +113,9 @@ class ChangesBuilder(Builder): 'show_copyright': self.config.html_show_copyright, 'show_sphinx': self.config.html_show_sphinx, } - with open(path.join(self.outdir, 'index.html'), 'w', # type: ignore - encoding='utf8') as f: + with open(path.join(self.outdir, 'index.html'), 'w', encoding='utf8') as f: f.write(self.templates.render('changes/frameset.html', ctx)) - with open(path.join(self.outdir, 'changes.html'), 'w', # type: ignore - encoding='utf8') as f: + with open(path.join(self.outdir, 'changes.html'), 'w', encoding='utf8') as f: f.write(self.templates.render('changes/versionchanges.html', ctx)) hltext = ['.. versionadded:: %s' % version, @@ -135,7 +133,7 @@ class ChangesBuilder(Builder): logger.info(bold(__('copying source files...'))) for docname in self.env.all_docs: - with open(self.env.doc2path(docname), # type: ignore + with open(self.env.doc2path(docname), encoding=self.env.config.source_encoding) as f: try: lines = f.readlines() @@ -144,7 +142,7 @@ class ChangesBuilder(Builder): continue targetfn = path.join(self.outdir, 'rst', os_path(docname)) + '.html' ensuredir(path.dirname(targetfn)) - with open(targetfn, 'w', encoding='utf-8') as f: # type: ignore + with open(targetfn, 'w', encoding='utf-8') as f: text = ''.join(hl(i + 1, line) for (i, line) in enumerate(lines)) ctx = { 'filename': self.env.doc2path(docname, None), |