summaryrefslogtreecommitdiff
path: root/sphinx/util/pycompat.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-01-07 22:27:05 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-01-07 22:54:37 +0900
commit39c0380c4de0b4b93c19e7d91e6309142548c9b7 (patch)
tree109c415474c497b504665fbcba36808d44c6f9ee /sphinx/util/pycompat.py
parent353c3e9fd6f35fb129dac61798ff1b09c14f6d85 (diff)
downloadsphinx-git-39c0380c4de0b4b93c19e7d91e6309142548c9b7.tar.gz
refactor: deprecate some pycompat functions
Diffstat (limited to 'sphinx/util/pycompat.py')
-rw-r--r--sphinx/util/pycompat.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py
index dfd6d2719..5f02bd979 100644
--- a/sphinx/util/pycompat.py
+++ b/sphinx/util/pycompat.py
@@ -8,13 +8,13 @@
:license: BSD, see LICENSE for details.
"""
+import html
+import io
import sys
+import textwrap
import warnings
-from html import escape as htmlescape # NOQA
-from io import TextIOWrapper # NOQA
-from textwrap import indent # NOQA
-from sphinx.deprecation import RemovedInSphinx40Warning
+from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias
from sphinx.locale import __
from sphinx.util import logging
@@ -31,10 +31,6 @@ NoneType = type(None)
# ------------------------------------------------------------------------------
# Python 2/3 compatibility
-# prefix for Unicode strings
-u = '' # RemovedInSphinx40Warning
-
-
# sys_encoding: some kind of default system encoding; should be used with
# a lenient error handler
sys_encoding = sys.getdefaultencoding()
@@ -99,3 +95,13 @@ def execfile_(filepath, _globals, open=open):
'Convert %s to Python 3 syntax.'),
filepath)
exec(code, _globals)
+
+
+deprecated_alias('sphinx.util.pycompat',
+ {
+ 'TextIOWrapper': io.TextIOWrapper,
+ 'htmlescape': html.escape,
+ 'indent': textwrap.indent,
+ 'u': '',
+ },
+ RemovedInSphinx40Warning)