summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
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'])