Sphinx 7.4.6__py3-none-any.whl → 8.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of Sphinx might be problematic. Click here for more details.
- sphinx/__init__.py +2 -2
- sphinx/_cli/__init__.py +4 -4
- sphinx/application.py +2 -2
- sphinx/builders/__init__.py +2 -3
- sphinx/builders/_epub_base.py +33 -12
- sphinx/builders/changes.py +13 -5
- sphinx/builders/epub3.py +6 -2
- sphinx/builders/html/__init__.py +90 -59
- sphinx/builders/latex/__init__.py +38 -12
- sphinx/builders/latex/transforms.py +1 -1
- sphinx/builders/linkcheck.py +8 -49
- sphinx/builders/texinfo.py +12 -6
- sphinx/builders/text.py +7 -3
- sphinx/builders/xml.py +7 -3
- sphinx/cmd/quickstart.py +10 -20
- sphinx/config.py +13 -13
- sphinx/deprecation.py +8 -8
- sphinx/directives/__init__.py +14 -9
- sphinx/directives/other.py +2 -3
- sphinx/directives/patches.py +2 -2
- sphinx/domains/__init__.py +4 -2
- sphinx/domains/c/__init__.py +2 -2
- sphinx/domains/c/_ast.py +3 -2
- sphinx/domains/c/_parser.py +4 -3
- sphinx/domains/cpp/__init__.py +2 -2
- sphinx/domains/cpp/_ast.py +1 -2
- sphinx/domains/cpp/_parser.py +2 -2
- sphinx/domains/cpp/_symbol.py +2 -2
- sphinx/domains/javascript.py +1 -1
- sphinx/domains/math.py +1 -1
- sphinx/domains/python/__init__.py +1 -1
- sphinx/domains/python/_annotations.py +23 -1
- sphinx/domains/python/_object.py +0 -1
- sphinx/domains/std/__init__.py +7 -8
- sphinx/environment/__init__.py +15 -32
- sphinx/environment/adapters/indexentries.py +4 -6
- sphinx/environment/adapters/toctree.py +4 -4
- sphinx/environment/collectors/title.py +1 -1
- sphinx/environment/collectors/toctree.py +1 -1
- sphinx/events.py +3 -1
- sphinx/ext/autodoc/__init__.py +25 -67
- sphinx/ext/autodoc/directive.py +7 -5
- sphinx/ext/autodoc/importer.py +2 -1
- sphinx/ext/autodoc/preserve_defaults.py +2 -2
- sphinx/ext/autosummary/__init__.py +15 -7
- sphinx/ext/autosummary/generate.py +5 -4
- sphinx/ext/doctest.py +5 -5
- sphinx/ext/graphviz.py +1 -1
- sphinx/ext/imgmath.py +1 -1
- sphinx/ext/inheritance_diagram.py +1 -1
- sphinx/ext/intersphinx/__init__.py +25 -5
- sphinx/ext/intersphinx/_cli.py +7 -6
- sphinx/ext/intersphinx/_load.py +240 -115
- sphinx/ext/intersphinx/_resolve.py +12 -11
- sphinx/ext/intersphinx/_shared.py +102 -9
- sphinx/ext/mathjax.py +1 -1
- sphinx/ext/napoleon/docstring.py +2 -2
- sphinx/ext/todo.py +2 -2
- sphinx/ext/viewcode.py +2 -1
- sphinx/highlighting.py +3 -3
- sphinx/io.py +2 -2
- sphinx/jinja2glue.py +13 -6
- sphinx/locale/__init__.py +4 -3
- sphinx/locale/ar/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ar/LC_MESSAGES/sphinx.po +2383 -2186
- sphinx/locale/bg/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/bg/LC_MESSAGES/sphinx.po +2249 -2052
- sphinx/locale/bn/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/bn/LC_MESSAGES/sphinx.po +2412 -2215
- sphinx/locale/ca/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ca/LC_MESSAGES/sphinx.po +3029 -2832
- sphinx/locale/cak/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cak/LC_MESSAGES/sphinx.po +2308 -2111
- sphinx/locale/cs/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cs/LC_MESSAGES/sphinx.po +2469 -2272
- sphinx/locale/cy/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cy/LC_MESSAGES/sphinx.po +2393 -2196
- sphinx/locale/da/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/da/LC_MESSAGES/sphinx.po +2532 -2335
- sphinx/locale/de/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/de/LC_MESSAGES/sphinx.po +2492 -2295
- sphinx/locale/de_DE/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/de_DE/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/el/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/el/LC_MESSAGES/sphinx.po +2879 -2682
- sphinx/locale/en_DE/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_DE/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/en_FR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_FR/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/en_GB/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_GB/LC_MESSAGES/sphinx.po +2989 -2792
- sphinx/locale/en_HK/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_HK/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/eo/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/eo/LC_MESSAGES/sphinx.po +2297 -2100
- sphinx/locale/es/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/es/LC_MESSAGES/sphinx.po +3017 -2820
- sphinx/locale/es_CO/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/es_CO/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/et/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/et/LC_MESSAGES/sphinx.po +2748 -2551
- sphinx/locale/eu/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/eu/LC_MESSAGES/sphinx.po +2459 -2262
- sphinx/locale/fa/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fa/LC_MESSAGES/sphinx.po +2957 -2760
- sphinx/locale/fi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fi/LC_MESSAGES/sphinx.po +2321 -2124
- sphinx/locale/fr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fr/LC_MESSAGES/sphinx.po +2977 -2780
- sphinx/locale/fr_FR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fr_FR/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/gl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/gl/LC_MESSAGES/sphinx.po +2992 -2795
- sphinx/locale/he/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/he/LC_MESSAGES/sphinx.po +2375 -2178
- sphinx/locale/hi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hi/LC_MESSAGES/sphinx.po +2937 -2740
- sphinx/locale/hi_IN/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hi_IN/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/hr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hr/LC_MESSAGES/sphinx.po +2532 -2335
- sphinx/locale/hu/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hu/LC_MESSAGES/sphinx.po +2505 -2308
- sphinx/locale/id/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/id/LC_MESSAGES/sphinx.po +2925 -2728
- sphinx/locale/is/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/is/LC_MESSAGES/sphinx.po +2307 -2110
- sphinx/locale/it/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/it/LC_MESSAGES/sphinx.po +2514 -2317
- sphinx/locale/ja/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ja/LC_MESSAGES/sphinx.po +2970 -2773
- sphinx/locale/ka/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ka/LC_MESSAGES/sphinx.po +2868 -2671
- sphinx/locale/ko/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ko/LC_MESSAGES/sphinx.po +3016 -2819
- sphinx/locale/lt/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/lt/LC_MESSAGES/sphinx.po +2476 -2279
- sphinx/locale/lv/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/lv/LC_MESSAGES/sphinx.po +2477 -2280
- sphinx/locale/mk/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/mk/LC_MESSAGES/sphinx.po +2292 -2095
- sphinx/locale/nb_NO/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/nb_NO/LC_MESSAGES/sphinx.po +2479 -2282
- sphinx/locale/ne/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ne/LC_MESSAGES/sphinx.po +2481 -2284
- sphinx/locale/nl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/nl/LC_MESSAGES/sphinx.po +2557 -2360
- sphinx/locale/pl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pl/LC_MESSAGES/sphinx.po +2696 -2499
- sphinx/locale/pt/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +2979 -2782
- sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po +2469 -2272
- sphinx/locale/ro/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ro/LC_MESSAGES/sphinx.po +2473 -2276
- sphinx/locale/ru/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ru/LC_MESSAGES/sphinx.po +2746 -2549
- sphinx/locale/si/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/si/LC_MESSAGES/sphinx.po +2331 -2134
- sphinx/locale/sk/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sk/LC_MESSAGES/sphinx.po +2966 -2769
- sphinx/locale/sl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sl/LC_MESSAGES/sphinx.po +2404 -2207
- sphinx/locale/sphinx.pot +2262 -2065
- sphinx/locale/sq/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sq/LC_MESSAGES/sphinx.po +2972 -2775
- sphinx/locale/sr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sr/LC_MESSAGES/sphinx.po +2440 -2243
- sphinx/locale/sv/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sv/LC_MESSAGES/sphinx.po +2483 -2286
- sphinx/locale/ta/LC_MESSAGES/sphinx.js +54 -54
- sphinx/locale/ta/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ta/LC_MESSAGES/sphinx.po +1578 -1843
- sphinx/locale/te/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/te/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/tr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/tr/LC_MESSAGES/sphinx.po +2892 -2695
- sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +2400 -2203
- sphinx/locale/ur/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ur/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/vi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/vi/LC_MESSAGES/sphinx.po +2422 -2225
- sphinx/locale/yue/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/yue/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po +496 -704
- sphinx/locale/zh_HK/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_HK/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +3028 -2831
- sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.po +2250 -2053
- sphinx/project.py +25 -20
- sphinx/pycode/ast.py +2 -2
- sphinx/pycode/parser.py +2 -2
- sphinx/pygments_styles.py +3 -3
- sphinx/registry.py +3 -8
- sphinx/search/__init__.py +1 -1
- sphinx/testing/path.py +2 -1
- sphinx/testing/util.py +1 -1
- sphinx/texinputs/Makefile.jinja +2 -1
- sphinx/texinputs_win/Makefile.jinja +2 -1
- sphinx/theming.py +3 -12
- sphinx/transforms/__init__.py +5 -5
- sphinx/transforms/references.py +1 -1
- sphinx/util/__init__.py +11 -35
- sphinx/util/_pathlib.py +31 -19
- sphinx/util/_timestamps.py +12 -0
- sphinx/util/cfamily.py +5 -5
- sphinx/util/console.py +4 -3
- sphinx/util/display.py +3 -3
- sphinx/util/docfields.py +1 -1
- sphinx/util/docutils.py +44 -10
- sphinx/util/fileutil.py +41 -9
- sphinx/util/i18n.py +9 -4
- sphinx/util/images.py +3 -2
- sphinx/util/inspect.py +29 -44
- sphinx/util/inventory.py +2 -2
- sphinx/util/matching.py +2 -2
- sphinx/util/math.py +1 -1
- sphinx/util/nodes.py +8 -8
- sphinx/util/osutil.py +52 -26
- sphinx/util/parallel.py +2 -2
- sphinx/util/requests.py +1 -1
- sphinx/util/template.py +3 -3
- sphinx/util/typing.py +67 -70
- sphinx/writers/html.py +1 -1
- sphinx/writers/html5.py +1 -1
- sphinx/writers/latex.py +4 -4
- sphinx/writers/manpage.py +2 -2
- sphinx/writers/texinfo.py +5 -5
- sphinx/writers/text.py +4 -4
- sphinx/writers/xml.py +2 -2
- {sphinx-7.4.6.dist-info → sphinx-8.0.0.dist-info}/METADATA +11 -10
- {sphinx-7.4.6.dist-info → sphinx-8.0.0.dist-info}/RECORD +240 -241
- sphinx/templates/quickstart/Makefile.jinja +0 -98
- sphinx/templates/quickstart/make.bat.jinja +0 -110
- {sphinx-7.4.6.dist-info → sphinx-8.0.0.dist-info}/LICENSE.rst +0 -0
- {sphinx-7.4.6.dist-info → sphinx-8.0.0.dist-info}/WHEEL +0 -0
- {sphinx-7.4.6.dist-info → sphinx-8.0.0.dist-info}/entry_points.txt +0 -0
sphinx/ext/autodoc/directive.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
4
5
|
|
|
5
6
|
from docutils import nodes
|
|
6
7
|
from docutils.statemachine import StringList
|
|
@@ -31,14 +32,14 @@ AUTODOC_EXTENDABLE_OPTIONS = ['members', 'private-members', 'special-members',
|
|
|
31
32
|
'exclude-members']
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
class DummyOptionSpec(dict):
|
|
35
|
+
class DummyOptionSpec(dict[str, Callable[[str], str]]):
|
|
35
36
|
"""An option_spec allows any options."""
|
|
36
37
|
|
|
37
38
|
def __bool__(self) -> bool:
|
|
38
39
|
"""Behaves like some options are defined."""
|
|
39
40
|
return True
|
|
40
41
|
|
|
41
|
-
def __getitem__(self,
|
|
42
|
+
def __getitem__(self, _key: str) -> Callable[[str], str]:
|
|
42
43
|
return lambda x: x
|
|
43
44
|
|
|
44
45
|
|
|
@@ -56,8 +57,9 @@ class DocumenterBridge:
|
|
|
56
57
|
self.state = state
|
|
57
58
|
|
|
58
59
|
|
|
59
|
-
def process_documenter_options(
|
|
60
|
-
|
|
60
|
+
def process_documenter_options(
|
|
61
|
+
documenter: type[Documenter], config: Config, options: dict[str, str],
|
|
62
|
+
) -> Options:
|
|
61
63
|
"""Recognize options of Documenter from user input."""
|
|
62
64
|
default_options = config.autodoc_default_options
|
|
63
65
|
for name in AUTODOC_DEFAULT_OPTIONS:
|
sphinx/ext/autodoc/importer.py
CHANGED
|
@@ -11,8 +11,9 @@ import typing
|
|
|
11
11
|
from enum import Enum
|
|
12
12
|
from typing import TYPE_CHECKING, NamedTuple
|
|
13
13
|
|
|
14
|
+
from sphinx.errors import PycodeError
|
|
14
15
|
from sphinx.ext.autodoc.mock import ismock, undecorate
|
|
15
|
-
from sphinx.pycode import ModuleAnalyzer
|
|
16
|
+
from sphinx.pycode import ModuleAnalyzer
|
|
16
17
|
from sphinx.util import logging
|
|
17
18
|
from sphinx.util.inspect import (
|
|
18
19
|
getannotations,
|
|
@@ -102,9 +102,9 @@ def _is_lambda(x: Any, /) -> bool:
|
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
def _get_arguments_inner(x: Any, /) -> ast.arguments | None:
|
|
105
|
-
if isinstance(x,
|
|
105
|
+
if isinstance(x, ast.AsyncFunctionDef | ast.FunctionDef | ast.Lambda):
|
|
106
106
|
return x.args
|
|
107
|
-
if isinstance(x,
|
|
107
|
+
if isinstance(x, ast.Assign | ast.AnnAssign):
|
|
108
108
|
return _get_arguments_inner(x.value)
|
|
109
109
|
return None
|
|
110
110
|
|
|
@@ -69,13 +69,14 @@ import sphinx
|
|
|
69
69
|
from sphinx import addnodes
|
|
70
70
|
from sphinx.config import Config
|
|
71
71
|
from sphinx.environment import BuildEnvironment
|
|
72
|
-
from sphinx.
|
|
73
|
-
from sphinx.ext.autodoc
|
|
72
|
+
from sphinx.errors import PycodeError
|
|
73
|
+
from sphinx.ext.autodoc import INSTANCEATTR, Documenter, Options
|
|
74
|
+
from sphinx.ext.autodoc.directive import DocumenterBridge
|
|
74
75
|
from sphinx.ext.autodoc.importer import import_module
|
|
75
76
|
from sphinx.ext.autodoc.mock import mock
|
|
76
77
|
from sphinx.locale import __
|
|
77
78
|
from sphinx.project import Project
|
|
78
|
-
from sphinx.pycode import ModuleAnalyzer
|
|
79
|
+
from sphinx.pycode import ModuleAnalyzer
|
|
79
80
|
from sphinx.registry import SphinxComponentRegistry
|
|
80
81
|
from sphinx.util import logging, rst
|
|
81
82
|
from sphinx.util.docutils import (
|
|
@@ -97,7 +98,7 @@ if TYPE_CHECKING:
|
|
|
97
98
|
from sphinx.application import Sphinx
|
|
98
99
|
from sphinx.extension import Extension
|
|
99
100
|
from sphinx.util.typing import ExtensionMetadata, OptionSpec
|
|
100
|
-
from sphinx.writers.
|
|
101
|
+
from sphinx.writers.html5 import HTML5Translator
|
|
101
102
|
|
|
102
103
|
logger = logging.getLogger(__name__)
|
|
103
104
|
|
|
@@ -248,7 +249,7 @@ class Autosummary(SphinxDirective):
|
|
|
248
249
|
docname = posixpath.join(tree_prefix, real_name)
|
|
249
250
|
docname = posixpath.normpath(posixpath.join(dirname, docname))
|
|
250
251
|
if docname not in self.env.found_docs:
|
|
251
|
-
if excluded(self.env.doc2path(docname, False)):
|
|
252
|
+
if excluded(str(self.env.doc2path(docname, False))):
|
|
252
253
|
msg = __('autosummary references excluded document %r. Ignored.')
|
|
253
254
|
else:
|
|
254
255
|
msg = __('autosummary: stub file not found %r. '
|
|
@@ -765,7 +766,14 @@ class AutoLink(SphinxRole):
|
|
|
765
766
|
try:
|
|
766
767
|
# try to import object by name
|
|
767
768
|
prefixes = get_import_prefixes_from_env(self.env)
|
|
768
|
-
|
|
769
|
+
name = pending_xref['reftarget']
|
|
770
|
+
prefixes = [
|
|
771
|
+
prefix
|
|
772
|
+
for prefix in prefixes
|
|
773
|
+
if prefix is None
|
|
774
|
+
or not (name.startswith(f'{prefix}.') or name == prefix)
|
|
775
|
+
]
|
|
776
|
+
import_by_name(name, prefixes)
|
|
769
777
|
except ImportExceptionGroup:
|
|
770
778
|
literal = cast(nodes.literal, pending_xref[0])
|
|
771
779
|
objects[0] = nodes.emphasis(self.rawtext, literal.astext(),
|
|
@@ -794,7 +802,7 @@ def process_generate_options(app: Sphinx) -> None:
|
|
|
794
802
|
|
|
795
803
|
if genfiles is True:
|
|
796
804
|
env = app.builder.env
|
|
797
|
-
genfiles = [env.doc2path(x, base=False) for x in env.found_docs
|
|
805
|
+
genfiles = [str(env.doc2path(x, base=False)) for x in env.found_docs
|
|
798
806
|
if os.path.isfile(env.doc2path(x))]
|
|
799
807
|
elif genfiles is False:
|
|
800
808
|
pass
|
|
@@ -34,6 +34,7 @@ import sphinx.locale
|
|
|
34
34
|
from sphinx import __display_version__, package_dir
|
|
35
35
|
from sphinx.builders import Builder
|
|
36
36
|
from sphinx.config import Config
|
|
37
|
+
from sphinx.errors import PycodeError
|
|
37
38
|
from sphinx.ext.autodoc.importer import import_module
|
|
38
39
|
from sphinx.ext.autosummary import (
|
|
39
40
|
ImportExceptionGroup,
|
|
@@ -42,7 +43,7 @@ from sphinx.ext.autosummary import (
|
|
|
42
43
|
import_ivar_by_name,
|
|
43
44
|
)
|
|
44
45
|
from sphinx.locale import __
|
|
45
|
-
from sphinx.pycode import ModuleAnalyzer
|
|
46
|
+
from sphinx.pycode import ModuleAnalyzer
|
|
46
47
|
from sphinx.registry import SphinxComponentRegistry
|
|
47
48
|
from sphinx.util import logging, rst
|
|
48
49
|
from sphinx.util.inspect import getall, safe_getattr
|
|
@@ -145,7 +146,7 @@ class AutosummaryRenderer:
|
|
|
145
146
|
# ``install_gettext_translations`` is injected by the ``jinja2.ext.i18n`` extension
|
|
146
147
|
self.env.install_gettext_translations(app.translator) # type: ignore[attr-defined]
|
|
147
148
|
|
|
148
|
-
def render(self, template_name: str, context: dict) -> str:
|
|
149
|
+
def render(self, template_name: str, context: dict[str, Any]) -> str:
|
|
149
150
|
"""Render a template file."""
|
|
150
151
|
try:
|
|
151
152
|
template = self.env.get_template(template_name)
|
|
@@ -282,7 +283,7 @@ def generate_autosummary_content(
|
|
|
282
283
|
imported_members: bool,
|
|
283
284
|
app: Any,
|
|
284
285
|
recursive: bool,
|
|
285
|
-
context: dict,
|
|
286
|
+
context: dict[str, Any],
|
|
286
287
|
modname: str | None = None,
|
|
287
288
|
qualname: str | None = None,
|
|
288
289
|
) -> str:
|
|
@@ -392,7 +393,7 @@ def _skip_member(app: Sphinx, obj: Any, name: str, objtype: str) -> bool:
|
|
|
392
393
|
|
|
393
394
|
|
|
394
395
|
def _get_class_members(obj: Any) -> dict[str, Any]:
|
|
395
|
-
members = sphinx.ext.autodoc.get_class_members(obj, None, safe_getattr)
|
|
396
|
+
members = sphinx.ext.autodoc.importer.get_class_members(obj, None, safe_getattr)
|
|
396
397
|
return {name: member.object for name, member in members.items()}
|
|
397
398
|
|
|
398
399
|
|
sphinx/ext/doctest.py
CHANGED
|
@@ -11,7 +11,7 @@ import sys
|
|
|
11
11
|
import time
|
|
12
12
|
from io import StringIO
|
|
13
13
|
from os import path
|
|
14
|
-
from typing import TYPE_CHECKING, Any,
|
|
14
|
+
from typing import TYPE_CHECKING, Any, ClassVar
|
|
15
15
|
|
|
16
16
|
from docutils import nodes
|
|
17
17
|
from docutils.parsers.rst import directives
|
|
@@ -27,7 +27,7 @@ from sphinx.util.docutils import SphinxDirective
|
|
|
27
27
|
from sphinx.util.osutil import relpath
|
|
28
28
|
|
|
29
29
|
if TYPE_CHECKING:
|
|
30
|
-
from collections.abc import Iterable, Sequence
|
|
30
|
+
from collections.abc import Callable, Iterable, Sequence
|
|
31
31
|
|
|
32
32
|
from docutils.nodes import Element, Node, TextElement
|
|
33
33
|
|
|
@@ -373,7 +373,7 @@ Doctest summary
|
|
|
373
373
|
try:
|
|
374
374
|
filename = relpath(node.source, self.env.srcdir).rsplit(':docstring of ', maxsplit=1)[0] # type: ignore[arg-type] # noqa: E501
|
|
375
375
|
except Exception:
|
|
376
|
-
filename = self.env.doc2path(docname, False)
|
|
376
|
+
filename = str(self.env.doc2path(docname, False))
|
|
377
377
|
return filename
|
|
378
378
|
|
|
379
379
|
@staticmethod
|
|
@@ -420,12 +420,12 @@ Doctest summary
|
|
|
420
420
|
|
|
421
421
|
if self.config.doctest_test_doctest_blocks:
|
|
422
422
|
def condition(node: Node) -> bool:
|
|
423
|
-
return (isinstance(node,
|
|
423
|
+
return (isinstance(node, nodes.literal_block | nodes.comment) and
|
|
424
424
|
'testnodetype' in node) or \
|
|
425
425
|
isinstance(node, nodes.doctest_block)
|
|
426
426
|
else:
|
|
427
427
|
def condition(node: Node) -> bool:
|
|
428
|
-
return isinstance(node,
|
|
428
|
+
return isinstance(node, nodes.literal_block | nodes.comment) \
|
|
429
429
|
and 'testnodetype' in node
|
|
430
430
|
for node in doctree.findall(condition):
|
|
431
431
|
if self.skipped(node): # type: ignore[arg-type]
|
sphinx/ext/graphviz.py
CHANGED
|
@@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
|
|
32
32
|
from sphinx.application import Sphinx
|
|
33
33
|
from sphinx.config import Config
|
|
34
34
|
from sphinx.util.typing import ExtensionMetadata, OptionSpec
|
|
35
|
-
from sphinx.writers.
|
|
35
|
+
from sphinx.writers.html5 import HTML5Translator
|
|
36
36
|
from sphinx.writers.latex import LaTeXTranslator
|
|
37
37
|
from sphinx.writers.manpage import ManualPageTranslator
|
|
38
38
|
from sphinx.writers.texinfo import TexinfoTranslator
|
sphinx/ext/imgmath.py
CHANGED
|
@@ -36,7 +36,7 @@ if TYPE_CHECKING:
|
|
|
36
36
|
from sphinx.builders import Builder
|
|
37
37
|
from sphinx.config import Config
|
|
38
38
|
from sphinx.util.typing import ExtensionMetadata
|
|
39
|
-
from sphinx.writers.
|
|
39
|
+
from sphinx.writers.html5 import HTML5Translator
|
|
40
40
|
|
|
41
41
|
logger = logging.getLogger(__name__)
|
|
42
42
|
|
|
@@ -59,7 +59,7 @@ if TYPE_CHECKING:
|
|
|
59
59
|
from sphinx.application import Sphinx
|
|
60
60
|
from sphinx.environment import BuildEnvironment
|
|
61
61
|
from sphinx.util.typing import ExtensionMetadata, OptionSpec
|
|
62
|
-
from sphinx.writers.
|
|
62
|
+
from sphinx.writers.html5 import HTML5Translator
|
|
63
63
|
from sphinx.writers.latex import LaTeXTranslator
|
|
64
64
|
from sphinx.writers.texinfo import TexinfoTranslator
|
|
65
65
|
|
|
@@ -21,9 +21,8 @@ from __future__ import annotations
|
|
|
21
21
|
__all__ = (
|
|
22
22
|
'InventoryAdapter',
|
|
23
23
|
'fetch_inventory',
|
|
24
|
-
'fetch_inventory_group',
|
|
25
24
|
'load_mappings',
|
|
26
|
-
'
|
|
25
|
+
'validate_intersphinx_mapping',
|
|
27
26
|
'IntersphinxRoleResolver',
|
|
28
27
|
'inventory_exists',
|
|
29
28
|
'install_dispatcher',
|
|
@@ -42,9 +41,8 @@ import sphinx
|
|
|
42
41
|
from sphinx.ext.intersphinx._cli import inspect_main
|
|
43
42
|
from sphinx.ext.intersphinx._load import (
|
|
44
43
|
fetch_inventory,
|
|
45
|
-
fetch_inventory_group,
|
|
46
44
|
load_mappings,
|
|
47
|
-
|
|
45
|
+
validate_intersphinx_mapping,
|
|
48
46
|
)
|
|
49
47
|
from sphinx.ext.intersphinx._resolve import (
|
|
50
48
|
IntersphinxDispatcher,
|
|
@@ -69,7 +67,7 @@ def setup(app: Sphinx) -> ExtensionMetadata:
|
|
|
69
67
|
app.add_config_value('intersphinx_cache_limit', 5, '')
|
|
70
68
|
app.add_config_value('intersphinx_timeout', None, '')
|
|
71
69
|
app.add_config_value('intersphinx_disabled_reftypes', ['std:doc'], 'env')
|
|
72
|
-
app.connect('config-inited',
|
|
70
|
+
app.connect('config-inited', validate_intersphinx_mapping, priority=800)
|
|
73
71
|
app.connect('builder-inited', load_mappings)
|
|
74
72
|
app.connect('source-read', install_dispatcher)
|
|
75
73
|
app.connect('missing-reference', missing_reference)
|
|
@@ -79,3 +77,25 @@ def setup(app: Sphinx) -> ExtensionMetadata:
|
|
|
79
77
|
'env_version': 1,
|
|
80
78
|
'parallel_read_safe': True,
|
|
81
79
|
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
# deprecated name -> (object to return, canonical path or empty string, removal version)
|
|
83
|
+
_DEPRECATED_OBJECTS: dict[str, tuple[object, str, tuple[int, int]]] = {
|
|
84
|
+
'normalize_intersphinx_mapping': (
|
|
85
|
+
validate_intersphinx_mapping,
|
|
86
|
+
'sphinx.ext.intersphinx.validate_intersphinx_mapping',
|
|
87
|
+
(10, 0),
|
|
88
|
+
),
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def __getattr__(name: str) -> object:
|
|
93
|
+
if name not in _DEPRECATED_OBJECTS:
|
|
94
|
+
msg = f'module {__name__!r} has no attribute {name!r}'
|
|
95
|
+
raise AttributeError(msg)
|
|
96
|
+
|
|
97
|
+
from sphinx.deprecation import _deprecation_warning
|
|
98
|
+
|
|
99
|
+
deprecated_object, canonical_name, remove = _DEPRECATED_OBJECTS[name]
|
|
100
|
+
_deprecation_warning(__name__, name, canonical_name, remove=remove)
|
|
101
|
+
return deprecated_object
|
sphinx/ext/intersphinx/_cli.py
CHANGED
|
@@ -4,7 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import sys
|
|
6
6
|
|
|
7
|
-
from sphinx.ext.intersphinx._load import
|
|
7
|
+
from sphinx.ext.intersphinx._load import _fetch_inventory
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def inspect_main(argv: list[str], /) -> int:
|
|
@@ -21,13 +21,14 @@ def inspect_main(argv: list[str], /) -> int:
|
|
|
21
21
|
tls_cacerts: str | dict[str, str] | None = None
|
|
22
22
|
user_agent: str = ''
|
|
23
23
|
|
|
24
|
-
class MockApp:
|
|
25
|
-
srcdir = ''
|
|
26
|
-
config = MockConfig()
|
|
27
|
-
|
|
28
24
|
try:
|
|
29
25
|
filename = argv[0]
|
|
30
|
-
inv_data =
|
|
26
|
+
inv_data = _fetch_inventory(
|
|
27
|
+
target_uri='',
|
|
28
|
+
inv_location=filename,
|
|
29
|
+
config=MockConfig(), # type: ignore[arg-type]
|
|
30
|
+
srcdir='' # type: ignore[arg-type]
|
|
31
|
+
)
|
|
31
32
|
for key in sorted(inv_data or {}):
|
|
32
33
|
print(key)
|
|
33
34
|
inv_entries = sorted(inv_data[key].items())
|