mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Deprecate sphinx.ext.autodoc.get_documenters()
This commit is contained in:
parent
77d84713a1
commit
2202bff6b2
1
CHANGES
1
CHANGES
@ -46,6 +46,7 @@ Deprecated
|
||||
* ``sphinx.directives.DescDirective``
|
||||
* ``sphinx.domains.std.StandardDomain.add_object()``
|
||||
* ``sphinx.domains.python.PyDecoratorMixin``
|
||||
* ``sphinx.ext.autodoc.get_documenters()``
|
||||
* ``sphinx.parsers.Parser.app``
|
||||
* ``sphinx.testing.path.Path.text()``
|
||||
* ``sphinx.testing.path.Path.bytes()``
|
||||
|
@ -46,6 +46,11 @@ The following is a list of deprecated interfaces.
|
||||
- 5.0
|
||||
- N/A
|
||||
|
||||
* - ``sphinx.ext.autodoc.get_documenters()``
|
||||
- 3.0
|
||||
- 5.0
|
||||
- ``sphinx.registry.documenters``
|
||||
|
||||
* - ``sphinx.parsers.Parser.app``
|
||||
- 3.0
|
||||
- 5.0
|
||||
|
@ -23,7 +23,7 @@ from docutils.statemachine import StringList
|
||||
import sphinx
|
||||
from sphinx.application import Sphinx
|
||||
from sphinx.config import ENUM
|
||||
from sphinx.deprecation import RemovedInSphinx40Warning
|
||||
from sphinx.deprecation import RemovedInSphinx40Warning, RemovedInSphinx50Warning
|
||||
from sphinx.environment import BuildEnvironment
|
||||
from sphinx.ext.autodoc.importer import import_object, get_module_members, get_object_members
|
||||
from sphinx.ext.autodoc.mock import mock
|
||||
@ -266,7 +266,7 @@ class Documenter:
|
||||
@property
|
||||
def documenters(self) -> Dict[str, "Type[Documenter]"]:
|
||||
"""Returns registered Documenter classes"""
|
||||
return get_documenters(self.env.app)
|
||||
return self.env.app.registry.documenters
|
||||
|
||||
def add_line(self, line: str, source: str, *lineno: int) -> None:
|
||||
"""Append one line of generated reST to the output."""
|
||||
@ -1713,6 +1713,7 @@ class SlotsAttributeDocumenter(AttributeDocumenter):
|
||||
|
||||
def get_documenters(app: Sphinx) -> Dict[str, "Type[Documenter]"]:
|
||||
"""Returns registered Documenter classes"""
|
||||
warnings.warn("get_documenters() is deprecated.", RemovedInSphinx50Warning)
|
||||
return app.registry.documenters
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ from docutils.utils import Reporter, assemble_option_dict
|
||||
from sphinx.config import Config
|
||||
from sphinx.deprecation import RemovedInSphinx40Warning
|
||||
from sphinx.environment import BuildEnvironment
|
||||
from sphinx.ext.autodoc import Documenter, Options, get_documenters
|
||||
from sphinx.ext.autodoc import Documenter, Options
|
||||
from sphinx.util import logging
|
||||
from sphinx.util.docutils import SphinxDirective, switch_source_input
|
||||
from sphinx.util.nodes import nested_parse_with_titles
|
||||
@ -129,7 +129,7 @@ class AutodocDirective(SphinxDirective):
|
||||
|
||||
# look up target Documenter
|
||||
objtype = self.name[4:] # strip prefix (auto-).
|
||||
doccls = get_documenters(self.env.app)[objtype]
|
||||
doccls = self.env.app.registry.documenters[objtype]
|
||||
|
||||
# process the options with the selected documenter's option_spec
|
||||
try:
|
||||
|
@ -75,7 +75,7 @@ from sphinx.application import Sphinx
|
||||
from sphinx.deprecation import RemovedInSphinx40Warning
|
||||
from sphinx.environment import BuildEnvironment
|
||||
from sphinx.environment.adapters.toctree import TocTree
|
||||
from sphinx.ext.autodoc import Documenter, get_documenters
|
||||
from sphinx.ext.autodoc import Documenter
|
||||
from sphinx.ext.autodoc.directive import DocumenterBridge, Options
|
||||
from sphinx.ext.autodoc.importer import import_module
|
||||
from sphinx.ext.autodoc.mock import mock
|
||||
@ -203,7 +203,7 @@ def get_documenter(app: Sphinx, obj: Any, parent: Any) -> "Type[Documenter]":
|
||||
parent_doc = parent_doc_cls(FakeDirective(), "")
|
||||
|
||||
# Get the corrent documenter class for *obj*
|
||||
classes = [cls for cls in get_documenters(app).values()
|
||||
classes = [cls for cls in app.registry.documenters.values()
|
||||
if cls.can_document_member(obj, '', False, parent_doc)]
|
||||
if classes:
|
||||
classes.sort(key=lambda cls: cls.priority)
|
||||
|
Loading…
Reference in New Issue
Block a user