diff options
author | Peter Bell <peterbell10@live.co.uk> | 2020-07-15 00:08:44 +0100 |
---|---|---|
committer | Peter Bell <peterbell10@live.co.uk> | 2020-07-15 00:12:31 +0100 |
commit | bedc00faa6c1c35ab11673734c462d9652651da5 (patch) | |
tree | 4a18da8ec248ad49b94d05491f00f3320fc0a07a /sphinx/util | |
parent | d5482643d70e9ead27b3e4ecbfffacabf27e3e5f (diff) | |
download | sphinx-git-bedc00faa6c1c35ab11673734c462d9652651da5.tar.gz |
Require canonical name to be specified when calling deprecated_alias
Diffstat (limited to 'sphinx/util')
-rw-r--r-- | sphinx/util/pycompat.py | 18 | ||||
-rw-r--r-- | sphinx/util/texescape.py | 14 |
2 files changed, 17 insertions, 15 deletions
diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py index 2173fce14..6ec180f0b 100644 --- a/sphinx/util/pycompat.py +++ b/sphinx/util/pycompat.py @@ -15,7 +15,8 @@ import textwrap import warnings from typing import Any, Callable -from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias +from sphinx.deprecation import ( + RemovedInSphinx40Warning, deprecated_alias, deprecated_attribute) from sphinx.locale import __ from sphinx.util import logging from sphinx.util.console import terminal_safe @@ -91,12 +92,13 @@ def execfile_(filepath: str, _globals: Any, open: Callable = open) -> None: deprecated_alias('sphinx.util.pycompat', { - 'NoneType': NoneType, - 'TextIOWrapper': io.TextIOWrapper, - 'htmlescape': html.escape, - 'indent': textwrap.indent, - 'terminal_safe': terminal_safe, - 'sys_encoding': sys.getdefaultencoding(), - 'u': '', + 'NoneType': ('sphinx.util.typing.NoneType', NoneType), + 'TextIOWrapper': ('io.TextIOWrapper', io.TextIOWrapper), + 'htmlescape': ('html.escape', html.escape), + 'indent': ('textwrap.indent', textwrap.indent), + 'terminal_safe': ('sphinx.util.console.terminal_safe', terminal_safe), + 'sys_encoding': ('sys.getdefaultencoding', sys.getdefaultencoding()), }, RemovedInSphinx40Warning) + +deprecated_attribute('sphinx.util.pycompat', {'u': ''}, RemovedInSphinx40Warning) diff --git a/sphinx/util/texescape.py b/sphinx/util/texescape.py index afa1c349e..a581a4295 100644 --- a/sphinx/util/texescape.py +++ b/sphinx/util/texescape.py @@ -11,7 +11,7 @@ import re from typing import Dict -from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias +from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_attribute tex_replacements = [ @@ -109,12 +109,12 @@ _tex_hlescape_map = {} # type: Dict[int, str] _tex_hlescape_map_without_unicode = {} # type: Dict[int, str] -deprecated_alias('sphinx.util.texescape', - { - 'tex_escape_map': _tex_escape_map, - 'tex_hl_escape_map_new': _tex_hlescape_map, - }, - RemovedInSphinx40Warning) +deprecated_attribute('sphinx.util.texescape', + { + 'tex_escape_map': _tex_escape_map, + 'tex_hl_escape_map_new': _tex_hlescape_map, + }, + RemovedInSphinx40Warning) def escape(s: str, latex_engine: str = None) -> str: |