Sphinx 7.2.6__py3-none-any.whl → 7.3.1__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 +8 -9
- sphinx/addnodes.py +31 -28
- sphinx/application.py +9 -15
- sphinx/builders/__init__.py +5 -6
- sphinx/builders/_epub_base.py +17 -9
- sphinx/builders/changes.py +10 -5
- sphinx/builders/dirhtml.py +4 -2
- sphinx/builders/dummy.py +3 -2
- sphinx/builders/epub3.py +5 -3
- sphinx/builders/gettext.py +24 -7
- sphinx/builders/html/__init__.py +88 -96
- sphinx/builders/html/_assets.py +16 -16
- sphinx/builders/html/transforms.py +4 -2
- sphinx/builders/latex/__init__.py +40 -33
- sphinx/builders/latex/nodes.py +6 -2
- sphinx/builders/latex/transforms.py +17 -8
- sphinx/builders/latex/util.py +1 -1
- sphinx/builders/linkcheck.py +86 -27
- sphinx/builders/manpage.py +8 -6
- sphinx/builders/singlehtml.py +5 -4
- sphinx/builders/texinfo.py +18 -14
- sphinx/builders/text.py +3 -2
- sphinx/builders/xml.py +5 -2
- sphinx/cmd/build.py +119 -76
- sphinx/cmd/make_mode.py +4 -9
- sphinx/cmd/quickstart.py +13 -16
- sphinx/config.py +432 -250
- sphinx/deprecation.py +23 -13
- sphinx/directives/__init__.py +8 -8
- sphinx/directives/code.py +7 -7
- sphinx/directives/other.py +23 -13
- sphinx/directives/patches.py +7 -6
- sphinx/domains/__init__.py +2 -2
- sphinx/domains/c/__init__.py +796 -0
- sphinx/domains/c/_ast.py +1421 -0
- sphinx/domains/c/_ids.py +65 -0
- sphinx/domains/c/_parser.py +1048 -0
- sphinx/domains/c/_symbol.py +700 -0
- sphinx/domains/changeset.py +11 -7
- sphinx/domains/citation.py +5 -2
- sphinx/domains/cpp/__init__.py +1089 -0
- sphinx/domains/cpp/_ast.py +3635 -0
- sphinx/domains/cpp/_ids.py +537 -0
- sphinx/domains/cpp/_parser.py +2117 -0
- sphinx/domains/cpp/_symbol.py +1092 -0
- sphinx/domains/index.py +6 -4
- sphinx/domains/javascript.py +16 -13
- sphinx/domains/math.py +9 -4
- sphinx/domains/python/__init__.py +890 -0
- sphinx/domains/python/_annotations.py +507 -0
- sphinx/domains/python/_object.py +426 -0
- sphinx/domains/rst.py +12 -7
- sphinx/domains/{std.py → std/__init__.py} +19 -16
- sphinx/environment/__init__.py +21 -19
- sphinx/environment/adapters/indexentries.py +2 -2
- sphinx/environment/adapters/toctree.py +10 -9
- sphinx/environment/collectors/__init__.py +6 -3
- sphinx/environment/collectors/asset.py +4 -3
- sphinx/environment/collectors/dependencies.py +3 -2
- sphinx/environment/collectors/metadata.py +6 -5
- sphinx/environment/collectors/title.py +3 -2
- sphinx/environment/collectors/toctree.py +5 -4
- sphinx/errors.py +13 -2
- sphinx/events.py +14 -9
- sphinx/ext/apidoc.py +9 -11
- sphinx/ext/autodoc/__init__.py +105 -71
- sphinx/ext/autodoc/directive.py +7 -6
- sphinx/ext/autodoc/importer.py +102 -36
- sphinx/ext/autodoc/mock.py +7 -5
- sphinx/ext/autodoc/preserve_defaults.py +4 -3
- sphinx/ext/autodoc/type_comment.py +2 -1
- sphinx/ext/autodoc/typehints.py +5 -4
- sphinx/ext/autosectionlabel.py +3 -2
- sphinx/ext/autosummary/__init__.py +21 -17
- sphinx/ext/autosummary/generate.py +9 -9
- sphinx/ext/coverage.py +26 -20
- sphinx/ext/doctest.py +38 -33
- sphinx/ext/duration.py +1 -0
- sphinx/ext/extlinks.py +4 -3
- sphinx/ext/githubpages.py +3 -2
- sphinx/ext/graphviz.py +10 -7
- sphinx/ext/ifconfig.py +5 -5
- sphinx/ext/imgconverter.py +6 -5
- sphinx/ext/imgmath.py +9 -8
- sphinx/ext/inheritance_diagram.py +31 -31
- sphinx/ext/intersphinx.py +140 -23
- sphinx/ext/linkcode.py +3 -2
- sphinx/ext/mathjax.py +2 -1
- sphinx/ext/napoleon/__init__.py +12 -7
- sphinx/ext/napoleon/docstring.py +34 -32
- sphinx/ext/todo.py +10 -7
- sphinx/ext/viewcode.py +12 -11
- sphinx/extension.py +18 -8
- sphinx/highlighting.py +39 -20
- sphinx/io.py +17 -8
- sphinx/jinja2glue.py +16 -15
- sphinx/locale/__init__.py +30 -23
- sphinx/locale/ar/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ar/LC_MESSAGES/sphinx.po +818 -761
- sphinx/locale/bg/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/bg/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/bn/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/bn/LC_MESSAGES/sphinx.po +835 -778
- sphinx/locale/ca/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ca/LC_MESSAGES/sphinx.po +864 -807
- sphinx/locale/cak/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cak/LC_MESSAGES/sphinx.po +816 -759
- sphinx/locale/cs/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cs/LC_MESSAGES/sphinx.po +837 -780
- sphinx/locale/cy/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cy/LC_MESSAGES/sphinx.po +819 -762
- sphinx/locale/da/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/da/LC_MESSAGES/sphinx.po +838 -781
- sphinx/locale/de/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/de/LC_MESSAGES/sphinx.po +838 -781
- sphinx/locale/de_DE/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/de_DE/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/el/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/el/LC_MESSAGES/sphinx.po +853 -796
- sphinx/locale/en_DE/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_DE/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/en_FR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_FR/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/en_GB/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_GB/LC_MESSAGES/sphinx.po +856 -799
- sphinx/locale/en_HK/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_HK/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/eo/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/eo/LC_MESSAGES/sphinx.po +820 -763
- sphinx/locale/es/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/es/LC_MESSAGES/sphinx.po +856 -799
- sphinx/locale/es_CO/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/es_CO/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/et/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/et/LC_MESSAGES/sphinx.po +845 -788
- sphinx/locale/eu/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/eu/LC_MESSAGES/sphinx.po +837 -780
- sphinx/locale/fa/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fa/LC_MESSAGES/sphinx.po +854 -797
- sphinx/locale/fi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fi/LC_MESSAGES/sphinx.po +816 -759
- sphinx/locale/fr/LC_MESSAGES/sphinx.js +1 -1
- sphinx/locale/fr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fr/LC_MESSAGES/sphinx.po +904 -847
- sphinx/locale/fr_FR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fr_FR/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/gl/LC_MESSAGES/sphinx.js +54 -54
- sphinx/locale/gl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/gl/LC_MESSAGES/sphinx.po +1506 -1449
- sphinx/locale/he/LC_MESSAGES/sphinx.js +1 -1
- sphinx/locale/he/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/he/LC_MESSAGES/sphinx.po +823 -766
- sphinx/locale/hi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hi/LC_MESSAGES/sphinx.po +853 -796
- sphinx/locale/hi_IN/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hi_IN/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/hr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hr/LC_MESSAGES/sphinx.po +844 -787
- sphinx/locale/hu/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hu/LC_MESSAGES/sphinx.po +837 -780
- sphinx/locale/id/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/id/LC_MESSAGES/sphinx.po +854 -797
- sphinx/locale/is/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/is/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/it/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/it/LC_MESSAGES/sphinx.po +837 -780
- sphinx/locale/ja/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ja/LC_MESSAGES/sphinx.po +853 -796
- sphinx/locale/ka/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ka/LC_MESSAGES/sphinx.po +848 -791
- sphinx/locale/ko/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ko/LC_MESSAGES/sphinx.po +855 -798
- sphinx/locale/lt/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/lt/LC_MESSAGES/sphinx.po +837 -780
- sphinx/locale/lv/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/lv/LC_MESSAGES/sphinx.po +837 -780
- sphinx/locale/mk/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/mk/LC_MESSAGES/sphinx.po +825 -768
- sphinx/locale/nb_NO/LC_MESSAGES/sphinx.js +27 -27
- sphinx/locale/nb_NO/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/nb_NO/LC_MESSAGES/sphinx.po +876 -818
- sphinx/locale/ne/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ne/LC_MESSAGES/sphinx.po +837 -780
- sphinx/locale/nl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/nl/LC_MESSAGES/sphinx.po +844 -787
- sphinx/locale/pl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pl/LC_MESSAGES/sphinx.po +845 -788
- sphinx/locale/pt/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +908 -851
- sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po +837 -780
- sphinx/locale/ro/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ro/LC_MESSAGES/sphinx.po +837 -780
- sphinx/locale/ru/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ru/LC_MESSAGES/sphinx.po +838 -781
- sphinx/locale/si/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/si/LC_MESSAGES/sphinx.po +823 -766
- sphinx/locale/sk/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sk/LC_MESSAGES/sphinx.po +854 -797
- sphinx/locale/sl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sl/LC_MESSAGES/sphinx.po +832 -775
- sphinx/locale/sphinx.pot +813 -755
- sphinx/locale/sq/LC_MESSAGES/sphinx.js +1 -1
- sphinx/locale/sq/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sq/LC_MESSAGES/sphinx.po +865 -808
- sphinx/locale/sr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sr/LC_MESSAGES/sphinx.po +835 -778
- sphinx/locale/sr@latin/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sr_RS/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sv/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sv/LC_MESSAGES/sphinx.po +837 -780
- 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 +1530 -1473
- sphinx/locale/te/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/te/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/tr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/tr/LC_MESSAGES/sphinx.po +853 -796
- sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +833 -776
- sphinx/locale/ur/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ur/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/vi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/vi/LC_MESSAGES/sphinx.po +837 -780
- sphinx/locale/yue/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/yue/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po +855 -798
- sphinx/locale/zh_HK/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_HK/LC_MESSAGES/sphinx.po +811 -754
- sphinx/locale/zh_TW/LC_MESSAGES/sphinx.js +1 -1
- sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +879 -822
- sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.po +811 -754
- sphinx/parsers.py +7 -5
- sphinx/project.py +18 -11
- sphinx/pycode/__init__.py +6 -5
- sphinx/pycode/ast.py +23 -8
- sphinx/pycode/parser.py +6 -5
- sphinx/registry.py +12 -6
- sphinx/roles.py +103 -57
- sphinx/search/__init__.py +17 -18
- sphinx/search/da.py +2 -2
- sphinx/search/de.py +2 -2
- sphinx/search/en.py +1 -1
- sphinx/search/es.py +2 -2
- sphinx/search/fi.py +2 -2
- sphinx/search/fr.py +2 -2
- sphinx/search/hu.py +2 -2
- sphinx/search/it.py +2 -2
- sphinx/search/ja.py +13 -22
- sphinx/search/nl.py +2 -2
- sphinx/search/no.py +2 -2
- sphinx/search/pt.py +2 -2
- sphinx/search/ro.py +1 -1
- sphinx/search/ru.py +2 -2
- sphinx/search/sv.py +2 -2
- sphinx/search/tr.py +1 -1
- sphinx/search/zh.py +2 -3
- sphinx/templates/graphviz/graphviz.css +1 -1
- sphinx/testing/fixtures.py +41 -24
- sphinx/testing/path.py +1 -1
- sphinx/testing/util.py +142 -53
- sphinx/texinputs/sphinx.xdy +1 -1
- sphinx/texinputs/sphinxlatextables.sty +1 -1
- sphinx/texinputs/sphinxpackagesubstitutefont.sty +21 -0
- sphinx/themes/agogo/layout.html +4 -4
- sphinx/themes/agogo/static/agogo.css_t +1 -1
- sphinx/themes/agogo/theme.toml +22 -0
- sphinx/themes/basic/defindex.html +1 -1
- sphinx/themes/basic/domainindex.html +1 -1
- sphinx/themes/basic/genindex-single.html +1 -1
- sphinx/themes/basic/genindex-split.html +1 -1
- sphinx/themes/basic/genindex.html +1 -1
- sphinx/themes/basic/globaltoc.html +1 -1
- sphinx/themes/basic/layout.html +1 -1
- sphinx/themes/basic/localtoc.html +1 -1
- sphinx/themes/basic/page.html +1 -1
- sphinx/themes/basic/relations.html +1 -1
- sphinx/themes/basic/search.html +5 -20
- sphinx/themes/basic/searchbox.html +3 -3
- sphinx/themes/basic/searchfield.html +3 -3
- sphinx/themes/basic/sourcelink.html +1 -1
- sphinx/themes/basic/static/basic.css_t +1 -1
- sphinx/themes/basic/static/doctools.js +1 -1
- sphinx/themes/basic/static/language_data.js_t +2 -2
- sphinx/themes/basic/static/searchtools.js +105 -60
- sphinx/themes/basic/theme.toml +23 -0
- sphinx/themes/bizstyle/layout.html +1 -6
- sphinx/themes/bizstyle/static/bizstyle.css_t +1 -1
- sphinx/themes/bizstyle/static/bizstyle.js_t +1 -1
- sphinx/themes/bizstyle/static/css3-mediaqueries_src.js +3 -3
- sphinx/themes/bizstyle/theme.toml +12 -0
- sphinx/themes/classic/layout.html +1 -1
- sphinx/themes/classic/static/classic.css_t +1 -1
- sphinx/themes/classic/static/sidebar.js_t +1 -1
- sphinx/themes/classic/theme.toml +34 -0
- sphinx/themes/default/theme.toml +2 -0
- sphinx/themes/epub/epub-cover.html +1 -1
- sphinx/themes/epub/layout.html +1 -1
- sphinx/themes/epub/static/epub.css_t +1 -1
- sphinx/themes/epub/theme.toml +10 -0
- sphinx/themes/haiku/layout.html +3 -3
- sphinx/themes/haiku/static/haiku.css_t +2 -2
- sphinx/themes/haiku/theme.toml +16 -0
- sphinx/themes/nature/static/nature.css_t +1 -1
- sphinx/themes/nature/theme.toml +6 -0
- sphinx/themes/nonav/layout.html +1 -1
- sphinx/themes/nonav/static/nonav.css_t +1 -1
- sphinx/themes/nonav/theme.toml +10 -0
- sphinx/themes/pyramid/static/epub.css_t +1 -1
- sphinx/themes/pyramid/static/pyramid.css_t +1 -1
- sphinx/themes/pyramid/theme.toml +6 -0
- sphinx/themes/scrolls/artwork/logo.svg +1 -1
- sphinx/themes/scrolls/layout.html +2 -2
- sphinx/themes/scrolls/static/scrolls.css_t +1 -1
- sphinx/themes/scrolls/theme.toml +15 -0
- sphinx/themes/sphinxdoc/static/sphinxdoc.css_t +1 -1
- sphinx/themes/sphinxdoc/theme.toml +6 -0
- sphinx/themes/traditional/static/traditional.css_t +1 -1
- sphinx/themes/traditional/theme.toml +9 -0
- sphinx/theming.py +427 -131
- sphinx/transforms/__init__.py +21 -24
- sphinx/transforms/compact_bullet_list.py +5 -5
- sphinx/transforms/i18n.py +30 -28
- sphinx/transforms/post_transforms/__init__.py +9 -7
- sphinx/transforms/post_transforms/code.py +4 -1
- sphinx/transforms/post_transforms/images.py +17 -13
- sphinx/transforms/references.py +3 -1
- sphinx/util/__init__.py +15 -11
- sphinx/util/_io.py +34 -0
- sphinx/util/_pathlib.py +23 -18
- sphinx/util/build_phase.py +1 -0
- sphinx/util/cfamily.py +19 -11
- sphinx/util/console.py +101 -21
- sphinx/util/display.py +3 -2
- sphinx/util/docfields.py +12 -8
- sphinx/util/docutils.py +21 -35
- sphinx/util/exceptions.py +3 -2
- sphinx/util/fileutil.py +5 -5
- sphinx/util/http_date.py +9 -2
- sphinx/util/i18n.py +40 -9
- sphinx/util/inspect.py +317 -245
- sphinx/util/inventory.py +22 -5
- sphinx/util/logging.py +81 -7
- sphinx/util/matching.py +2 -1
- sphinx/util/math.py +1 -2
- sphinx/util/nodes.py +39 -29
- sphinx/util/osutil.py +25 -6
- sphinx/util/parallel.py +6 -1
- sphinx/util/requests.py +8 -5
- sphinx/util/rst.py +8 -6
- sphinx/util/tags.py +3 -3
- sphinx/util/template.py +8 -3
- sphinx/util/typing.py +76 -42
- sphinx/versioning.py +6 -2
- sphinx/writers/html.py +1 -1
- sphinx/writers/html5.py +17 -13
- sphinx/writers/latex.py +12 -12
- sphinx/writers/manpage.py +13 -7
- sphinx/writers/texinfo.py +13 -10
- sphinx/writers/text.py +13 -23
- sphinx/writers/xml.py +1 -1
- sphinx-7.2.6.dist-info/LICENSE → sphinx-7.3.1.dist-info/LICENSE.rst +1 -1
- {sphinx-7.2.6.dist-info → sphinx-7.3.1.dist-info}/METADATA +14 -12
- sphinx-7.3.1.dist-info/RECORD +581 -0
- sphinx/domains/c.py +0 -3906
- sphinx/domains/cpp.py +0 -8233
- sphinx/domains/python.py +0 -1769
- sphinx/themes/agogo/theme.conf +0 -20
- sphinx/themes/basic/theme.conf +0 -16
- sphinx/themes/bizstyle/theme.conf +0 -10
- sphinx/themes/classic/theme.conf +0 -32
- sphinx/themes/default/theme.conf +0 -2
- sphinx/themes/epub/theme.conf +0 -8
- sphinx/themes/haiku/theme.conf +0 -14
- sphinx/themes/nature/theme.conf +0 -4
- sphinx/themes/nonav/theme.conf +0 -8
- sphinx/themes/pyramid/theme.conf +0 -4
- sphinx/themes/scrolls/theme.conf +0 -13
- sphinx/themes/sphinxdoc/theme.conf +0 -4
- sphinx/themes/traditional/theme.conf +0 -7
- sphinx-7.2.6.dist-info/RECORD +0 -569
- {sphinx-7.2.6.dist-info → sphinx-7.3.1.dist-info}/WHEEL +0 -0
- {sphinx-7.2.6.dist-info → sphinx-7.3.1.dist-info}/entry_points.txt +0 -0
sphinx/environment/__init__.py
CHANGED
|
@@ -9,7 +9,7 @@ import time
|
|
|
9
9
|
from collections import defaultdict
|
|
10
10
|
from copy import copy
|
|
11
11
|
from os import path
|
|
12
|
-
from typing import TYPE_CHECKING, Any, Callable
|
|
12
|
+
from typing import TYPE_CHECKING, Any, Callable, NoReturn
|
|
13
13
|
|
|
14
14
|
from sphinx import addnodes
|
|
15
15
|
from sphinx.environment.adapters import toctree as toctree_adapters
|
|
@@ -23,7 +23,7 @@ from sphinx.util.nodes import is_translatable
|
|
|
23
23
|
from sphinx.util.osutil import canon_path, os_path
|
|
24
24
|
|
|
25
25
|
if TYPE_CHECKING:
|
|
26
|
-
from collections.abc import
|
|
26
|
+
from collections.abc import Iterator
|
|
27
27
|
from pathlib import Path
|
|
28
28
|
|
|
29
29
|
from docutils import nodes
|
|
@@ -58,7 +58,7 @@ default_settings: dict[str, Any] = {
|
|
|
58
58
|
|
|
59
59
|
# This is increased every time an environment attribute is added
|
|
60
60
|
# or changed to properly invalidate pickle files.
|
|
61
|
-
ENV_VERSION =
|
|
61
|
+
ENV_VERSION = 61
|
|
62
62
|
|
|
63
63
|
# config status
|
|
64
64
|
CONFIG_UNSET = -1
|
|
@@ -81,9 +81,7 @@ versioning_conditions: dict[str, bool | Callable] = {
|
|
|
81
81
|
|
|
82
82
|
if TYPE_CHECKING:
|
|
83
83
|
from collections.abc import MutableMapping
|
|
84
|
-
from typing import Literal
|
|
85
|
-
|
|
86
|
-
from typing_extensions import overload
|
|
84
|
+
from typing import Literal, overload
|
|
87
85
|
|
|
88
86
|
from sphinx.domains.c import CDomain
|
|
89
87
|
from sphinx.domains.changeset import ChangeSetDomain
|
|
@@ -126,10 +124,12 @@ if TYPE_CHECKING:
|
|
|
126
124
|
@overload
|
|
127
125
|
def __getitem__(self, key: str) -> Domain: ... # NoQA: E704
|
|
128
126
|
def __getitem__(self, key): raise NotImplementedError # NoQA: E704
|
|
129
|
-
def __setitem__(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
def
|
|
127
|
+
def __setitem__( # NoQA: E301,E704
|
|
128
|
+
self, key: str, value: Domain,
|
|
129
|
+
) -> NoReturn: raise NotImplementedError
|
|
130
|
+
def __delitem__(self, key: str) -> NoReturn: raise NotImplementedError # NoQA: E704
|
|
131
|
+
def __iter__(self) -> NoReturn: raise NotImplementedError # NoQA: E704
|
|
132
|
+
def __len__(self) -> NoReturn: raise NotImplementedError # NoQA: E704
|
|
133
133
|
|
|
134
134
|
else:
|
|
135
135
|
_DomainsType = dict
|
|
@@ -146,7 +146,7 @@ class BuildEnvironment:
|
|
|
146
146
|
|
|
147
147
|
# --------- ENVIRONMENT INITIALIZATION -------------------------------------
|
|
148
148
|
|
|
149
|
-
def __init__(self, app: Sphinx):
|
|
149
|
+
def __init__(self, app: Sphinx) -> None:
|
|
150
150
|
self.app: Sphinx = app
|
|
151
151
|
self.doctreedir: Path = app.doctreedir
|
|
152
152
|
self.srcdir: Path = app.srcdir
|
|
@@ -155,7 +155,7 @@ class BuildEnvironment:
|
|
|
155
155
|
self.config_status_extra: str = ''
|
|
156
156
|
self.events: EventManager = app.events
|
|
157
157
|
self.project: Project = app.project
|
|
158
|
-
self.version: dict[str,
|
|
158
|
+
self.version: dict[str, int] = app.registry.get_envversion(app)
|
|
159
159
|
|
|
160
160
|
# the method of doctree versioning; see set_versioning_method
|
|
161
161
|
self.versioning_condition: bool | Callable | None = None
|
|
@@ -265,6 +265,9 @@ class BuildEnvironment:
|
|
|
265
265
|
"""Obtains serializable data for pickling."""
|
|
266
266
|
__dict__ = self.__dict__.copy()
|
|
267
267
|
__dict__.update(app=None, domains={}, events=None) # clear unpickable attributes
|
|
268
|
+
# ensure that upon restoring the state, the most recent pickled files
|
|
269
|
+
# on the disk are used instead of those from a possibly outdated state
|
|
270
|
+
__dict__.update(_pickled_doctree_cache={})
|
|
268
271
|
return __dict__
|
|
269
272
|
|
|
270
273
|
def __setstate__(self, state: dict) -> None:
|
|
@@ -299,7 +302,7 @@ class BuildEnvironment:
|
|
|
299
302
|
# initialize config
|
|
300
303
|
self._update_config(app.config)
|
|
301
304
|
|
|
302
|
-
#
|
|
305
|
+
# initialize settings
|
|
303
306
|
self._update_settings(app.config)
|
|
304
307
|
|
|
305
308
|
def _update_config(self, config: Config) -> None:
|
|
@@ -320,7 +323,7 @@ class BuildEnvironment:
|
|
|
320
323
|
else:
|
|
321
324
|
# check if a config value was changed that affects how
|
|
322
325
|
# doctrees are read
|
|
323
|
-
for item in config.filter('env'):
|
|
326
|
+
for item in config.filter(frozenset({'env'})):
|
|
324
327
|
if self.config[item.name] != item.value:
|
|
325
328
|
self.config_status = CONFIG_CHANGED
|
|
326
329
|
self.config_status_extra = f' ({item.name!r})'
|
|
@@ -338,7 +341,7 @@ class BuildEnvironment:
|
|
|
338
341
|
self.settings.setdefault('smart_quotes', True)
|
|
339
342
|
|
|
340
343
|
def set_versioning_method(self, method: str | Callable, compare: bool) -> None:
|
|
341
|
-
"""
|
|
344
|
+
"""Set the doctree versioning method for this environment.
|
|
342
345
|
|
|
343
346
|
Versioning methods are a builder property; only builders with the same
|
|
344
347
|
versioning method can share the same doctree directory. Therefore, we
|
|
@@ -424,7 +427,7 @@ class BuildEnvironment:
|
|
|
424
427
|
|
|
425
428
|
@property
|
|
426
429
|
def found_docs(self) -> set[str]:
|
|
427
|
-
"""
|
|
430
|
+
"""Contains all existing docnames."""
|
|
428
431
|
return self.project.docnames
|
|
429
432
|
|
|
430
433
|
def find_files(self, config: Config, builder: Builder) -> None:
|
|
@@ -521,7 +524,7 @@ class BuildEnvironment:
|
|
|
521
524
|
|
|
522
525
|
return added, changed, removed
|
|
523
526
|
|
|
524
|
-
def check_dependents(self, app: Sphinx, already: set[str]) ->
|
|
527
|
+
def check_dependents(self, app: Sphinx, already: set[str]) -> Iterator[str]:
|
|
525
528
|
to_rewrite: list[str] = []
|
|
526
529
|
for docnames in self.events.emit('env-get-updated', self):
|
|
527
530
|
to_rewrite.extend(docnames)
|
|
@@ -743,7 +746,6 @@ def _last_modified_time(filename: str | os.PathLike[str]) -> int:
|
|
|
743
746
|
We prefer to err on the side of re-rendering a file,
|
|
744
747
|
so we round up to the nearest microsecond.
|
|
745
748
|
"""
|
|
746
|
-
|
|
747
749
|
# upside-down floor division to get the ceiling
|
|
748
750
|
return -(os.stat(filename).st_mtime_ns // -1_000)
|
|
749
751
|
|
|
@@ -751,7 +753,7 @@ def _last_modified_time(filename: str | os.PathLike[str]) -> int:
|
|
|
751
753
|
def _format_modified_time(timestamp: int) -> str:
|
|
752
754
|
"""Return an RFC 3339 formatted string representing the given timestamp."""
|
|
753
755
|
seconds, fraction = divmod(timestamp, 10**6)
|
|
754
|
-
return time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(seconds)) + f'.{fraction//1_000}'
|
|
756
|
+
return time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(seconds)) + f'.{fraction // 1_000}'
|
|
755
757
|
|
|
756
758
|
|
|
757
759
|
def _traverse_toctree(
|
|
@@ -129,7 +129,7 @@ def _add_entry(word: str, subword: str, main: str | None, *,
|
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
def _key_func_0(entry: tuple[str, str]) -> tuple[bool, str]:
|
|
132
|
-
"""
|
|
132
|
+
"""Sort the index entries for same keyword."""
|
|
133
133
|
main, uri = entry
|
|
134
134
|
return not main, uri # show main entries at first
|
|
135
135
|
|
|
@@ -156,7 +156,7 @@ def _key_func_1(entry: tuple[str, list]) -> tuple[tuple[int, str], str]:
|
|
|
156
156
|
|
|
157
157
|
|
|
158
158
|
def _key_func_2(entry: tuple[str, list]) -> str:
|
|
159
|
-
"""
|
|
159
|
+
"""Sort the sub-index entries"""
|
|
160
160
|
key = unicodedata.normalize('NFD', entry[0].lower())
|
|
161
161
|
if key.startswith('\N{RIGHT-TO-LEFT MARK}'):
|
|
162
162
|
key = key[1:]
|
|
@@ -47,7 +47,6 @@ def document_toc(env: BuildEnvironment, docname: str, tags: Tags) -> Node:
|
|
|
47
47
|
For a ToC tree that shows the document's place in the
|
|
48
48
|
ToC structure, use `get_toctree_for`.
|
|
49
49
|
"""
|
|
50
|
-
|
|
51
50
|
tocdepth = env.metadata[docname].get('tocdepth', 0)
|
|
52
51
|
try:
|
|
53
52
|
toc = _toctree_copy(env.tocs[docname], 2, tocdepth, False, tags)
|
|
@@ -74,10 +73,8 @@ def global_toctree_for_doc(
|
|
|
74
73
|
|
|
75
74
|
This gives the global ToC, with all ancestors and their siblings.
|
|
76
75
|
"""
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
for toctree_node in env.master_doctree.findall(addnodes.toctree):
|
|
80
|
-
if toctree := _resolve_toctree(
|
|
76
|
+
resolved = (
|
|
77
|
+
_resolve_toctree(
|
|
81
78
|
env,
|
|
82
79
|
docname,
|
|
83
80
|
builder,
|
|
@@ -87,8 +84,13 @@ def global_toctree_for_doc(
|
|
|
87
84
|
titles_only=titles_only,
|
|
88
85
|
collapse=collapse,
|
|
89
86
|
includehidden=includehidden,
|
|
90
|
-
)
|
|
91
|
-
|
|
87
|
+
)
|
|
88
|
+
for toctree_node in env.master_doctree.findall(addnodes.toctree)
|
|
89
|
+
)
|
|
90
|
+
toctrees = [
|
|
91
|
+
toctree for toctree in resolved if toctree is not None
|
|
92
|
+
]
|
|
93
|
+
|
|
92
94
|
if not toctrees:
|
|
93
95
|
return None
|
|
94
96
|
result = toctrees[0]
|
|
@@ -113,7 +115,6 @@ def _resolve_toctree(
|
|
|
113
115
|
If *collapse* is True, all branches not containing docname will
|
|
114
116
|
be collapsed.
|
|
115
117
|
"""
|
|
116
|
-
|
|
117
118
|
if toctree.get('hidden', False) and not includehidden:
|
|
118
119
|
return None
|
|
119
120
|
|
|
@@ -250,7 +251,7 @@ def _entries_from_toctree(
|
|
|
250
251
|
included,
|
|
251
252
|
excluded,
|
|
252
253
|
sub_toc_node,
|
|
253
|
-
[refdoc
|
|
254
|
+
[refdoc, *parents],
|
|
254
255
|
subtree=True,
|
|
255
256
|
),
|
|
256
257
|
start=sub_toc_node.parent.index(sub_toc_node) + 1,
|
|
@@ -41,19 +41,22 @@ class EnvironmentCollector:
|
|
|
41
41
|
def clear_doc(self, app: Sphinx, env: BuildEnvironment, docname: str) -> None:
|
|
42
42
|
"""Remove specified data of a document.
|
|
43
43
|
|
|
44
|
-
This method is called on the removal of the document.
|
|
44
|
+
This method is called on the removal of the document.
|
|
45
|
+
"""
|
|
45
46
|
raise NotImplementedError
|
|
46
47
|
|
|
47
48
|
def merge_other(self, app: Sphinx, env: BuildEnvironment,
|
|
48
49
|
docnames: set[str], other: BuildEnvironment) -> None:
|
|
49
50
|
"""Merge in specified data regarding docnames from a different `BuildEnvironment`
|
|
50
|
-
object which coming from a subprocess in parallel builds.
|
|
51
|
+
object which coming from a subprocess in parallel builds.
|
|
52
|
+
"""
|
|
51
53
|
raise NotImplementedError
|
|
52
54
|
|
|
53
55
|
def process_doc(self, app: Sphinx, doctree: nodes.document) -> None:
|
|
54
56
|
"""Process a document and gather specific data from it.
|
|
55
57
|
|
|
56
|
-
This method is called after the document is read.
|
|
58
|
+
This method is called after the document is read.
|
|
59
|
+
"""
|
|
57
60
|
raise NotImplementedError
|
|
58
61
|
|
|
59
62
|
def get_updated_docs(self, app: Sphinx, env: BuildEnvironment) -> list[str]:
|
|
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import os
|
|
6
6
|
from glob import glob
|
|
7
7
|
from os import path
|
|
8
|
-
from typing import TYPE_CHECKING
|
|
8
|
+
from typing import TYPE_CHECKING
|
|
9
9
|
|
|
10
10
|
from docutils import nodes
|
|
11
11
|
from docutils.utils import relative_path
|
|
@@ -22,6 +22,7 @@ if TYPE_CHECKING:
|
|
|
22
22
|
|
|
23
23
|
from sphinx.application import Sphinx
|
|
24
24
|
from sphinx.environment import BuildEnvironment
|
|
25
|
+
from sphinx.util.typing import ExtensionMetadata
|
|
25
26
|
|
|
26
27
|
logger = logging.getLogger(__name__)
|
|
27
28
|
|
|
@@ -121,7 +122,7 @@ class DownloadFileCollector(EnvironmentCollector):
|
|
|
121
122
|
env.dlfiles.merge_other(docnames, other.dlfiles)
|
|
122
123
|
|
|
123
124
|
def process_doc(self, app: Sphinx, doctree: nodes.document) -> None:
|
|
124
|
-
"""Process downloadable file paths.
|
|
125
|
+
"""Process downloadable file paths."""
|
|
125
126
|
for node in doctree.findall(addnodes.download_reference):
|
|
126
127
|
targetname = node['reftarget']
|
|
127
128
|
if '://' in targetname:
|
|
@@ -136,7 +137,7 @@ class DownloadFileCollector(EnvironmentCollector):
|
|
|
136
137
|
node['filename'] = app.env.dlfiles.add_file(app.env.docname, rel_filename)
|
|
137
138
|
|
|
138
139
|
|
|
139
|
-
def setup(app: Sphinx) ->
|
|
140
|
+
def setup(app: Sphinx) -> ExtensionMetadata:
|
|
140
141
|
app.add_env_collector(ImageCollector)
|
|
141
142
|
app.add_env_collector(DownloadFileCollector)
|
|
142
143
|
|
|
@@ -4,7 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
6
|
from os import path
|
|
7
|
-
from typing import TYPE_CHECKING
|
|
7
|
+
from typing import TYPE_CHECKING
|
|
8
8
|
|
|
9
9
|
from docutils.utils import relative_path
|
|
10
10
|
|
|
@@ -16,6 +16,7 @@ if TYPE_CHECKING:
|
|
|
16
16
|
|
|
17
17
|
from sphinx.application import Sphinx
|
|
18
18
|
from sphinx.environment import BuildEnvironment
|
|
19
|
+
from sphinx.util.typing import ExtensionMetadata
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
class DependenciesCollector(EnvironmentCollector):
|
|
@@ -47,7 +48,7 @@ class DependenciesCollector(EnvironmentCollector):
|
|
|
47
48
|
app.env.dependencies[app.env.docname].add(relpath)
|
|
48
49
|
|
|
49
50
|
|
|
50
|
-
def setup(app: Sphinx) ->
|
|
51
|
+
def setup(app: Sphinx) -> ExtensionMetadata:
|
|
51
52
|
app.add_env_collector(DependenciesCollector)
|
|
52
53
|
|
|
53
54
|
return {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import TYPE_CHECKING,
|
|
5
|
+
from typing import TYPE_CHECKING, cast
|
|
6
6
|
|
|
7
7
|
from docutils import nodes
|
|
8
8
|
|
|
@@ -11,6 +11,7 @@ from sphinx.environment.collectors import EnvironmentCollector
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
12
|
from sphinx.application import Sphinx
|
|
13
13
|
from sphinx.environment import BuildEnvironment
|
|
14
|
+
from sphinx.util.typing import ExtensionMetadata
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class MetadataCollector(EnvironmentCollector):
|
|
@@ -29,7 +30,7 @@ class MetadataCollector(EnvironmentCollector):
|
|
|
29
30
|
|
|
30
31
|
Keep processing minimal -- just return what docutils says.
|
|
31
32
|
"""
|
|
32
|
-
index = doctree.first_child_not_matching_class(nodes.PreBibliographic)
|
|
33
|
+
index = doctree.first_child_not_matching_class(nodes.PreBibliographic) # type: ignore[arg-type]
|
|
33
34
|
if index is None:
|
|
34
35
|
return
|
|
35
36
|
elif isinstance(doctree[index], nodes.docinfo):
|
|
@@ -46,11 +47,11 @@ class MetadataCollector(EnvironmentCollector):
|
|
|
46
47
|
md[field_name.astext()] = field_body.astext()
|
|
47
48
|
elif isinstance(node, nodes.TextElement):
|
|
48
49
|
# other children must be TextElement
|
|
49
|
-
# see: https://docutils.sourceforge.io/docs/ref/doctree.html#bibliographic-elements #
|
|
50
|
+
# see: https://docutils.sourceforge.io/docs/ref/doctree.html#bibliographic-elements # NoQA: E501
|
|
50
51
|
md[node.__class__.__name__] = node.astext()
|
|
51
52
|
|
|
52
53
|
for name, value in md.items():
|
|
53
|
-
if name
|
|
54
|
+
if name == 'tocdepth':
|
|
54
55
|
try:
|
|
55
56
|
value = int(value)
|
|
56
57
|
except ValueError:
|
|
@@ -60,7 +61,7 @@ class MetadataCollector(EnvironmentCollector):
|
|
|
60
61
|
doctree.pop(index)
|
|
61
62
|
|
|
62
63
|
|
|
63
|
-
def setup(app: Sphinx) ->
|
|
64
|
+
def setup(app: Sphinx) -> ExtensionMetadata:
|
|
64
65
|
app.add_env_collector(MetadataCollector)
|
|
65
66
|
|
|
66
67
|
return {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import TYPE_CHECKING
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
6
|
|
|
7
7
|
from docutils import nodes
|
|
8
8
|
|
|
@@ -12,6 +12,7 @@ from sphinx.transforms import SphinxContentsFilter
|
|
|
12
12
|
if TYPE_CHECKING:
|
|
13
13
|
from sphinx.application import Sphinx
|
|
14
14
|
from sphinx.environment import BuildEnvironment
|
|
15
|
+
from sphinx.util.typing import ExtensionMetadata
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class TitleCollector(EnvironmentCollector):
|
|
@@ -51,7 +52,7 @@ class TitleCollector(EnvironmentCollector):
|
|
|
51
52
|
app.env.longtitles[app.env.docname] = longtitlenode
|
|
52
53
|
|
|
53
54
|
|
|
54
|
-
def setup(app: Sphinx) ->
|
|
55
|
+
def setup(app: Sphinx) -> ExtensionMetadata:
|
|
55
56
|
app.add_env_collector(TitleCollector)
|
|
56
57
|
|
|
57
58
|
return {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import TYPE_CHECKING,
|
|
5
|
+
from typing import TYPE_CHECKING, TypeVar, cast
|
|
6
6
|
|
|
7
7
|
from docutils import nodes
|
|
8
8
|
|
|
@@ -20,6 +20,7 @@ if TYPE_CHECKING:
|
|
|
20
20
|
|
|
21
21
|
from sphinx.application import Sphinx
|
|
22
22
|
from sphinx.environment import BuildEnvironment
|
|
23
|
+
from sphinx.util.typing import ExtensionMetadata
|
|
23
24
|
|
|
24
25
|
N = TypeVar('N')
|
|
25
26
|
|
|
@@ -201,7 +202,7 @@ class TocTreeCollector(EnvironmentCollector):
|
|
|
201
202
|
numstack[-1] += 1
|
|
202
203
|
reference = cast(nodes.reference, subnode[0])
|
|
203
204
|
if depth > 0:
|
|
204
|
-
number =
|
|
205
|
+
number = numstack.copy()
|
|
205
206
|
secnums[reference['anchorname']] = tuple(numstack)
|
|
206
207
|
else:
|
|
207
208
|
number = None
|
|
@@ -283,7 +284,7 @@ class TocTreeCollector(EnvironmentCollector):
|
|
|
283
284
|
|
|
284
285
|
secnum = secnum[:env.config.numfig_secnum_depth]
|
|
285
286
|
counter[secnum] = counter.get(secnum, 0) + 1
|
|
286
|
-
return secnum
|
|
287
|
+
return (*secnum, counter[secnum])
|
|
287
288
|
|
|
288
289
|
def register_fignumber(docname: str, secnum: tuple[int, ...],
|
|
289
290
|
figtype: str, fignode: Element) -> None:
|
|
@@ -345,7 +346,7 @@ def _make_anchor_name(ids: list[str], num_entries: list[int]) -> str:
|
|
|
345
346
|
return anchorname
|
|
346
347
|
|
|
347
348
|
|
|
348
|
-
def setup(app: Sphinx) ->
|
|
349
|
+
def setup(app: Sphinx) -> ExtensionMetadata:
|
|
349
350
|
app.add_env_collector(TocTreeCollector)
|
|
350
351
|
|
|
351
352
|
return {
|
sphinx/errors.py
CHANGED
|
@@ -25,16 +25,19 @@ class SphinxError(Exception):
|
|
|
25
25
|
exception to a string ("category: message"). Should be set accordingly
|
|
26
26
|
in subclasses.
|
|
27
27
|
"""
|
|
28
|
+
|
|
28
29
|
category = 'Sphinx error'
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
class SphinxWarning(SphinxError):
|
|
32
33
|
"""Warning, treated as error."""
|
|
34
|
+
|
|
33
35
|
category = 'Warning, treated as error'
|
|
34
36
|
|
|
35
37
|
|
|
36
38
|
class ApplicationError(SphinxError):
|
|
37
39
|
"""Application initialization error."""
|
|
40
|
+
|
|
38
41
|
category = 'Application error'
|
|
39
42
|
|
|
40
43
|
|
|
@@ -42,7 +45,7 @@ class ExtensionError(SphinxError):
|
|
|
42
45
|
"""Extension error."""
|
|
43
46
|
|
|
44
47
|
def __init__(
|
|
45
|
-
self, message: str, orig_exc: Exception | None = None, modname: str | None = None
|
|
48
|
+
self, message: str, orig_exc: Exception | None = None, modname: str | None = None
|
|
46
49
|
) -> None:
|
|
47
50
|
super().__init__(message)
|
|
48
51
|
self.message = message
|
|
@@ -70,26 +73,31 @@ class ExtensionError(SphinxError):
|
|
|
70
73
|
|
|
71
74
|
class BuildEnvironmentError(SphinxError):
|
|
72
75
|
"""BuildEnvironment error."""
|
|
76
|
+
|
|
73
77
|
category = 'BuildEnvironment error'
|
|
74
78
|
|
|
75
79
|
|
|
76
80
|
class ConfigError(SphinxError):
|
|
77
81
|
"""Configuration error."""
|
|
82
|
+
|
|
78
83
|
category = 'Configuration error'
|
|
79
84
|
|
|
80
85
|
|
|
81
86
|
class DocumentError(SphinxError):
|
|
82
87
|
"""Document error."""
|
|
88
|
+
|
|
83
89
|
category = 'Document error'
|
|
84
90
|
|
|
85
91
|
|
|
86
92
|
class ThemeError(SphinxError):
|
|
87
93
|
"""Theme error."""
|
|
94
|
+
|
|
88
95
|
category = 'Theme error'
|
|
89
96
|
|
|
90
97
|
|
|
91
98
|
class VersionRequirementError(SphinxError):
|
|
92
99
|
"""Incompatible Sphinx version error."""
|
|
100
|
+
|
|
93
101
|
category = 'Sphinx version error'
|
|
94
102
|
|
|
95
103
|
|
|
@@ -118,10 +126,13 @@ class PycodeError(Exception):
|
|
|
118
126
|
|
|
119
127
|
class NoUri(Exception):
|
|
120
128
|
"""Raised by builder.get_relative_uri() or from missing-reference handlers
|
|
121
|
-
if there is no URI available.
|
|
129
|
+
if there is no URI available.
|
|
130
|
+
"""
|
|
131
|
+
|
|
122
132
|
pass
|
|
123
133
|
|
|
124
134
|
|
|
125
135
|
class FiletypeNotFoundError(Exception):
|
|
126
136
|
"""Raised by get_filetype() if a filename matches no source suffix."""
|
|
137
|
+
|
|
127
138
|
pass
|
sphinx/events.py
CHANGED
|
@@ -77,21 +77,21 @@ class EventManager:
|
|
|
77
77
|
def disconnect(self, listener_id: int) -> None:
|
|
78
78
|
"""Disconnect a handler."""
|
|
79
79
|
for listeners in self.listeners.values():
|
|
80
|
-
for listener in listeners
|
|
80
|
+
for listener in listeners.copy():
|
|
81
81
|
if listener.id == listener_id:
|
|
82
82
|
listeners.remove(listener)
|
|
83
83
|
|
|
84
|
-
def emit(
|
|
85
|
-
|
|
84
|
+
def emit(
|
|
85
|
+
self, name: str, *args: Any, allowed_exceptions: tuple[type[Exception], ...] = ()
|
|
86
|
+
) -> list:
|
|
86
87
|
"""Emit a Sphinx event."""
|
|
87
|
-
|
|
88
88
|
# not every object likes to be repr()'d (think
|
|
89
89
|
# random stuff coming via autodoc)
|
|
90
90
|
with contextlib.suppress(Exception):
|
|
91
91
|
logger.debug('[app] emitting event: %r%s', name, repr(args)[:100])
|
|
92
92
|
|
|
93
93
|
results = []
|
|
94
|
-
listeners = sorted(self.listeners[name], key=attrgetter(
|
|
94
|
+
listeners = sorted(self.listeners[name], key=attrgetter('priority'))
|
|
95
95
|
for listener in listeners:
|
|
96
96
|
try:
|
|
97
97
|
results.append(listener.handler(self.app, *args))
|
|
@@ -105,12 +105,17 @@ class EventManager:
|
|
|
105
105
|
# Just pass through the error, so that it can be debugged.
|
|
106
106
|
raise
|
|
107
107
|
modname = safe_getattr(listener.handler, '__module__', None)
|
|
108
|
-
raise ExtensionError(
|
|
109
|
-
|
|
108
|
+
raise ExtensionError(
|
|
109
|
+
__('Handler %r for event %r threw an exception')
|
|
110
|
+
% (listener.handler, name),
|
|
111
|
+
exc,
|
|
112
|
+
modname=modname,
|
|
113
|
+
) from exc
|
|
110
114
|
return results
|
|
111
115
|
|
|
112
|
-
def emit_firstresult(
|
|
113
|
-
|
|
116
|
+
def emit_firstresult(
|
|
117
|
+
self, name: str, *args: Any, allowed_exceptions: tuple[type[Exception], ...] = ()
|
|
118
|
+
) -> Any:
|
|
114
119
|
"""Emit a Sphinx event and returns first result.
|
|
115
120
|
|
|
116
121
|
This returns the result of the first handler that doesn't return ``None``.
|
sphinx/ext/apidoc.py
CHANGED
|
@@ -32,7 +32,7 @@ from sphinx.util.osutil import FileAvoidWrite, ensuredir
|
|
|
32
32
|
from sphinx.util.template import ReSTRenderer
|
|
33
33
|
|
|
34
34
|
if TYPE_CHECKING:
|
|
35
|
-
from collections.abc import
|
|
35
|
+
from collections.abc import Iterator, Sequence
|
|
36
36
|
|
|
37
37
|
logger = logging.getLogger(__name__)
|
|
38
38
|
|
|
@@ -47,7 +47,7 @@ else:
|
|
|
47
47
|
'show-inheritance',
|
|
48
48
|
]
|
|
49
49
|
|
|
50
|
-
PY_SUFFIXES = ('.py', '.pyx'
|
|
50
|
+
PY_SUFFIXES = ('.py', '.pyx', *tuple(EXTENSION_SUFFIXES))
|
|
51
51
|
|
|
52
52
|
template_dir = path.join(package_dir, 'templates', 'apidoc')
|
|
53
53
|
|
|
@@ -68,7 +68,7 @@ def module_join(*modnames: str | None) -> str:
|
|
|
68
68
|
|
|
69
69
|
def is_packagedir(dirname: str | None = None, files: list[str] | None = None) -> bool:
|
|
70
70
|
"""Check given *files* contains __init__ file."""
|
|
71
|
-
if files is
|
|
71
|
+
if files is dirname is None:
|
|
72
72
|
return False
|
|
73
73
|
|
|
74
74
|
if files is None:
|
|
@@ -168,7 +168,7 @@ def create_modules_toc_file(modules: list[str], opts: Any, name: str = 'modules'
|
|
|
168
168
|
"""Create the module's index."""
|
|
169
169
|
modules.sort()
|
|
170
170
|
prev_module = ''
|
|
171
|
-
for module in modules
|
|
171
|
+
for module in modules.copy():
|
|
172
172
|
# look if the module is a subpackage and, if yes, ignore it
|
|
173
173
|
if module.startswith(prev_module + '.'):
|
|
174
174
|
modules.remove(module)
|
|
@@ -209,14 +209,12 @@ def is_skipped_module(filename: str, opts: Any, _excludes: Sequence[re.Pattern[s
|
|
|
209
209
|
if not path.exists(filename):
|
|
210
210
|
# skip if the file doesn't exist
|
|
211
211
|
return True
|
|
212
|
-
if
|
|
213
|
-
|
|
214
|
-
return True
|
|
215
|
-
return False
|
|
212
|
+
# skip if the module has a "private" name
|
|
213
|
+
return path.basename(filename).startswith('_') and not opts.includeprivate
|
|
216
214
|
|
|
217
215
|
|
|
218
216
|
def walk(rootpath: str, excludes: Sequence[re.Pattern[str]], opts: Any,
|
|
219
|
-
) ->
|
|
217
|
+
) -> Iterator[tuple[str, list[str], list[str]]]:
|
|
220
218
|
"""Walk through the directory and list files and subdirectories up."""
|
|
221
219
|
followlinks = getattr(opts, 'followlinks', False)
|
|
222
220
|
includeprivate = getattr(opts, 'includeprivate', False)
|
|
@@ -268,14 +266,14 @@ def recurse_tree(rootpath: str, excludes: Sequence[re.Pattern[str]], opts: Any,
|
|
|
268
266
|
is_pkg = is_packagedir(None, files)
|
|
269
267
|
is_namespace = not is_pkg and implicit_namespaces
|
|
270
268
|
if is_pkg:
|
|
271
|
-
for f in files
|
|
269
|
+
for f in files.copy():
|
|
272
270
|
if is_initpy(f):
|
|
273
271
|
files.remove(f)
|
|
274
272
|
files.insert(0, f)
|
|
275
273
|
elif root != rootpath:
|
|
276
274
|
# only accept non-package at toplevel unless using implicit namespaces
|
|
277
275
|
if not implicit_namespaces:
|
|
278
|
-
|
|
276
|
+
subs.clear()
|
|
279
277
|
continue
|
|
280
278
|
|
|
281
279
|
if is_pkg or is_namespace:
|