summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-09-29 21:12:40 +0900
committerGitHub <noreply@github.com>2018-09-29 21:12:40 +0900
commit973c3ffa25f6f14e53382f7a45ffbeee9d252b3c (patch)
treed4d500f2dad3bbdab82820f1f4bb2ae5bc97a6ff /sphinx/directives/code.py
parentabcb5bd5eca6ea46ffcc34a55b663083d03f339c (diff)
parentd2c3d54bb9a46c5e7a0d14c3345e489d7592de9a (diff)
downloadsphinx-git-973c3ffa25f6f14e53382f7a45ffbeee9d252b3c.tar.gz
Merge branch 'master' into change_master_doc_to_index
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r--sphinx/directives/code.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index a98ab5883..e14a451d9 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -7,7 +7,6 @@
:license: BSD, see LICENSE for details.
"""
-import codecs
import sys
import warnings
from difflib import unified_diff
@@ -177,7 +176,7 @@ class CodeBlock(SphinxDirective):
return [literal]
-class LiteralIncludeReader(object):
+class LiteralIncludeReader:
INVALID_OPTIONS_PAIR = [
('lineno-match', 'lineno-start'),
('lineno-match', 'append'),
@@ -213,7 +212,8 @@ class LiteralIncludeReader(object):
def read_file(self, filename, location=None):
# type: (unicode, Any) -> List[unicode]
try:
- with codecs.open(filename, 'r', self.encoding, errors='strict') as f: # type: ignore # NOQA
+ with open(filename, 'r', # type: ignore
+ encoding=self.encoding, errors='strict') as f:
text = f.read() # type: unicode
if 'tab-width' in self.options:
text = text.expandtabs(self.options['tab-width'])