mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Remove deprecated functions in `sphinx.util
`
This commit is contained in:
parent
d444a0c800
commit
35a0f7386b
27
CHANGES.rst
27
CHANGES.rst
@ -7,6 +7,33 @@ Dependencies
|
||||
Incompatible changes
|
||||
--------------------
|
||||
|
||||
.. rst-class:: compact
|
||||
|
||||
* Remove deprecated functions from ``sphinx.util``:
|
||||
|
||||
* Removed ``sphinx.util.path_stabilize``
|
||||
(use ``sphinx.util.osutil.path_stabilize``).
|
||||
* Removed ``sphinx.util.display_chunk``
|
||||
(use ``sphinx.util.display.display_chunk``).
|
||||
* Removed ``sphinx.util.status_iterator``
|
||||
(use ``sphinx.util.display.status_iterator``).
|
||||
* Removed ``sphinx.util.SkipProgressMessage``
|
||||
(use ``sphinx.util.display.SkipProgressMessage``).
|
||||
* Removed ``sphinx.util.progress_message``
|
||||
(use ``sphinx.util.display.progress_message``).
|
||||
* Removed ``sphinx.util.epoch_to_rfc1123``
|
||||
(use ``sphinx.http_date.epoch_to_rfc1123``).
|
||||
* Removed ``sphinx.util.rfc1123_to_epoch``
|
||||
(use ``sphinx.http_date.rfc1123_to_epoch``).
|
||||
* Removed ``sphinx.util.save_traceback``
|
||||
(use ``sphinx.exceptions.save_traceback``).
|
||||
* Removed ``sphinx.util.format_exception_cut_frames``
|
||||
(use ``sphinx.exceptions.format_exception_cut_frames``).
|
||||
* Removed ``sphinx.util.xmlname_checker``
|
||||
(use ``sphinx.builders.epub3._XML_NAME_PATTERN``).
|
||||
|
||||
Patch by Adam Turner.
|
||||
|
||||
Deprecated
|
||||
----------
|
||||
|
||||
|
@ -13,12 +13,8 @@ from urllib.parse import parse_qsl, quote_plus, urlencode, urlsplit, urlunsplit
|
||||
|
||||
from sphinx.errors import ExtensionError, FiletypeNotFoundError
|
||||
from sphinx.locale import __
|
||||
from sphinx.util import display as _display
|
||||
from sphinx.util import exceptions as _exceptions
|
||||
from sphinx.util import http_date as _http_date
|
||||
from sphinx.util import index_entries as _index_entries
|
||||
from sphinx.util import logging
|
||||
from sphinx.util import osutil as _osutil
|
||||
from sphinx.util.console import strip_colors # NoQA: F401
|
||||
from sphinx.util.matching import patfilter # NoQA: F401
|
||||
from sphinx.util.nodes import ( # NoQA: F401
|
||||
@ -258,32 +254,16 @@ def isurl(url: str) -> bool:
|
||||
return bool(url) and '://' in url
|
||||
|
||||
|
||||
def _xml_name_checker() -> re.Pattern[str]:
|
||||
# to prevent import cycles
|
||||
from sphinx.builders.epub3 import _XML_NAME_PATTERN
|
||||
|
||||
return _XML_NAME_PATTERN
|
||||
|
||||
|
||||
# deprecated name -> (object to return, canonical path or empty string)
|
||||
_DEPRECATED_OBJECTS: dict[str, tuple[Any, str] | tuple[Any, str, tuple[int, int]]] = {
|
||||
'path_stabilize': (_osutil.path_stabilize, 'sphinx.util.osutil.path_stabilize'),
|
||||
'display_chunk': (_display.display_chunk, 'sphinx.util.display.display_chunk'),
|
||||
'status_iterator': (_display.status_iterator, 'sphinx.util.display.status_iterator'),
|
||||
'SkipProgressMessage': (_display.SkipProgressMessage,
|
||||
'sphinx.util.display.SkipProgressMessage'),
|
||||
'progress_message': (_display.progress_message, 'sphinx.util.display.progress_message'),
|
||||
'epoch_to_rfc1123': (_http_date.epoch_to_rfc1123, 'sphinx.http_date.epoch_to_rfc1123'),
|
||||
'rfc1123_to_epoch': (_http_date.rfc1123_to_epoch, 'sphinx.http_date.rfc1123_to_epoch'),
|
||||
'save_traceback': (_exceptions.save_traceback, 'sphinx.exceptions.save_traceback'),
|
||||
'format_exception_cut_frames': (_exceptions.format_exception_cut_frames,
|
||||
'sphinx.exceptions.format_exception_cut_frames'),
|
||||
'xmlname_checker': (_xml_name_checker, 'sphinx.builders.epub3._XML_NAME_PATTERN'),
|
||||
_DEPRECATED_OBJECTS: dict[str, tuple[Any, str, tuple[int, int]]] = {
|
||||
'split_index_msg': (_index_entries.split_index_msg,
|
||||
'sphinx.util.index_entries.split_index_msg'),
|
||||
'split_into': (_index_entries.split_index_msg, 'sphinx.util.index_entries.split_into'),
|
||||
'md5': (_md5, ''),
|
||||
'sha1': (_sha1, ''),
|
||||
'sphinx.util.index_entries.split_index_msg',
|
||||
(9, 0)),
|
||||
'split_into': (_index_entries.split_index_msg,
|
||||
'sphinx.util.index_entries.split_into',
|
||||
(9, 0)),
|
||||
'md5': (_md5, '', (9, 0)),
|
||||
'sha1': (_sha1, '', (9, 0)),
|
||||
}
|
||||
|
||||
|
||||
@ -294,8 +274,6 @@ def __getattr__(name: str) -> Any:
|
||||
|
||||
from sphinx.deprecation import _deprecation_warning
|
||||
|
||||
info = _DEPRECATED_OBJECTS[name]
|
||||
deprecated_object, canonical_name = info[:2]
|
||||
remove = info[2] if len(info) == 3 else (8, 0)
|
||||
deprecated_object, canonical_name, remove = _DEPRECATED_OBJECTS[name]
|
||||
_deprecation_warning(__name__, name, canonical_name, remove=remove)
|
||||
return deprecated_object
|
||||
|
Loading…
Reference in New Issue
Block a user