revert the dispatcher changes

This commit is contained in:
Keewis
2020-08-07 14:10:12 +02:00
parent c4dc1b39d3
commit 78e4499435
3 changed files with 1 additions and 29 deletions

View File

@@ -1045,9 +1045,6 @@ class Sphinx:
logger.debug('[app] adding autodoc attrgetter: %r', (typ, getter))
self.registry.add_autodoc_attrgetter(typ, getter)
def add_autosummary_get_documenter(self, func: Callable) -> None:
self.registry.add_autosummary_get_documenter(func)
def add_search_language(self, cls: Any) -> None:
"""Register a new language for the HTML search index.

View File

@@ -298,25 +298,6 @@ class Autosummary(SphinxDirective):
raise exc # re-raise ImportError if instance attribute not found
def dispatch_get_documenter(self, obj, parent, real_name):
app = self.env.app
documenters = [
func(self, obj, parent, real_name)
for func in app.registry.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]]:
"""Try to import the given names, and return a list of
``[(name, signature, summary_string, real_name), ...]``.
@@ -348,7 +329,7 @@ class Autosummary(SphinxDirective):
full_name = modname + '::' + full_name[len(modname) + 1:]
# NB. using full_name here is important, since Documenters
# handle module prefixes slightly differently
doccls = self.dispatch_get_documenter(obj, parent, real_name)
doccls = get_documenter(self.env.app, obj, parent)
documenter = doccls(self.bridge, full_name)
if not documenter.parse_name():
logger.warning(__('failed to parse name %s'), real_name,

View File

@@ -61,9 +61,6 @@ class SphinxComponentRegistry:
#: autodoc documenters; a dict of documenter name -> documenter class
self.documenters = {} # type: Dict[str, Type[Documenter]]
#: autosummary documenter functions
self.custom_get_documenter_funcs = [] # type: List[Callable]
#: css_files; a list of tuple of filename and attributes
self.css_files = [] # type: List[Tuple[str, Dict[str, str]]]
@@ -363,9 +360,6 @@ class SphinxComponentRegistry:
attrgetter: Callable[[Any, str, Any], Any]) -> None:
self.autodoc_attrgettrs[typ] = attrgetter
def add_autosummary_get_documenter(self, func: Callable) -> None:
self.custom_get_documenter_funcs.append(func)
def add_css_files(self, filename: str, **attributes: str) -> None:
self.css_files.append((filename, attributes))