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/util/docutils.py CHANGED
@@ -27,7 +27,7 @@ logger = logging.getLogger(__name__)
27
27
  report_re = re.compile('^(.+?:(?:\\d+)?): \\((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\\d+)?\\) ')
28
28
 
29
29
  if TYPE_CHECKING:
30
- from collections.abc import Generator
30
+ from collections.abc import Iterator
31
31
  from types import ModuleType
32
32
 
33
33
  from docutils.frontend import Values
@@ -38,29 +38,12 @@ if TYPE_CHECKING:
38
38
  from sphinx.environment import BuildEnvironment
39
39
  from sphinx.util.typing import RoleFunction
40
40
 
41
- # deprecated name -> (object to return, canonical path or empty string)
42
- _DEPRECATED_OBJECTS = {
43
- '__version_info__': (docutils.__version_info__, 'docutils.__version_info__'),
44
- }
45
-
46
-
47
- def __getattr__(name):
48
- if name not in _DEPRECATED_OBJECTS:
49
- msg = f'module {__name__!r} has no attribute {name!r}'
50
- raise AttributeError(msg)
51
-
52
- from sphinx.deprecation import _deprecation_warning
53
-
54
- deprecated_object, canonical_name = _DEPRECATED_OBJECTS[name]
55
- _deprecation_warning(__name__, name, canonical_name, remove=(7, 0))
56
- return deprecated_object
57
-
58
41
 
59
42
  additional_nodes: set[type[Element]] = set()
60
43
 
61
44
 
62
45
  @contextmanager
63
- def docutils_namespace() -> Generator[None, None, None]:
46
+ def docutils_namespace() -> Iterator[None]:
64
47
  """Create namespace for reST parsers."""
65
48
  try:
66
49
  _directives = copy(directives._directives) # type: ignore[attr-defined]
@@ -101,7 +84,7 @@ def register_role(name: str, role: RoleFunction) -> None:
101
84
  This modifies global state of docutils. So it is better to use this
102
85
  inside ``docutils_namespace()`` to prevent side-effects.
103
86
  """
104
- roles.register_local_role(name, role)
87
+ roles.register_local_role(name, role) # type: ignore[arg-type]
105
88
 
106
89
 
107
90
  def unregister_role(name: str) -> None:
@@ -138,7 +121,7 @@ def unregister_node(node: type[Element]) -> None:
138
121
 
139
122
 
140
123
  @contextmanager
141
- def patched_get_language() -> Generator[None, None, None]:
124
+ def patched_get_language() -> Iterator[None]:
142
125
  """Patch docutils.languages.get_language() temporarily.
143
126
 
144
127
  This ignores the second argument ``reporter`` to suppress warnings.
@@ -150,7 +133,7 @@ def patched_get_language() -> Generator[None, None, None]:
150
133
  return get_language(language_code)
151
134
 
152
135
  try:
153
- docutils.languages.get_language = patched_get_language
136
+ docutils.languages.get_language = patched_get_language # type: ignore[assignment]
154
137
  yield
155
138
  finally:
156
139
  # restore original implementations
@@ -158,7 +141,7 @@ def patched_get_language() -> Generator[None, None, None]:
158
141
 
159
142
 
160
143
  @contextmanager
161
- def patched_rst_get_language() -> Generator[None, None, None]:
144
+ def patched_rst_get_language() -> Iterator[None]:
162
145
  """Patch docutils.parsers.rst.languages.get_language().
163
146
  Starting from docutils 0.17, get_language() in ``rst.languages``
164
147
  also has a reporter, which needs to be disabled temporarily.
@@ -174,7 +157,7 @@ def patched_rst_get_language() -> Generator[None, None, None]:
174
157
  return get_language(language_code)
175
158
 
176
159
  try:
177
- docutils.parsers.rst.languages.get_language = patched_get_language
160
+ docutils.parsers.rst.languages.get_language = patched_get_language # type: ignore[assignment]
178
161
  yield
179
162
  finally:
180
163
  # restore original implementations
@@ -182,7 +165,7 @@ def patched_rst_get_language() -> Generator[None, None, None]:
182
165
 
183
166
 
184
167
  @contextmanager
185
- def using_user_docutils_conf(confdir: str | None) -> Generator[None, None, None]:
168
+ def using_user_docutils_conf(confdir: str | None) -> Iterator[None]:
186
169
  """Let docutils know the location of ``docutils.conf`` for Sphinx."""
187
170
  try:
188
171
  docutilsconfig = os.environ.get('DOCUTILSCONFIG', None)
@@ -198,8 +181,8 @@ def using_user_docutils_conf(confdir: str | None) -> Generator[None, None, None]
198
181
 
199
182
 
200
183
  @contextmanager
201
- def du19_footnotes() -> Generator[None, None, None]:
202
- def visit_footnote(self, node):
184
+ def du19_footnotes() -> Iterator[None]:
185
+ def visit_footnote(self: HTMLTranslator, node: Element) -> None:
203
186
  label_style = self.settings.footnote_references
204
187
  if not isinstance(node.previous_sibling(), type(node)):
205
188
  self.body.append(f'<aside class="footnote-list {label_style}">\n')
@@ -207,7 +190,7 @@ def du19_footnotes() -> Generator[None, None, None]:
207
190
  classes=[node.tagname, label_style],
208
191
  role="note"))
209
192
 
210
- def depart_footnote(self, node):
193
+ def depart_footnote(self: HTMLTranslator, node: Element) -> None:
211
194
  self.body.append('</aside>\n')
212
195
  if not isinstance(node.next_node(descend=False, siblings=True),
213
196
  type(node)):
@@ -231,7 +214,7 @@ def du19_footnotes() -> Generator[None, None, None]:
231
214
 
232
215
 
233
216
  @contextmanager
234
- def patch_docutils(confdir: str | None = None) -> Generator[None, None, None]:
217
+ def patch_docutils(confdir: str | None = None) -> Iterator[None]:
235
218
  """Patch to docutils temporarily."""
236
219
  with patched_get_language(), \
237
220
  patched_rst_get_language(), \
@@ -263,8 +246,8 @@ class CustomReSTDispatcher:
263
246
  self.directive_func = directives.directive
264
247
  self.role_func = roles.role
265
248
 
266
- directives.directive = self.directive
267
- roles.role = self.role
249
+ directives.directive = self.directive # type: ignore[assignment]
250
+ roles.role = self.role # type: ignore[assignment]
268
251
 
269
252
  def disable(self) -> None:
270
253
  directives.directive = self.directive_func
@@ -290,6 +273,7 @@ class sphinx_domains(CustomReSTDispatcher):
290
273
  """Monkey-patch directive and role dispatch, so that domain-specific
291
274
  markup takes precedence.
292
275
  """
276
+
293
277
  def __init__(self, env: BuildEnvironment) -> None:
294
278
  self.env = env
295
279
  super().__init__()
@@ -354,7 +338,7 @@ class WarningStream:
354
338
 
355
339
  class LoggingReporter(Reporter):
356
340
  @classmethod
357
- def from_reporter(cls, reporter: Reporter) -> LoggingReporter:
341
+ def from_reporter(cls: type[LoggingReporter], reporter: Reporter) -> LoggingReporter:
358
342
  """Create an instance of LoggingReporter from other reporter object."""
359
343
  return cls(reporter.source, reporter.report_level, reporter.halt_level,
360
344
  reporter.debug_flag, reporter.error_handler)
@@ -375,16 +359,16 @@ class NullReporter(Reporter):
375
359
 
376
360
 
377
361
  @contextmanager
378
- def switch_source_input(state: State, content: StringList) -> Generator[None, None, None]:
362
+ def switch_source_input(state: State, content: StringList) -> Iterator[None]:
379
363
  """Switch current source input of state temporarily."""
380
364
  try:
381
365
  # remember the original ``get_source_and_line()`` method
382
366
  gsal = state.memo.reporter.get_source_and_line # type: ignore[attr-defined]
383
367
 
384
368
  # replace it by new one
385
- state_machine = StateMachine([], None) # type: ignore[arg-type]
369
+ state_machine: StateMachine[None] = StateMachine([], None) # type: ignore[arg-type]
386
370
  state_machine.input_lines = content
387
- state.memo.reporter.get_source_and_line = state_machine.get_source_and_line # type: ignore[attr-defined] # noqa: E501
371
+ state.memo.reporter.get_source_and_line = state_machine.get_source_and_line # type: ignore[attr-defined] # NoQA: E501
388
372
 
389
373
  yield
390
374
  finally:
@@ -451,6 +435,7 @@ class SphinxRole:
451
435
  .. note:: The subclasses of this class might not work with docutils.
452
436
  This class is strongly coupled with Sphinx.
453
437
  """
438
+
454
439
  name: str #: The role name actually used in the document.
455
440
  rawtext: str #: A string containing the entire interpreted text input.
456
441
  text: str #: The interpreted text content.
@@ -519,6 +504,7 @@ class ReferenceRole(SphinxRole):
519
504
  the role. The parsed result; link title and target will be stored to
520
505
  ``self.title`` and ``self.target``.
521
506
  """
507
+
522
508
  has_explicit_title: bool #: A boolean indicates the role has explicit title or not.
523
509
  disabled: bool #: A boolean indicates the reference is disabled.
524
510
  title: str #: The link title for the interpreted text.
sphinx/util/exceptions.py CHANGED
@@ -6,7 +6,7 @@ from tempfile import NamedTemporaryFile
6
6
  from typing import TYPE_CHECKING
7
7
 
8
8
  from sphinx.errors import SphinxParallelError
9
- from sphinx.util.console import strip_colors
9
+ from sphinx.util.console import strip_escape_sequences
10
10
 
11
11
  if TYPE_CHECKING:
12
12
  from sphinx.application import Sphinx
@@ -31,7 +31,8 @@ def save_traceback(app: Sphinx | None, exc: BaseException) -> str:
31
31
  last_msgs = exts_list = ''
32
32
  else:
33
33
  extensions = app.extensions.values()
34
- last_msgs = '\n'.join(f'# {strip_colors(s).strip()}' for s in app.messagelog)
34
+ last_msgs = '\n'.join(f'# {strip_escape_sequences(s).strip()}'
35
+ for s in app.messagelog)
35
36
  exts_list = '\n'.join(f'# {ext.name} ({ext.version})' for ext in extensions
36
37
  if ext.version != 'builtin')
37
38
 
sphinx/util/fileutil.py CHANGED
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import os
6
6
  import posixpath
7
- from typing import TYPE_CHECKING, Callable
7
+ from typing import TYPE_CHECKING, Any, Callable
8
8
 
9
9
  from docutils.utils import relative_path
10
10
 
@@ -16,7 +16,7 @@ if TYPE_CHECKING:
16
16
 
17
17
 
18
18
  def copy_asset_file(source: str | os.PathLike[str], destination: str | os.PathLike[str],
19
- context: dict | None = None,
19
+ context: dict[str, Any] | None = None,
20
20
  renderer: BaseRenderer | None = None) -> None:
21
21
  """Copy an asset file to destination.
22
22
 
@@ -53,7 +53,7 @@ def copy_asset_file(source: str | os.PathLike[str], destination: str | os.PathLi
53
53
 
54
54
  def copy_asset(source: str | os.PathLike[str], destination: str | os.PathLike[str],
55
55
  excluded: PathMatcher = lambda path: False,
56
- context: dict | None = None, renderer: BaseRenderer | None = None,
56
+ context: dict[str, Any] | None = None, renderer: BaseRenderer | None = None,
57
57
  onerror: Callable[[str, Exception], None] | None = None) -> None:
58
58
  """Copy asset files to destination recursively.
59
59
 
@@ -80,8 +80,8 @@ def copy_asset(source: str | os.PathLike[str], destination: str | os.PathLike[st
80
80
  return
81
81
 
82
82
  for root, dirs, files in os.walk(source, followlinks=True):
83
- reldir = relative_path(source, root) # type: ignore[arg-type]
84
- for dir in dirs[:]:
83
+ reldir = relative_path(source, root)
84
+ for dir in dirs.copy():
85
85
  if excluded(posixpath.join(reldir, dir)):
86
86
  dirs.remove(dir)
87
87
  else:
sphinx/util/http_date.py CHANGED
@@ -5,16 +5,23 @@ Reference: https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1
5
5
 
6
6
  import time
7
7
  import warnings
8
- from email.utils import formatdate, parsedate_tz
8
+ from email.utils import parsedate_tz
9
9
 
10
10
  from sphinx.deprecation import RemovedInSphinx90Warning
11
11
 
12
+ _WEEKDAY_NAME = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')
13
+ _MONTH_NAME = ('', # Placeholder for indexing purposes
14
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
15
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')
12
16
  _GMT_OFFSET = float(time.localtime().tm_gmtoff)
13
17
 
14
18
 
15
19
  def epoch_to_rfc1123(epoch: float) -> str:
16
20
  """Return HTTP-date string from epoch offset."""
17
- return formatdate(epoch, usegmt=True)
21
+ yr, mn, dd, hh, mm, ss, wd, _yd, _tz = time.gmtime(epoch)
22
+ weekday_name = _WEEKDAY_NAME[wd]
23
+ month = _MONTH_NAME[mn]
24
+ return f'{weekday_name}, {dd:02} {month} {yr:04} {hh:02}:{mm:02}:{ss:02} GMT'
18
25
 
19
26
 
20
27
  def rfc1123_to_epoch(rfc1123: str) -> float:
sphinx/util/i18n.py CHANGED
@@ -6,7 +6,7 @@ import os
6
6
  import re
7
7
  from datetime import datetime, timezone
8
8
  from os import path
9
- from typing import TYPE_CHECKING, Callable, NamedTuple
9
+ from typing import TYPE_CHECKING, NamedTuple
10
10
 
11
11
  import babel.dates
12
12
  from babel.messages.mofile import write_mo
@@ -18,10 +18,41 @@ from sphinx.util import logging
18
18
  from sphinx.util.osutil import SEP, canon_path, relpath
19
19
 
20
20
  if TYPE_CHECKING:
21
- from collections.abc import Generator
21
+ import datetime as dt
22
+ from collections.abc import Iterator
23
+ from typing import Protocol, Union
24
+
25
+ from babel.core import Locale
22
26
 
23
27
  from sphinx.environment import BuildEnvironment
24
28
 
29
+ class DateFormatter(Protocol):
30
+ def __call__( # NoQA: E704
31
+ self,
32
+ date: dt.date | None = ...,
33
+ format: str = ...,
34
+ locale: str | Locale | None = ...,
35
+ ) -> str: ...
36
+
37
+ class TimeFormatter(Protocol):
38
+ def __call__( # NoQA: E704
39
+ self,
40
+ time: dt.time | dt.datetime | float | None = ...,
41
+ format: str = ...,
42
+ tzinfo: dt.tzinfo | None = ...,
43
+ locale: str | Locale | None = ...,
44
+ ) -> str: ...
45
+
46
+ class DatetimeFormatter(Protocol):
47
+ def __call__( # NoQA: E704
48
+ self,
49
+ datetime: dt.date | dt.time | float | None = ...,
50
+ format: str = ...,
51
+ tzinfo: dt.tzinfo | None = ...,
52
+ locale: str | Locale | None = ...,
53
+ ) -> str: ...
54
+
55
+ Formatter = Union[DateFormatter, TimeFormatter, DatetimeFormatter]
25
56
 
26
57
  logger = logging.getLogger(__name__)
27
58
 
@@ -81,7 +112,7 @@ class CatalogRepository:
81
112
  self.encoding = encoding
82
113
 
83
114
  @property
84
- def locale_dirs(self) -> Generator[str, None, None]:
115
+ def locale_dirs(self) -> Iterator[str]:
85
116
  if not self.language:
86
117
  return
87
118
 
@@ -94,14 +125,13 @@ class CatalogRepository:
94
125
  logger.verbose(__('locale_dir %s does not exist'), locale_path)
95
126
 
96
127
  @property
97
- def pofiles(self) -> Generator[tuple[str, str], None, None]:
128
+ def pofiles(self) -> Iterator[tuple[str, str]]:
98
129
  for locale_dir in self.locale_dirs:
99
130
  basedir = path.join(locale_dir, self.language, 'LC_MESSAGES')
100
131
  for root, dirnames, filenames in os.walk(basedir):
101
132
  # skip dot-directories
102
- for dirname in dirnames:
103
- if dirname.startswith('.'):
104
- dirnames.remove(dirname)
133
+ for dirname in [d for d in dirnames if d.startswith('.')]:
134
+ dirnames.remove(dirname)
105
135
 
106
136
  for filename in filenames:
107
137
  if filename.endswith('.po'):
@@ -109,7 +139,7 @@ class CatalogRepository:
109
139
  yield basedir, relpath(fullpath, basedir)
110
140
 
111
141
  @property
112
- def catalogs(self) -> Generator[CatalogInfo, None, None]:
142
+ def catalogs(self) -> Iterator[CatalogInfo]:
113
143
  for basedir, filename in self.pofiles:
114
144
  domain = canon_path(path.splitext(filename)[0])
115
145
  yield CatalogInfo(basedir, domain, self.encoding)
@@ -170,7 +200,7 @@ date_format_re = re.compile('(%s)' % '|'.join(date_format_mappings))
170
200
 
171
201
 
172
202
  def babel_format_date(date: datetime, format: str, locale: str,
173
- formatter: Callable = babel.dates.format_date) -> str:
203
+ formatter: Formatter = babel.dates.format_date) -> str:
174
204
  # Check if we have the tzinfo attribute. If not we cannot do any time
175
205
  # related formats.
176
206
  if not hasattr(date, 'tzinfo'):
@@ -208,6 +238,7 @@ def format_date(
208
238
  # Check if we have to use a different babel formatter then
209
239
  # format_datetime, because we only want to format a date
210
240
  # or a time.
241
+ function: Formatter
211
242
  if token == '%x':
212
243
  function = babel.dates.format_date
213
244
  elif token == '%X':