summaryrefslogtreecommitdiff
path: root/sphinx/util/pycompat.py
diff options
context:
space:
mode:
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)