summaryrefslogtreecommitdiff
path: root/sphinx/ext/imgmath.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2018-09-11 04:57:20 -0700
committerJon Dufresne <jon.dufresne@gmail.com>2018-09-11 05:45:36 -0700
commit02fea029bfc5bfd64e43de9e810aef2dd3c8cb2c (patch)
tree8460d233e013fe774e8e9d5a2cc3e3ef2392a37d /sphinx/ext/imgmath.py
parent844a3a5c226ff8891a1ce139f10ac92157c75da5 (diff)
downloadsphinx-git-02fea029bfc5bfd64e43de9e810aef2dd3c8cb2c.tar.gz
Prefer builtin open() over io.open() and codecs.open()
In Python3, the functions io.open() is an alias of the builtin open() and codecs.open() is functionally equivalent. To reduce indirection, number of imports, and number of patterns, always prefer the builtin. https://docs.python.org/3/library/io.html#high-level-module-interface > io.open() > > This is an alias for the builtin open() function.
Diffstat (limited to 'sphinx/ext/imgmath.py')
-rw-r--r--sphinx/ext/imgmath.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/sphinx/ext/imgmath.py b/sphinx/ext/imgmath.py
index 593835554..5be272ab1 100644
--- a/sphinx/ext/imgmath.py
+++ b/sphinx/ext/imgmath.py
@@ -9,7 +9,6 @@
:license: BSD, see LICENSE for details.
"""
-import codecs
import posixpath
import re
import shutil
@@ -123,7 +122,7 @@ def compile_math(latex, builder):
"""Compile LaTeX macros for math to DVI."""
tempdir = ensure_tempdir(builder)
filename = path.join(tempdir, 'math.tex')
- with codecs.open(filename, 'w', 'utf-8') as f: # type: ignore
+ with open(filename, 'w', encoding='utf-8') as f: # type: ignore
f.write(latex)
# build latex command; old versions of latex don't have the