diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 16:20:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 16:20:58 +0000 |
commit | 5bb0bb4be543fd5eca41673696a62ed80d493591 (patch) | |
tree | ad2c464f140e86c7f178a6276d7ea4a93e3e6c92 /sphinx/ext/autosummary/generate.py | |
parent | Adding upstream version 7.2.6. (diff) | |
download | sphinx-5bb0bb4be543fd5eca41673696a62ed80d493591.tar.xz sphinx-5bb0bb4be543fd5eca41673696a62ed80d493591.zip |
Adding upstream version 7.3.7.upstream/7.3.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | sphinx/ext/autosummary/generate.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index 06814f9..83497f9 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -71,10 +71,9 @@ class DummyApplication: self._warncount = 0 self.warningiserror = False - self.config.add('autosummary_context', {}, True, None) - self.config.add('autosummary_filename_map', {}, True, None) + self.config.add('autosummary_context', {}, 'env', ()) + self.config.add('autosummary_filename_map', {}, 'env', ()) self.config.add('autosummary_ignore_module_all', True, 'env', bool) - self.config.init_values() def emit_firstresult(self, *args: Any) -> None: pass @@ -134,7 +133,8 @@ class AutosummaryRenderer: if app.translator: self.env.add_extension("jinja2.ext.i18n") - self.env.install_gettext_translations(app.translator) + # ``install_gettext_translations`` is injected by the ``jinja2.ext.i18n`` extension + self.env.install_gettext_translations(app.translator) # type: ignore[attr-defined] def render(self, template_name: str, context: dict) -> str: """Render a template file.""" @@ -249,8 +249,8 @@ class ModuleScanner: def members_of(obj: Any, conf: Config) -> Sequence[str]: """Get the members of ``obj``, possibly ignoring the ``__all__`` module attribute - Follows the ``conf.autosummary_ignore_module_all`` setting.""" - + Follows the ``conf.autosummary_ignore_module_all`` setting. + """ if conf.autosummary_ignore_module_all: return dir(obj) else: @@ -331,7 +331,7 @@ def generate_autosummary_content(name: str, obj: Any, parent: Any, if doc.objtype in ('method', 'attribute', 'property'): ns['class'] = qualname.rsplit(".", 1)[0] - if doc.objtype in ('class',): + if doc.objtype == 'class': shortname = qualname else: shortname = qualname.rsplit(".", 1)[-1] @@ -509,9 +509,9 @@ def generate_autosummary_docs(sources: list[str], qualname = name.replace(modname + ".", "") except ImportError as exc2: if exc2.__cause__: - exceptions: list[BaseException] = exc.exceptions + [exc2.__cause__] + exceptions: list[BaseException] = [*exc.exceptions, exc2.__cause__] else: - exceptions = exc.exceptions + [exc2] + exceptions = [*exc.exceptions, exc2] errors = list({f"* {type(e).__name__}: {e}" for e in exceptions}) logger.warning(__('[autosummary] failed to import %s.\nPossible hints:\n%s'), |