mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: Move NoneType to sphinx.util.typing
This commit is contained in:
parent
d40ce68c7b
commit
b25deb259e
1
CHANGES
1
CHANGES
@ -120,6 +120,7 @@ Deprecated
|
|||||||
* ``sphinx.util.osutil.EPIPE``
|
* ``sphinx.util.osutil.EPIPE``
|
||||||
* ``sphinx.util.osutil.walk()``
|
* ``sphinx.util.osutil.walk()``
|
||||||
* ``sphinx.util.PeekableIterator``
|
* ``sphinx.util.PeekableIterator``
|
||||||
|
* ``sphinx.util.pycompat.NoneType``
|
||||||
* ``sphinx.util.pycompat.TextIOWrapper``
|
* ``sphinx.util.pycompat.TextIOWrapper``
|
||||||
* ``sphinx.util.pycompat.UnicodeMixin``
|
* ``sphinx.util.pycompat.UnicodeMixin``
|
||||||
* ``sphinx.util.pycompat.htmlescape``
|
* ``sphinx.util.pycompat.htmlescape``
|
||||||
|
@ -420,6 +420,11 @@ The following is a list of deprecated interfaces.
|
|||||||
- 4.0
|
- 4.0
|
||||||
- ``os.walk()``
|
- ``os.walk()``
|
||||||
|
|
||||||
|
* - ``sphinx.util.pycompat.NoneType``
|
||||||
|
- 2.0
|
||||||
|
- 4.0
|
||||||
|
- ``sphinx.util.typing.NoneType``
|
||||||
|
|
||||||
* - ``sphinx.util.pycompat.TextIOWrapper``
|
* - ``sphinx.util.pycompat.TextIOWrapper``
|
||||||
- 2.0
|
- 2.0
|
||||||
- 4.0
|
- 4.0
|
||||||
|
@ -22,7 +22,8 @@ from sphinx.locale import _, __
|
|||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util.i18n import format_date
|
from sphinx.util.i18n import format_date
|
||||||
from sphinx.util.osutil import cd
|
from sphinx.util.osutil import cd
|
||||||
from sphinx.util.pycompat import execfile_, NoneType
|
from sphinx.util.pycompat import execfile_
|
||||||
|
from sphinx.util.typing import NoneType
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
|
@ -20,7 +20,7 @@ from io import StringIO
|
|||||||
|
|
||||||
from sphinx.deprecation import RemovedInSphinx30Warning
|
from sphinx.deprecation import RemovedInSphinx30Warning
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util.pycompat import NoneType
|
from sphinx.util.typing import NoneType
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
|
@ -18,7 +18,7 @@ from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias
|
|||||||
from sphinx.locale import __
|
from sphinx.locale import __
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util.console import terminal_safe
|
from sphinx.util.console import terminal_safe
|
||||||
|
from sphinx.util.typing import NoneType
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
@ -28,8 +28,6 @@ if False:
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
NoneType = type(None)
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Python 2/3 compatibility
|
# Python 2/3 compatibility
|
||||||
|
|
||||||
@ -95,6 +93,7 @@ def execfile_(filepath, _globals, open=open):
|
|||||||
|
|
||||||
deprecated_alias('sphinx.util.pycompat',
|
deprecated_alias('sphinx.util.pycompat',
|
||||||
{
|
{
|
||||||
|
'NoneType': NoneType, # type: ignore
|
||||||
'TextIOWrapper': io.TextIOWrapper,
|
'TextIOWrapper': io.TextIOWrapper,
|
||||||
'htmlescape': html.escape,
|
'htmlescape': html.escape,
|
||||||
'indent': textwrap.indent,
|
'indent': textwrap.indent,
|
||||||
|
@ -20,6 +20,9 @@ DirectiveOption = Callable[[str], Any]
|
|||||||
# Text like nodes which are initialized with text and rawsource
|
# Text like nodes which are initialized with text and rawsource
|
||||||
TextlikeNode = Union[nodes.Text, nodes.TextElement]
|
TextlikeNode = Union[nodes.Text, nodes.TextElement]
|
||||||
|
|
||||||
|
# type of None
|
||||||
|
NoneType = type(None)
|
||||||
|
|
||||||
# common role functions
|
# common role functions
|
||||||
RoleFunction = Callable[[str, str, str, int, Inliner, Dict, List[str]],
|
RoleFunction = Callable[[str, str, str, int, Inliner, Dict, List[str]],
|
||||||
Tuple[List[nodes.Node], List[nodes.system_message]]]
|
Tuple[List[nodes.Node], List[nodes.system_message]]]
|
||||||
|
Loading…
Reference in New Issue
Block a user