summaryrefslogtreecommitdiff
path: root/sphinx/builders/htmlhelp.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/builders/htmlhelp.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/builders/htmlhelp.py')
-rw-r--r--sphinx/builders/htmlhelp.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/sphinx/builders/htmlhelp.py b/sphinx/builders/htmlhelp.py
index 52600ca21..4d5172a8f 100644
--- a/sphinx/builders/htmlhelp.py
+++ b/sphinx/builders/htmlhelp.py
@@ -11,7 +11,6 @@
"""
from __future__ import print_function
-import codecs
import os
from os import path
@@ -208,8 +207,8 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder):
def open_file(self, outdir, basename, mode='w'):
# type: (unicode, unicode, unicode) -> IO
# open a file with the correct encoding for the selected language
- return codecs.open(path.join(outdir, basename), mode, # type: ignore
- self.encoding, 'xmlcharrefreplace')
+ return open(path.join(outdir, basename), mode, # type: ignore
+ encoding=self.encoding, errors='xmlcharrefreplace')
def update_page_context(self, pagename, templatename, ctx, event_arg):
# type: (unicode, unicode, Dict, unicode) -> None