Sphinx 7.2.5__py3-none-any.whl → 7.3.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.

Files changed (388) hide show
  1. sphinx/__init__.py +8 -9
  2. sphinx/addnodes.py +31 -28
  3. sphinx/application.py +9 -15
  4. sphinx/builders/__init__.py +5 -6
  5. sphinx/builders/_epub_base.py +17 -9
  6. sphinx/builders/changes.py +10 -5
  7. sphinx/builders/dirhtml.py +4 -2
  8. sphinx/builders/dummy.py +3 -2
  9. sphinx/builders/epub3.py +5 -3
  10. sphinx/builders/gettext.py +24 -7
  11. sphinx/builders/html/__init__.py +88 -96
  12. sphinx/builders/html/_assets.py +16 -16
  13. sphinx/builders/html/transforms.py +4 -2
  14. sphinx/builders/latex/__init__.py +40 -33
  15. sphinx/builders/latex/nodes.py +6 -2
  16. sphinx/builders/latex/transforms.py +17 -8
  17. sphinx/builders/latex/util.py +1 -1
  18. sphinx/builders/linkcheck.py +86 -27
  19. sphinx/builders/manpage.py +8 -6
  20. sphinx/builders/singlehtml.py +5 -4
  21. sphinx/builders/texinfo.py +18 -14
  22. sphinx/builders/text.py +3 -2
  23. sphinx/builders/xml.py +5 -2
  24. sphinx/cmd/build.py +119 -76
  25. sphinx/cmd/make_mode.py +21 -20
  26. sphinx/cmd/quickstart.py +13 -16
  27. sphinx/config.py +432 -250
  28. sphinx/deprecation.py +23 -13
  29. sphinx/directives/__init__.py +8 -8
  30. sphinx/directives/code.py +7 -7
  31. sphinx/directives/other.py +23 -13
  32. sphinx/directives/patches.py +7 -6
  33. sphinx/domains/__init__.py +2 -2
  34. sphinx/domains/c/__init__.py +796 -0
  35. sphinx/domains/c/_ast.py +1421 -0
  36. sphinx/domains/c/_ids.py +65 -0
  37. sphinx/domains/c/_parser.py +1048 -0
  38. sphinx/domains/c/_symbol.py +700 -0
  39. sphinx/domains/changeset.py +11 -7
  40. sphinx/domains/citation.py +5 -2
  41. sphinx/domains/cpp/__init__.py +1089 -0
  42. sphinx/domains/cpp/_ast.py +3635 -0
  43. sphinx/domains/cpp/_ids.py +537 -0
  44. sphinx/domains/cpp/_parser.py +2117 -0
  45. sphinx/domains/cpp/_symbol.py +1092 -0
  46. sphinx/domains/index.py +6 -4
  47. sphinx/domains/javascript.py +16 -13
  48. sphinx/domains/math.py +9 -4
  49. sphinx/domains/python/__init__.py +890 -0
  50. sphinx/domains/python/_annotations.py +507 -0
  51. sphinx/domains/python/_object.py +426 -0
  52. sphinx/domains/rst.py +12 -7
  53. sphinx/domains/{std.py → std/__init__.py} +19 -16
  54. sphinx/environment/__init__.py +21 -19
  55. sphinx/environment/adapters/indexentries.py +2 -2
  56. sphinx/environment/adapters/toctree.py +10 -9
  57. sphinx/environment/collectors/__init__.py +6 -3
  58. sphinx/environment/collectors/asset.py +4 -3
  59. sphinx/environment/collectors/dependencies.py +3 -2
  60. sphinx/environment/collectors/metadata.py +6 -5
  61. sphinx/environment/collectors/title.py +3 -2
  62. sphinx/environment/collectors/toctree.py +5 -4
  63. sphinx/errors.py +13 -2
  64. sphinx/events.py +14 -9
  65. sphinx/ext/apidoc.py +9 -11
  66. sphinx/ext/autodoc/__init__.py +105 -71
  67. sphinx/ext/autodoc/directive.py +7 -6
  68. sphinx/ext/autodoc/importer.py +132 -52
  69. sphinx/ext/autodoc/mock.py +7 -5
  70. sphinx/ext/autodoc/preserve_defaults.py +4 -3
  71. sphinx/ext/autodoc/type_comment.py +2 -1
  72. sphinx/ext/autodoc/typehints.py +5 -4
  73. sphinx/ext/autosectionlabel.py +3 -2
  74. sphinx/ext/autosummary/__init__.py +21 -17
  75. sphinx/ext/autosummary/generate.py +9 -9
  76. sphinx/ext/coverage.py +26 -20
  77. sphinx/ext/doctest.py +38 -33
  78. sphinx/ext/duration.py +1 -0
  79. sphinx/ext/extlinks.py +4 -3
  80. sphinx/ext/githubpages.py +3 -2
  81. sphinx/ext/graphviz.py +10 -7
  82. sphinx/ext/ifconfig.py +5 -5
  83. sphinx/ext/imgconverter.py +6 -5
  84. sphinx/ext/imgmath.py +9 -8
  85. sphinx/ext/inheritance_diagram.py +31 -31
  86. sphinx/ext/intersphinx.py +140 -23
  87. sphinx/ext/linkcode.py +3 -2
  88. sphinx/ext/mathjax.py +2 -1
  89. sphinx/ext/napoleon/__init__.py +12 -7
  90. sphinx/ext/napoleon/docstring.py +34 -32
  91. sphinx/ext/todo.py +10 -7
  92. sphinx/ext/viewcode.py +12 -11
  93. sphinx/extension.py +18 -8
  94. sphinx/highlighting.py +39 -20
  95. sphinx/io.py +17 -8
  96. sphinx/jinja2glue.py +16 -15
  97. sphinx/locale/__init__.py +30 -23
  98. sphinx/locale/ar/LC_MESSAGES/sphinx.mo +0 -0
  99. sphinx/locale/ar/LC_MESSAGES/sphinx.po +818 -761
  100. sphinx/locale/bg/LC_MESSAGES/sphinx.mo +0 -0
  101. sphinx/locale/bg/LC_MESSAGES/sphinx.po +811 -754
  102. sphinx/locale/bn/LC_MESSAGES/sphinx.mo +0 -0
  103. sphinx/locale/bn/LC_MESSAGES/sphinx.po +835 -778
  104. sphinx/locale/ca/LC_MESSAGES/sphinx.mo +0 -0
  105. sphinx/locale/ca/LC_MESSAGES/sphinx.po +864 -807
  106. sphinx/locale/cak/LC_MESSAGES/sphinx.mo +0 -0
  107. sphinx/locale/cak/LC_MESSAGES/sphinx.po +816 -759
  108. sphinx/locale/cs/LC_MESSAGES/sphinx.mo +0 -0
  109. sphinx/locale/cs/LC_MESSAGES/sphinx.po +837 -780
  110. sphinx/locale/cy/LC_MESSAGES/sphinx.mo +0 -0
  111. sphinx/locale/cy/LC_MESSAGES/sphinx.po +819 -762
  112. sphinx/locale/da/LC_MESSAGES/sphinx.mo +0 -0
  113. sphinx/locale/da/LC_MESSAGES/sphinx.po +838 -781
  114. sphinx/locale/de/LC_MESSAGES/sphinx.mo +0 -0
  115. sphinx/locale/de/LC_MESSAGES/sphinx.po +838 -781
  116. sphinx/locale/de_DE/LC_MESSAGES/sphinx.mo +0 -0
  117. sphinx/locale/de_DE/LC_MESSAGES/sphinx.po +811 -754
  118. sphinx/locale/el/LC_MESSAGES/sphinx.mo +0 -0
  119. sphinx/locale/el/LC_MESSAGES/sphinx.po +853 -796
  120. sphinx/locale/en_DE/LC_MESSAGES/sphinx.mo +0 -0
  121. sphinx/locale/en_DE/LC_MESSAGES/sphinx.po +811 -754
  122. sphinx/locale/en_FR/LC_MESSAGES/sphinx.mo +0 -0
  123. sphinx/locale/en_FR/LC_MESSAGES/sphinx.po +811 -754
  124. sphinx/locale/en_GB/LC_MESSAGES/sphinx.mo +0 -0
  125. sphinx/locale/en_GB/LC_MESSAGES/sphinx.po +856 -799
  126. sphinx/locale/en_HK/LC_MESSAGES/sphinx.mo +0 -0
  127. sphinx/locale/en_HK/LC_MESSAGES/sphinx.po +811 -754
  128. sphinx/locale/eo/LC_MESSAGES/sphinx.mo +0 -0
  129. sphinx/locale/eo/LC_MESSAGES/sphinx.po +820 -763
  130. sphinx/locale/es/LC_MESSAGES/sphinx.mo +0 -0
  131. sphinx/locale/es/LC_MESSAGES/sphinx.po +856 -799
  132. sphinx/locale/es_CO/LC_MESSAGES/sphinx.mo +0 -0
  133. sphinx/locale/es_CO/LC_MESSAGES/sphinx.po +811 -754
  134. sphinx/locale/et/LC_MESSAGES/sphinx.mo +0 -0
  135. sphinx/locale/et/LC_MESSAGES/sphinx.po +845 -788
  136. sphinx/locale/eu/LC_MESSAGES/sphinx.mo +0 -0
  137. sphinx/locale/eu/LC_MESSAGES/sphinx.po +837 -780
  138. sphinx/locale/fa/LC_MESSAGES/sphinx.mo +0 -0
  139. sphinx/locale/fa/LC_MESSAGES/sphinx.po +854 -797
  140. sphinx/locale/fi/LC_MESSAGES/sphinx.mo +0 -0
  141. sphinx/locale/fi/LC_MESSAGES/sphinx.po +816 -759
  142. sphinx/locale/fr/LC_MESSAGES/sphinx.js +1 -1
  143. sphinx/locale/fr/LC_MESSAGES/sphinx.mo +0 -0
  144. sphinx/locale/fr/LC_MESSAGES/sphinx.po +904 -847
  145. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.mo +0 -0
  146. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.po +811 -754
  147. sphinx/locale/gl/LC_MESSAGES/sphinx.js +54 -54
  148. sphinx/locale/gl/LC_MESSAGES/sphinx.mo +0 -0
  149. sphinx/locale/gl/LC_MESSAGES/sphinx.po +1506 -1449
  150. sphinx/locale/he/LC_MESSAGES/sphinx.js +1 -1
  151. sphinx/locale/he/LC_MESSAGES/sphinx.mo +0 -0
  152. sphinx/locale/he/LC_MESSAGES/sphinx.po +823 -766
  153. sphinx/locale/hi/LC_MESSAGES/sphinx.mo +0 -0
  154. sphinx/locale/hi/LC_MESSAGES/sphinx.po +853 -796
  155. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.mo +0 -0
  156. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.po +811 -754
  157. sphinx/locale/hr/LC_MESSAGES/sphinx.mo +0 -0
  158. sphinx/locale/hr/LC_MESSAGES/sphinx.po +844 -787
  159. sphinx/locale/hu/LC_MESSAGES/sphinx.mo +0 -0
  160. sphinx/locale/hu/LC_MESSAGES/sphinx.po +837 -780
  161. sphinx/locale/id/LC_MESSAGES/sphinx.mo +0 -0
  162. sphinx/locale/id/LC_MESSAGES/sphinx.po +854 -797
  163. sphinx/locale/is/LC_MESSAGES/sphinx.mo +0 -0
  164. sphinx/locale/is/LC_MESSAGES/sphinx.po +811 -754
  165. sphinx/locale/it/LC_MESSAGES/sphinx.mo +0 -0
  166. sphinx/locale/it/LC_MESSAGES/sphinx.po +837 -780
  167. sphinx/locale/ja/LC_MESSAGES/sphinx.mo +0 -0
  168. sphinx/locale/ja/LC_MESSAGES/sphinx.po +853 -796
  169. sphinx/locale/ka/LC_MESSAGES/sphinx.mo +0 -0
  170. sphinx/locale/ka/LC_MESSAGES/sphinx.po +848 -791
  171. sphinx/locale/ko/LC_MESSAGES/sphinx.mo +0 -0
  172. sphinx/locale/ko/LC_MESSAGES/sphinx.po +855 -798
  173. sphinx/locale/lt/LC_MESSAGES/sphinx.mo +0 -0
  174. sphinx/locale/lt/LC_MESSAGES/sphinx.po +837 -780
  175. sphinx/locale/lv/LC_MESSAGES/sphinx.mo +0 -0
  176. sphinx/locale/lv/LC_MESSAGES/sphinx.po +837 -780
  177. sphinx/locale/mk/LC_MESSAGES/sphinx.mo +0 -0
  178. sphinx/locale/mk/LC_MESSAGES/sphinx.po +825 -768
  179. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.js +27 -27
  180. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.mo +0 -0
  181. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.po +876 -818
  182. sphinx/locale/ne/LC_MESSAGES/sphinx.mo +0 -0
  183. sphinx/locale/ne/LC_MESSAGES/sphinx.po +837 -780
  184. sphinx/locale/nl/LC_MESSAGES/sphinx.mo +0 -0
  185. sphinx/locale/nl/LC_MESSAGES/sphinx.po +844 -787
  186. sphinx/locale/pl/LC_MESSAGES/sphinx.mo +0 -0
  187. sphinx/locale/pl/LC_MESSAGES/sphinx.po +845 -788
  188. sphinx/locale/pt/LC_MESSAGES/sphinx.mo +0 -0
  189. sphinx/locale/pt/LC_MESSAGES/sphinx.po +811 -754
  190. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +0 -0
  191. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +908 -851
  192. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo +0 -0
  193. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po +837 -780
  194. sphinx/locale/ro/LC_MESSAGES/sphinx.mo +0 -0
  195. sphinx/locale/ro/LC_MESSAGES/sphinx.po +837 -780
  196. sphinx/locale/ru/LC_MESSAGES/sphinx.mo +0 -0
  197. sphinx/locale/ru/LC_MESSAGES/sphinx.po +838 -781
  198. sphinx/locale/si/LC_MESSAGES/sphinx.mo +0 -0
  199. sphinx/locale/si/LC_MESSAGES/sphinx.po +823 -766
  200. sphinx/locale/sk/LC_MESSAGES/sphinx.mo +0 -0
  201. sphinx/locale/sk/LC_MESSAGES/sphinx.po +854 -797
  202. sphinx/locale/sl/LC_MESSAGES/sphinx.mo +0 -0
  203. sphinx/locale/sl/LC_MESSAGES/sphinx.po +832 -775
  204. sphinx/locale/sphinx.pot +813 -755
  205. sphinx/locale/sq/LC_MESSAGES/sphinx.js +1 -1
  206. sphinx/locale/sq/LC_MESSAGES/sphinx.mo +0 -0
  207. sphinx/locale/sq/LC_MESSAGES/sphinx.po +865 -808
  208. sphinx/locale/sr/LC_MESSAGES/sphinx.mo +0 -0
  209. sphinx/locale/sr/LC_MESSAGES/sphinx.po +835 -778
  210. sphinx/locale/sr@latin/LC_MESSAGES/sphinx.mo +0 -0
  211. sphinx/locale/sr_RS/LC_MESSAGES/sphinx.mo +0 -0
  212. sphinx/locale/sv/LC_MESSAGES/sphinx.mo +0 -0
  213. sphinx/locale/sv/LC_MESSAGES/sphinx.po +837 -780
  214. sphinx/locale/ta/LC_MESSAGES/sphinx.js +54 -54
  215. sphinx/locale/ta/LC_MESSAGES/sphinx.mo +0 -0
  216. sphinx/locale/ta/LC_MESSAGES/sphinx.po +1530 -1473
  217. sphinx/locale/te/LC_MESSAGES/sphinx.mo +0 -0
  218. sphinx/locale/te/LC_MESSAGES/sphinx.po +811 -754
  219. sphinx/locale/tr/LC_MESSAGES/sphinx.mo +0 -0
  220. sphinx/locale/tr/LC_MESSAGES/sphinx.po +853 -796
  221. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +0 -0
  222. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +833 -776
  223. sphinx/locale/ur/LC_MESSAGES/sphinx.mo +0 -0
  224. sphinx/locale/ur/LC_MESSAGES/sphinx.po +811 -754
  225. sphinx/locale/vi/LC_MESSAGES/sphinx.mo +0 -0
  226. sphinx/locale/vi/LC_MESSAGES/sphinx.po +837 -780
  227. sphinx/locale/yue/LC_MESSAGES/sphinx.mo +0 -0
  228. sphinx/locale/yue/LC_MESSAGES/sphinx.po +811 -754
  229. sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo +0 -0
  230. sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po +855 -798
  231. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.mo +0 -0
  232. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.po +811 -754
  233. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.js +1 -1
  234. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +0 -0
  235. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +879 -822
  236. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.mo +0 -0
  237. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.po +811 -754
  238. sphinx/parsers.py +7 -5
  239. sphinx/project.py +18 -11
  240. sphinx/pycode/__init__.py +6 -5
  241. sphinx/pycode/ast.py +23 -8
  242. sphinx/pycode/parser.py +6 -5
  243. sphinx/registry.py +12 -6
  244. sphinx/roles.py +103 -57
  245. sphinx/search/__init__.py +17 -18
  246. sphinx/search/da.py +2 -2
  247. sphinx/search/de.py +2 -2
  248. sphinx/search/en.py +1 -1
  249. sphinx/search/es.py +2 -2
  250. sphinx/search/fi.py +2 -2
  251. sphinx/search/fr.py +2 -2
  252. sphinx/search/hu.py +2 -2
  253. sphinx/search/it.py +2 -2
  254. sphinx/search/ja.py +13 -22
  255. sphinx/search/nl.py +2 -2
  256. sphinx/search/no.py +2 -2
  257. sphinx/search/pt.py +2 -2
  258. sphinx/search/ro.py +1 -1
  259. sphinx/search/ru.py +2 -2
  260. sphinx/search/sv.py +2 -2
  261. sphinx/search/tr.py +1 -1
  262. sphinx/search/zh.py +2 -3
  263. sphinx/templates/graphviz/graphviz.css +1 -1
  264. sphinx/testing/fixtures.py +41 -24
  265. sphinx/testing/path.py +1 -1
  266. sphinx/testing/util.py +142 -53
  267. sphinx/texinputs/sphinx.xdy +1 -1
  268. sphinx/texinputs/sphinxlatextables.sty +1 -1
  269. sphinx/texinputs/sphinxpackagesubstitutefont.sty +21 -0
  270. sphinx/themes/agogo/layout.html +4 -4
  271. sphinx/themes/agogo/static/agogo.css_t +1 -1
  272. sphinx/themes/agogo/theme.toml +22 -0
  273. sphinx/themes/basic/defindex.html +1 -1
  274. sphinx/themes/basic/domainindex.html +1 -1
  275. sphinx/themes/basic/genindex-single.html +1 -1
  276. sphinx/themes/basic/genindex-split.html +1 -1
  277. sphinx/themes/basic/genindex.html +1 -1
  278. sphinx/themes/basic/globaltoc.html +1 -1
  279. sphinx/themes/basic/layout.html +1 -1
  280. sphinx/themes/basic/localtoc.html +1 -1
  281. sphinx/themes/basic/page.html +1 -1
  282. sphinx/themes/basic/relations.html +1 -1
  283. sphinx/themes/basic/search.html +5 -20
  284. sphinx/themes/basic/searchbox.html +3 -3
  285. sphinx/themes/basic/searchfield.html +3 -3
  286. sphinx/themes/basic/sourcelink.html +1 -1
  287. sphinx/themes/basic/static/basic.css_t +1 -1
  288. sphinx/themes/basic/static/doctools.js +1 -1
  289. sphinx/themes/basic/static/language_data.js_t +2 -2
  290. sphinx/themes/basic/static/searchtools.js +105 -60
  291. sphinx/themes/basic/theme.toml +23 -0
  292. sphinx/themes/bizstyle/layout.html +1 -6
  293. sphinx/themes/bizstyle/static/bizstyle.css_t +1 -1
  294. sphinx/themes/bizstyle/static/bizstyle.js_t +1 -1
  295. sphinx/themes/bizstyle/static/css3-mediaqueries_src.js +3 -3
  296. sphinx/themes/bizstyle/theme.toml +12 -0
  297. sphinx/themes/classic/layout.html +1 -1
  298. sphinx/themes/classic/static/classic.css_t +1 -1
  299. sphinx/themes/classic/static/sidebar.js_t +1 -1
  300. sphinx/themes/classic/theme.toml +34 -0
  301. sphinx/themes/default/theme.toml +2 -0
  302. sphinx/themes/epub/epub-cover.html +1 -1
  303. sphinx/themes/epub/layout.html +1 -1
  304. sphinx/themes/epub/static/epub.css_t +1 -1
  305. sphinx/themes/epub/theme.toml +10 -0
  306. sphinx/themes/haiku/layout.html +3 -3
  307. sphinx/themes/haiku/static/haiku.css_t +2 -2
  308. sphinx/themes/haiku/theme.toml +16 -0
  309. sphinx/themes/nature/static/nature.css_t +1 -1
  310. sphinx/themes/nature/theme.toml +6 -0
  311. sphinx/themes/nonav/layout.html +1 -1
  312. sphinx/themes/nonav/static/nonav.css_t +1 -1
  313. sphinx/themes/nonav/theme.toml +10 -0
  314. sphinx/themes/pyramid/static/epub.css_t +1 -1
  315. sphinx/themes/pyramid/static/pyramid.css_t +1 -1
  316. sphinx/themes/pyramid/theme.toml +6 -0
  317. sphinx/themes/scrolls/artwork/logo.svg +1 -1
  318. sphinx/themes/scrolls/layout.html +2 -2
  319. sphinx/themes/scrolls/static/scrolls.css_t +1 -1
  320. sphinx/themes/scrolls/theme.toml +15 -0
  321. sphinx/themes/sphinxdoc/static/sphinxdoc.css_t +1 -1
  322. sphinx/themes/sphinxdoc/theme.toml +6 -0
  323. sphinx/themes/traditional/static/traditional.css_t +1 -1
  324. sphinx/themes/traditional/theme.toml +9 -0
  325. sphinx/theming.py +427 -131
  326. sphinx/transforms/__init__.py +21 -24
  327. sphinx/transforms/compact_bullet_list.py +5 -5
  328. sphinx/transforms/i18n.py +30 -28
  329. sphinx/transforms/post_transforms/__init__.py +9 -7
  330. sphinx/transforms/post_transforms/code.py +4 -1
  331. sphinx/transforms/post_transforms/images.py +17 -13
  332. sphinx/transforms/references.py +3 -1
  333. sphinx/util/__init__.py +15 -11
  334. sphinx/util/_io.py +34 -0
  335. sphinx/util/_pathlib.py +23 -18
  336. sphinx/util/build_phase.py +1 -0
  337. sphinx/util/cfamily.py +19 -11
  338. sphinx/util/console.py +101 -21
  339. sphinx/util/display.py +3 -2
  340. sphinx/util/docfields.py +12 -8
  341. sphinx/util/docutils.py +21 -35
  342. sphinx/util/exceptions.py +3 -2
  343. sphinx/util/fileutil.py +5 -5
  344. sphinx/util/http_date.py +9 -2
  345. sphinx/util/i18n.py +40 -9
  346. sphinx/util/inspect.py +317 -245
  347. sphinx/util/inventory.py +22 -5
  348. sphinx/util/logging.py +81 -7
  349. sphinx/util/matching.py +2 -1
  350. sphinx/util/math.py +1 -2
  351. sphinx/util/nodes.py +39 -29
  352. sphinx/util/osutil.py +25 -6
  353. sphinx/util/parallel.py +6 -1
  354. sphinx/util/requests.py +8 -5
  355. sphinx/util/rst.py +8 -6
  356. sphinx/util/tags.py +3 -3
  357. sphinx/util/template.py +8 -3
  358. sphinx/util/typing.py +76 -42
  359. sphinx/versioning.py +6 -2
  360. sphinx/writers/html.py +1 -1
  361. sphinx/writers/html5.py +17 -13
  362. sphinx/writers/latex.py +12 -12
  363. sphinx/writers/manpage.py +13 -7
  364. sphinx/writers/texinfo.py +13 -10
  365. sphinx/writers/text.py +13 -23
  366. sphinx/writers/xml.py +1 -1
  367. sphinx-7.2.5.dist-info/LICENSE → sphinx-7.3.0.dist-info/LICENSE.rst +1 -1
  368. {sphinx-7.2.5.dist-info → sphinx-7.3.0.dist-info}/METADATA +13 -12
  369. sphinx-7.3.0.dist-info/RECORD +581 -0
  370. sphinx/domains/c.py +0 -3906
  371. sphinx/domains/cpp.py +0 -8233
  372. sphinx/domains/python.py +0 -1769
  373. sphinx/themes/agogo/theme.conf +0 -20
  374. sphinx/themes/basic/theme.conf +0 -16
  375. sphinx/themes/bizstyle/theme.conf +0 -10
  376. sphinx/themes/classic/theme.conf +0 -32
  377. sphinx/themes/default/theme.conf +0 -2
  378. sphinx/themes/epub/theme.conf +0 -8
  379. sphinx/themes/haiku/theme.conf +0 -14
  380. sphinx/themes/nature/theme.conf +0 -4
  381. sphinx/themes/nonav/theme.conf +0 -8
  382. sphinx/themes/pyramid/theme.conf +0 -4
  383. sphinx/themes/scrolls/theme.conf +0 -13
  384. sphinx/themes/sphinxdoc/theme.conf +0 -4
  385. sphinx/themes/traditional/theme.conf +0 -7
  386. sphinx-7.2.5.dist-info/RECORD +0 -569
  387. {sphinx-7.2.5.dist-info → sphinx-7.3.0.dist-info}/WHEEL +0 -0
  388. {sphinx-7.2.5.dist-info → sphinx-7.3.0.dist-info}/entry_points.txt +0 -0
sphinx/deprecation.py CHANGED
@@ -19,23 +19,32 @@ RemovedInNextVersionWarning = RemovedInSphinx80Warning
19
19
  def _deprecation_warning(
20
20
  module: str,
21
21
  attribute: str,
22
- canonical_name: str,
22
+ canonical_name: str = '',
23
23
  *,
24
24
  remove: tuple[int, int],
25
+ raises: bool = False,
25
26
  ) -> None:
26
- """Helper function for module-level deprecations using __getattr__
27
+ """Helper function for module-level deprecations using ``__getattr__``.
27
28
 
28
- Exemplar usage:
29
+ :param module: The module containing a deprecated object.
30
+ :param attribute: The name of the deprecated object.
31
+ :param canonical_name: Optional fully-qualified name for its replacement.
32
+ :param remove: Target version for removal.
33
+ :param raises: Indicate whether to raise an exception instead of a warning.
29
34
 
30
- .. code:: python
35
+ When *raises* is ``True``, an :exc:`AttributeError` is raised instead
36
+ of emitting a warning so that it is easy to locate deprecated objects
37
+ in tests that could suppress deprecation warnings.
31
38
 
32
- # deprecated name -> (object to return, canonical path or empty string)
39
+ Usage::
40
+
41
+ # deprecated name -> (object to return, canonical path or empty string, removal version)
33
42
  _DEPRECATED_OBJECTS = {
34
43
  'deprecated_name': (object_to_return, 'fully_qualified_replacement_name', (8, 0)),
35
44
  }
36
45
 
37
46
 
38
- def __getattr__(name):
47
+ def __getattr__(name: str) -> Any:
39
48
  if name not in _DEPRECATED_OBJECTS:
40
49
  msg = f'module {__name__!r} has no attribute {name!r}'
41
50
  raise AttributeError(msg)
@@ -46,7 +55,6 @@ def _deprecation_warning(
46
55
  _deprecation_warning(__name__, name, canonical_name, remove=remove)
47
56
  return deprecated_object
48
57
  """
49
-
50
58
  if remove == (8, 0):
51
59
  warning_class: type[Warning] = RemovedInSphinx80Warning
52
60
  elif remove == (9, 0):
@@ -55,12 +63,14 @@ def _deprecation_warning(
55
63
  msg = f'removal version {remove!r} is invalid!'
56
64
  raise RuntimeError(msg)
57
65
 
58
- qualified_name = f'{module}.{attribute}'
66
+ qualname = f'{module}.{attribute}'
59
67
  if canonical_name:
60
- message = (f'The alias {qualified_name!r} is deprecated, '
61
- f'use {canonical_name!r} instead.')
68
+ message = f'The alias {qualname!r} is deprecated, use {canonical_name!r} instead.'
62
69
  else:
63
- message = f'{qualified_name!r} is deprecated.'
70
+ message = f'{qualname!r} is deprecated.'
71
+
72
+ if raises:
73
+ raise AttributeError(message)
64
74
 
65
- warnings.warn(message + " Check CHANGES for Sphinx API modifications.",
66
- warning_class, stacklevel=3)
75
+ message = f'{message} Check CHANGES for Sphinx API modifications.'
76
+ warnings.warn(message, warning_class, stacklevel=3)
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import re
6
- from typing import TYPE_CHECKING, Any, Generic, TypeVar, cast
6
+ from typing import TYPE_CHECKING, ClassVar, Generic, TypeVar, cast
7
7
 
8
8
  from docutils import nodes
9
9
  from docutils.parsers.rst import directives, roles
@@ -14,7 +14,7 @@ from sphinx.util import docutils
14
14
  from sphinx.util.docfields import DocFieldTransformer, Field, TypedField
15
15
  from sphinx.util.docutils import SphinxDirective
16
16
  from sphinx.util.nodes import nested_parse_with_titles
17
- from sphinx.util.typing import OptionSpec # NoQA: TCH001
17
+ from sphinx.util.typing import ExtensionMetadata, OptionSpec # NoQA: TCH001
18
18
 
19
19
  if TYPE_CHECKING:
20
20
  from docutils.nodes import Node
@@ -55,7 +55,7 @@ class ObjectDescription(SphinxDirective, Generic[ObjDescT]):
55
55
  required_arguments = 1
56
56
  optional_arguments = 0
57
57
  final_argument_whitespace = True
58
- option_spec: OptionSpec = {
58
+ option_spec: ClassVar[OptionSpec] = {
59
59
  'no-index': directives.flag,
60
60
  'no-index-entry': directives.flag,
61
61
  'no-contents-entry': directives.flag,
@@ -118,7 +118,7 @@ class ObjectDescription(SphinxDirective, Generic[ObjDescT]):
118
118
 
119
119
  *name* is whatever :meth:`handle_signature()` returned.
120
120
  """
121
- return # do nothing by default
121
+ pass # do nothing by default
122
122
 
123
123
  def before_content(self) -> None:
124
124
  """
@@ -296,7 +296,7 @@ class ObjectDescription(SphinxDirective, Generic[ObjDescT]):
296
296
  # If ``:no-index:`` is set, or there are no ids on the node
297
297
  # or any of its children, then just return the index node,
298
298
  # as Docutils expects a target node to have at least one id.
299
- if node_ids := [node_id for el in node.findall(nodes.Element)
299
+ if node_ids := [node_id for el in node.findall(nodes.Element) # type: ignore[var-annotated]
300
300
  for node_id in el.get('ids', ())]:
301
301
  target_node = nodes.target(ids=node_ids)
302
302
  self.set_source_info(target_node)
@@ -320,7 +320,7 @@ class DefaultRole(SphinxDirective):
320
320
  role_name = self.arguments[0]
321
321
  role, messages = roles.role(role_name, self.state_machine.language,
322
322
  self.lineno, self.state.reporter)
323
- if role: # type: ignore[truthy-function]
323
+ if role:
324
324
  docutils.register_role('', role) # type: ignore[arg-type]
325
325
  self.env.temp_data['default_role'] = role_name
326
326
  else:
@@ -342,7 +342,7 @@ class DefaultDomain(SphinxDirective):
342
342
  required_arguments = 1
343
343
  optional_arguments = 0
344
344
  final_argument_whitespace = False
345
- option_spec: OptionSpec = {}
345
+ option_spec: ClassVar[OptionSpec] = {}
346
346
 
347
347
  def run(self) -> list[Node]:
348
348
  domain_name = self.arguments[0].lower()
@@ -356,7 +356,7 @@ class DefaultDomain(SphinxDirective):
356
356
  return []
357
357
 
358
358
 
359
- def setup(app: Sphinx) -> dict[str, Any]:
359
+ def setup(app: Sphinx) -> ExtensionMetadata:
360
360
  app.add_config_value("strip_signature_backslash", False, 'env')
361
361
  directives.register_directive('default-role', DefaultRole)
362
362
  directives.register_directive('default-domain', DefaultDomain)
sphinx/directives/code.py CHANGED
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  import sys
4
4
  import textwrap
5
5
  from difflib import unified_diff
6
- from typing import TYPE_CHECKING, Any
6
+ from typing import TYPE_CHECKING, Any, ClassVar
7
7
 
8
8
  from docutils import nodes
9
9
  from docutils.parsers.rst import directives
@@ -20,7 +20,7 @@ if TYPE_CHECKING:
20
20
 
21
21
  from sphinx.application import Sphinx
22
22
  from sphinx.config import Config
23
- from sphinx.util.typing import OptionSpec
23
+ from sphinx.util.typing import ExtensionMetadata, OptionSpec
24
24
 
25
25
  logger = logging.getLogger(__name__)
26
26
 
@@ -35,7 +35,7 @@ class Highlight(SphinxDirective):
35
35
  required_arguments = 1
36
36
  optional_arguments = 0
37
37
  final_argument_whitespace = False
38
- option_spec: OptionSpec = {
38
+ option_spec: ClassVar[OptionSpec] = {
39
39
  'force': directives.flag,
40
40
  'linenothreshold': directives.positive_int,
41
41
  }
@@ -102,7 +102,7 @@ class CodeBlock(SphinxDirective):
102
102
  required_arguments = 0
103
103
  optional_arguments = 1
104
104
  final_argument_whitespace = False
105
- option_spec: OptionSpec = {
105
+ option_spec: ClassVar[OptionSpec] = {
106
106
  'force': directives.flag,
107
107
  'linenos': directives.flag,
108
108
  'dedent': optional_int,
@@ -287,7 +287,7 @@ class LiteralIncludeReader:
287
287
  'set of "lines"'))
288
288
 
289
289
  lines = [lines[n] for n in linelist if n < len(lines)]
290
- if lines == []:
290
+ if not lines:
291
291
  raise ValueError(__('Line spec %r: no lines pulled from include file %r') %
292
292
  (linespec, self.filename))
293
293
 
@@ -393,7 +393,7 @@ class LiteralInclude(SphinxDirective):
393
393
  required_arguments = 1
394
394
  optional_arguments = 0
395
395
  final_argument_whitespace = True
396
- option_spec: OptionSpec = {
396
+ option_spec: ClassVar[OptionSpec] = {
397
397
  'dedent': optional_int,
398
398
  'linenos': directives.flag,
399
399
  'lineno-start': int,
@@ -469,7 +469,7 @@ class LiteralInclude(SphinxDirective):
469
469
  return [document.reporter.warning(exc, line=self.lineno)]
470
470
 
471
471
 
472
- def setup(app: Sphinx) -> dict[str, Any]:
472
+ def setup(app: Sphinx) -> ExtensionMetadata:
473
473
  directives.register_directive('highlight', Highlight)
474
474
  directives.register_directive('code-block', CodeBlock)
475
475
  directives.register_directive('sourcecode', CodeBlock)
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  import re
4
4
  from os.path import abspath, relpath
5
5
  from pathlib import Path
6
- from typing import TYPE_CHECKING, Any, cast
6
+ from typing import TYPE_CHECKING, Any, ClassVar, cast
7
7
 
8
8
  from docutils import nodes
9
9
  from docutils.parsers.rst import directives
@@ -13,7 +13,7 @@ from docutils.parsers.rst.directives.misc import Include as BaseInclude
13
13
  from docutils.statemachine import StateMachine
14
14
 
15
15
  from sphinx import addnodes
16
- from sphinx.domains.changeset import VersionChange # noqa: F401 # for compatibility
16
+ from sphinx.domains.changeset import VersionChange # NoQA: F401 # for compatibility
17
17
  from sphinx.domains.std import StandardDomain
18
18
  from sphinx.locale import _, __
19
19
  from sphinx.util import docname_join, logging, url_re
@@ -22,10 +22,12 @@ from sphinx.util.matching import Matcher, patfilter
22
22
  from sphinx.util.nodes import explicit_title_re
23
23
 
24
24
  if TYPE_CHECKING:
25
+ from collections.abc import Sequence
26
+
25
27
  from docutils.nodes import Element, Node
26
28
 
27
29
  from sphinx.application import Sphinx
28
- from sphinx.util.typing import OptionSpec
30
+ from sphinx.util.typing import ExtensionMetadata, OptionSpec
29
31
 
30
32
 
31
33
  glob_re = re.compile(r'.*[*?\[].*')
@@ -43,6 +45,7 @@ class TocTree(SphinxDirective):
43
45
  Directive to notify Sphinx about the hierarchical structure of the docs,
44
46
  and to include a table-of-contents like tree in the current document.
45
47
  """
48
+
46
49
  has_content = True
47
50
  required_arguments = 0
48
51
  optional_arguments = 0
@@ -173,11 +176,12 @@ class Author(SphinxDirective):
173
176
  Directive to give the name of the author of the current document
174
177
  or section. Shown in the output only if the show_authors option is on.
175
178
  """
179
+
176
180
  has_content = False
177
181
  required_arguments = 1
178
182
  optional_arguments = 0
179
183
  final_argument_whitespace = True
180
- option_spec: OptionSpec = {}
184
+ option_spec: ClassVar[OptionSpec] = {}
181
185
 
182
186
  def run(self) -> list[Node]:
183
187
  if not self.config.show_authors:
@@ -206,6 +210,7 @@ class SeeAlso(BaseAdmonition):
206
210
  """
207
211
  An admonition mentioning things to look at as reference.
208
212
  """
213
+
209
214
  node_class = addnodes.seealso
210
215
 
211
216
 
@@ -213,11 +218,12 @@ class TabularColumns(SphinxDirective):
213
218
  """
214
219
  Directive to give an explicit tabulary column definition to LaTeX.
215
220
  """
221
+
216
222
  has_content = False
217
223
  required_arguments = 1
218
224
  optional_arguments = 0
219
225
  final_argument_whitespace = True
220
- option_spec: OptionSpec = {}
226
+ option_spec: ClassVar[OptionSpec] = {}
221
227
 
222
228
  def run(self) -> list[Node]:
223
229
  node = addnodes.tabular_col_spec()
@@ -230,11 +236,12 @@ class Centered(SphinxDirective):
230
236
  """
231
237
  Directive to create a centered line of bold text.
232
238
  """
239
+
233
240
  has_content = False
234
241
  required_arguments = 1
235
242
  optional_arguments = 0
236
243
  final_argument_whitespace = True
237
- option_spec: OptionSpec = {}
244
+ option_spec: ClassVar[OptionSpec] = {}
238
245
 
239
246
  def run(self) -> list[Node]:
240
247
  if not self.arguments:
@@ -252,11 +259,12 @@ class Acks(SphinxDirective):
252
259
  """
253
260
  Directive for a list of names.
254
261
  """
262
+
255
263
  has_content = True
256
264
  required_arguments = 0
257
265
  optional_arguments = 0
258
266
  final_argument_whitespace = False
259
- option_spec: OptionSpec = {}
267
+ option_spec: ClassVar[OptionSpec] = {}
260
268
 
261
269
  def run(self) -> list[Node]:
262
270
  node = addnodes.acks()
@@ -274,11 +282,12 @@ class HList(SphinxDirective):
274
282
  """
275
283
  Directive for a list that gets compacted horizontally.
276
284
  """
285
+
277
286
  has_content = True
278
287
  required_arguments = 0
279
288
  optional_arguments = 0
280
289
  final_argument_whitespace = False
281
- option_spec: OptionSpec = {
290
+ option_spec: ClassVar[OptionSpec] = {
282
291
  'columns': int,
283
292
  }
284
293
 
@@ -311,11 +320,12 @@ class Only(SphinxDirective):
311
320
  """
312
321
  Directive to only include text if the given tag(s) are enabled.
313
322
  """
323
+
314
324
  has_content = True
315
325
  required_arguments = 1
316
326
  optional_arguments = 0
317
327
  final_argument_whitespace = True
318
- option_spec: OptionSpec = {}
328
+ option_spec: ClassVar[OptionSpec] = {}
319
329
 
320
330
  def run(self) -> list[Node]:
321
331
  node = addnodes.only()
@@ -371,14 +381,14 @@ class Include(BaseInclude, SphinxDirective):
371
381
  "correctly", i.e. relative to source directory.
372
382
  """
373
383
 
374
- def run(self) -> list[Node]:
384
+ def run(self) -> Sequence[Node]:
375
385
 
376
386
  # To properly emit "include-read" events from included RST text,
377
387
  # we must patch the ``StateMachine.insert_input()`` method.
378
388
  # In the future, docutils will hopefully offer a way for Sphinx
379
389
  # to provide the RST parser to use
380
390
  # when parsing RST text that comes in via Include directive.
381
- def _insert_input(include_lines, source):
391
+ def _insert_input(include_lines: list[str], source: str) -> None:
382
392
  # First, we need to combine the lines back into text so that
383
393
  # we can send it with the include-read event.
384
394
  # In docutils 0.18 and later, there are two lines at the end
@@ -405,7 +415,7 @@ class Include(BaseInclude, SphinxDirective):
405
415
  # Only enable this patch if there are listeners for 'include-read'.
406
416
  if self.env.app.events.listeners.get('include-read'):
407
417
  # See https://github.com/python/mypy/issues/2427 for details on the mypy issue
408
- self.state_machine.insert_input = _insert_input # type: ignore[method-assign]
418
+ self.state_machine.insert_input = _insert_input
409
419
 
410
420
  if self.arguments[0].startswith('<') and \
411
421
  self.arguments[0].endswith('>'):
@@ -417,7 +427,7 @@ class Include(BaseInclude, SphinxDirective):
417
427
  return super().run()
418
428
 
419
429
 
420
- def setup(app: Sphinx) -> dict[str, Any]:
430
+ def setup(app: Sphinx) -> ExtensionMetadata:
421
431
  directives.register_directive('toctree', TocTree)
422
432
  directives.register_directive('sectionauthor', Author)
423
433
  directives.register_directive('moduleauthor', Author)
@@ -2,13 +2,13 @@ from __future__ import annotations
2
2
 
3
3
  import os
4
4
  from os import path
5
- from typing import TYPE_CHECKING, Any, cast
5
+ from typing import TYPE_CHECKING, ClassVar, cast
6
6
 
7
7
  from docutils import nodes
8
8
  from docutils.nodes import Node, make_id
9
9
  from docutils.parsers.rst import directives
10
10
  from docutils.parsers.rst.directives import images, tables
11
- from docutils.parsers.rst.directives.misc import Meta # type: ignore[attr-defined]
11
+ from docutils.parsers.rst.directives.misc import Meta
12
12
  from docutils.parsers.rst.roles import set_classes
13
13
 
14
14
  from sphinx.directives import optional_int
@@ -21,7 +21,7 @@ from sphinx.util.osutil import SEP, os_path, relpath
21
21
 
22
22
  if TYPE_CHECKING:
23
23
  from sphinx.application import Sphinx
24
- from sphinx.util.typing import OptionSpec
24
+ from sphinx.util.typing import ExtensionMetadata, OptionSpec
25
25
 
26
26
 
27
27
  logger = logging.getLogger(__name__)
@@ -80,8 +80,9 @@ class Code(SphinxDirective):
80
80
 
81
81
  This is compatible with docutils' :rst:dir:`code` directive.
82
82
  """
83
+
83
84
  optional_arguments = 1
84
- option_spec: OptionSpec = {
85
+ option_spec: ClassVar[OptionSpec] = {
85
86
  'class': directives.class_option,
86
87
  'force': directives.flag,
87
88
  'name': directives.unchanged,
@@ -126,7 +127,7 @@ class MathDirective(SphinxDirective):
126
127
  required_arguments = 0
127
128
  optional_arguments = 1
128
129
  final_argument_whitespace = True
129
- option_spec: OptionSpec = {
130
+ option_spec: ClassVar[OptionSpec] = {
130
131
  'label': directives.unchanged,
131
132
  'name': directives.unchanged,
132
133
  'class': directives.class_option,
@@ -175,7 +176,7 @@ class MathDirective(SphinxDirective):
175
176
  ret.insert(0, target)
176
177
 
177
178
 
178
- def setup(app: Sphinx) -> dict[str, Any]:
179
+ def setup(app: Sphinx) -> ExtensionMetadata:
179
180
  directives.register_directive('figure', Figure)
180
181
  directives.register_directive('meta', Meta)
181
182
  directives.register_directive('csv-table', CSVTable)
@@ -93,7 +93,7 @@ class Index(ABC):
93
93
  shortname: str | None = None
94
94
 
95
95
  def __init__(self, domain: Domain) -> None:
96
- if self.name is None or self.localname is None:
96
+ if not self.name or self.localname is None:
97
97
  raise SphinxError('Index subclass %s has no valid name or localname'
98
98
  % self.__class__.__name__)
99
99
  self.domain = domain
@@ -296,7 +296,7 @@ class Domain:
296
296
  """Remove traces of a document in the domain-specific inventories."""
297
297
  pass
298
298
 
299
- def merge_domaindata(self, docnames: list[str], otherdata: dict) -> None:
299
+ def merge_domaindata(self, docnames: list[str], otherdata: dict[str, Any]) -> None:
300
300
  """Merge in data regarding *docnames* from a different domaindata
301
301
  inventory (coming from a subprocess in parallel builds).
302
302
  """