mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
convert to a method
This commit is contained in:
parent
2bdaa6c23e
commit
83905c61b0
@ -216,26 +216,6 @@ def get_documenter(app: Sphinx, obj: Any, parent: Any) -> "Type[Documenter]":
|
|||||||
return DataDocumenter
|
return DataDocumenter
|
||||||
|
|
||||||
|
|
||||||
def dispatch_get_documenter(autosummary, obj, parent, real_name):
|
|
||||||
app = autosummary.env.app
|
|
||||||
documenters = [
|
|
||||||
func(autosummary, real_name)
|
|
||||||
for func in app.custom_get_documenter_funcs
|
|
||||||
]
|
|
||||||
sorted_documenters = sorted(
|
|
||||||
[
|
|
||||||
documenter
|
|
||||||
for documenter in documenters
|
|
||||||
if documenter is not NotImplemented
|
|
||||||
],
|
|
||||||
key=lambda d: d.priority,
|
|
||||||
)
|
|
||||||
if sorted_documenters:
|
|
||||||
return sorted_documenters[-1]
|
|
||||||
else:
|
|
||||||
return get_documenter(app, obj, parent)
|
|
||||||
|
|
||||||
|
|
||||||
# -- .. autosummary:: ----------------------------------------------------------
|
# -- .. autosummary:: ----------------------------------------------------------
|
||||||
|
|
||||||
class Autosummary(SphinxDirective):
|
class Autosummary(SphinxDirective):
|
||||||
@ -305,6 +285,25 @@ class Autosummary(SphinxDirective):
|
|||||||
|
|
||||||
return nodes
|
return nodes
|
||||||
|
|
||||||
|
def dispatch_get_documenter(self, obj, parent, real_name):
|
||||||
|
app = self.env.app
|
||||||
|
documenters = [
|
||||||
|
func(self, real_name)
|
||||||
|
for func in app.custom_get_documenter_funcs
|
||||||
|
]
|
||||||
|
sorted_documenters = sorted(
|
||||||
|
[
|
||||||
|
documenter
|
||||||
|
for documenter in documenters
|
||||||
|
if documenter is not NotImplemented
|
||||||
|
],
|
||||||
|
key=lambda d: d.priority,
|
||||||
|
)
|
||||||
|
if sorted_documenters:
|
||||||
|
return sorted_documenters[-1]
|
||||||
|
else:
|
||||||
|
return get_documenter(app, obj, parent)
|
||||||
|
|
||||||
def get_items(self, names: List[str]) -> List[Tuple[str, str, str, str]]:
|
def get_items(self, names: List[str]) -> List[Tuple[str, str, str, str]]:
|
||||||
"""Try to import the given names, and return a list of
|
"""Try to import the given names, and return a list of
|
||||||
``[(name, signature, summary_string, real_name), ...]``.
|
``[(name, signature, summary_string, real_name), ...]``.
|
||||||
|
Loading…
Reference in New Issue
Block a user