summaryrefslogtreecommitdiff
path: root/sphinx/util/i18n.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/util/i18n.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/util/i18n.py')
-rw-r--r--sphinx/util/i18n.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/sphinx/util/i18n.py b/sphinx/util/i18n.py
index edaebebda..2b557ec93 100644
--- a/sphinx/util/i18n.py
+++ b/sphinx/util/i18n.py
@@ -9,7 +9,6 @@
:license: BSD, see LICENSE for details.
"""
import gettext
-import io
import os
import re
import warnings
@@ -69,14 +68,14 @@ class CatalogInfo(LocaleFileInfoBase):
def write_mo(self, locale):
# type: (unicode) -> None
- with io.open(self.po_path, 'rt', encoding=self.charset) as file_po:
+ with open(self.po_path, 'rt', encoding=self.charset) as file_po: # type: ignore
try:
po = read_po(file_po, locale)
except Exception as exc:
logger.warning(__('reading error: %s, %s'), self.po_path, exc)
return
- with io.open(self.mo_path, 'wb') as file_mo:
+ with open(self.mo_path, 'wb') as file_mo:
try:
write_mo(file_mo, po)
except Exception as exc: