mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #7641 from tk0miya/deprecate_rpartition
Deprecate sphinx.util:rpartition()
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -27,6 +27,7 @@ Deprecated
|
||||
generate_autosummary_docs()``
|
||||
* The ``ignore`` argument of ``sphinx.util.docstring.prepare_docstring()``
|
||||
* ``sphinx.ext.autosummary.generate.AutosummaryRenderer.exists()``
|
||||
* ``sphinx.util.rpartition()``
|
||||
|
||||
Features added
|
||||
--------------
|
||||
|
||||
@@ -78,6 +78,11 @@ The following is a list of deprecated interfaces.
|
||||
- 5.0
|
||||
- N/A
|
||||
|
||||
* - ``sphinx.util.rpartition()``
|
||||
- 3.1
|
||||
- 5.0
|
||||
- ``str.rpartition()``
|
||||
|
||||
* - ``desc_signature['first']``
|
||||
-
|
||||
- 3.0
|
||||
|
||||
@@ -23,7 +23,7 @@ from sphinx import package_dir
|
||||
from sphinx.deprecation import RemovedInSphinx40Warning
|
||||
from sphinx.environment import BuildEnvironment
|
||||
from sphinx.search.jssplitter import splitter_code
|
||||
from sphinx.util import jsdump, rpartition
|
||||
from sphinx.util import jsdump
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
@@ -333,7 +333,7 @@ class IndexBuilder:
|
||||
continue
|
||||
fullname = html.escape(fullname)
|
||||
dispname = html.escape(dispname)
|
||||
prefix, name = rpartition(dispname, '.')
|
||||
prefix, _, name = dispname.rpartition('.')
|
||||
pdict = rv.setdefault(prefix, {})
|
||||
try:
|
||||
typeindex = otypes[domainname, type]
|
||||
|
||||
@@ -28,7 +28,7 @@ from time import mktime, strptime
|
||||
from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Pattern, Set, Tuple
|
||||
from urllib.parse import urlsplit, urlunsplit, quote_plus, parse_qsl, urlencode
|
||||
|
||||
from sphinx.deprecation import RemovedInSphinx40Warning
|
||||
from sphinx.deprecation import RemovedInSphinx40Warning, RemovedInSphinx50Warning
|
||||
from sphinx.errors import (
|
||||
PycodeError, SphinxParallelError, ExtensionError, FiletypeNotFoundError
|
||||
)
|
||||
@@ -497,6 +497,7 @@ class attrdict(dict):
|
||||
|
||||
def rpartition(s: str, t: str) -> Tuple[str, str]:
|
||||
"""Similar to str.rpartition from 2.5, but doesn't return the separator."""
|
||||
warnings.warn('rpartition() is now deprecated.', RemovedInSphinx50Warning, stacklevel=2)
|
||||
i = s.rfind(t)
|
||||
if i != -1:
|
||||
return s[:i], s[i + len(t):]
|
||||
|
||||
Reference in New Issue
Block a user