Sphinx 8.0.2__py3-none-any.whl → 8.1.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.

Files changed (424) hide show
  1. sphinx/__init__.py +6 -3
  2. sphinx/_cli/__init__.py +40 -20
  3. sphinx/_cli/util/colour.py +5 -4
  4. sphinx/_cli/util/errors.py +28 -11
  5. sphinx/application.py +361 -38
  6. sphinx/builders/__init__.py +229 -83
  7. sphinx/builders/_epub_base.py +118 -71
  8. sphinx/builders/changes.py +39 -21
  9. sphinx/builders/dirhtml.py +4 -4
  10. sphinx/builders/dummy.py +2 -5
  11. sphinx/builders/epub3.py +43 -22
  12. sphinx/builders/gettext.py +43 -25
  13. sphinx/builders/html/__init__.py +284 -218
  14. sphinx/builders/html/_assets.py +62 -26
  15. sphinx/builders/html/_build_info.py +76 -0
  16. sphinx/builders/html/transforms.py +11 -9
  17. sphinx/builders/latex/__init__.py +139 -81
  18. sphinx/builders/latex/constants.py +7 -7
  19. sphinx/builders/latex/nodes.py +3 -2
  20. sphinx/builders/latex/theming.py +7 -5
  21. sphinx/builders/latex/transforms.py +27 -19
  22. sphinx/builders/linkcheck.py +146 -72
  23. sphinx/builders/manpage.py +30 -13
  24. sphinx/builders/singlehtml.py +22 -14
  25. sphinx/builders/texinfo.py +67 -37
  26. sphinx/builders/text.py +5 -5
  27. sphinx/builders/xml.py +6 -9
  28. sphinx/cmd/build.py +282 -103
  29. sphinx/cmd/make_mode.py +106 -63
  30. sphinx/cmd/quickstart.py +341 -145
  31. sphinx/config.py +45 -12
  32. sphinx/deprecation.py +8 -2
  33. sphinx/directives/__init__.py +28 -19
  34. sphinx/directives/code.py +86 -56
  35. sphinx/directives/other.py +50 -36
  36. sphinx/directives/patches.py +29 -19
  37. sphinx/domains/__init__.py +20 -120
  38. sphinx/domains/_domains_container.py +281 -0
  39. sphinx/domains/_index.py +110 -0
  40. sphinx/domains/c/__init__.py +3 -3
  41. sphinx/domains/c/_parser.py +10 -6
  42. sphinx/domains/changeset.py +5 -3
  43. sphinx/domains/citation.py +5 -3
  44. sphinx/domains/cpp/__init__.py +9 -11
  45. sphinx/domains/cpp/_parser.py +8 -7
  46. sphinx/domains/index.py +3 -3
  47. sphinx/domains/javascript.py +12 -7
  48. sphinx/domains/math.py +2 -2
  49. sphinx/domains/python/__init__.py +10 -5
  50. sphinx/domains/python/_object.py +1 -1
  51. sphinx/domains/rst.py +5 -5
  52. sphinx/domains/std/__init__.py +16 -11
  53. sphinx/environment/__init__.py +202 -146
  54. sphinx/environment/adapters/asset.py +3 -2
  55. sphinx/environment/adapters/indexentries.py +74 -33
  56. sphinx/environment/adapters/toctree.py +100 -43
  57. sphinx/environment/collectors/__init__.py +19 -8
  58. sphinx/environment/collectors/asset.py +47 -15
  59. sphinx/environment/collectors/dependencies.py +8 -4
  60. sphinx/environment/collectors/metadata.py +7 -2
  61. sphinx/environment/collectors/title.py +7 -2
  62. sphinx/environment/collectors/toctree.py +54 -22
  63. sphinx/errors.py +4 -1
  64. sphinx/events.py +314 -7
  65. sphinx/ext/apidoc.py +42 -18
  66. sphinx/ext/autodoc/__init__.py +52 -24
  67. sphinx/ext/autodoc/importer.py +6 -9
  68. sphinx/ext/autosectionlabel.py +1 -2
  69. sphinx/ext/autosummary/__init__.py +3 -1
  70. sphinx/ext/autosummary/generate.py +28 -14
  71. sphinx/ext/coverage.py +7 -7
  72. sphinx/ext/doctest.py +4 -8
  73. sphinx/ext/duration.py +6 -5
  74. sphinx/ext/inheritance_diagram.py +1 -1
  75. sphinx/ext/intersphinx/_cli.py +6 -4
  76. sphinx/ext/intersphinx/_load.py +77 -32
  77. sphinx/ext/intersphinx/_resolve.py +173 -79
  78. sphinx/ext/intersphinx/_shared.py +7 -5
  79. sphinx/ext/linkcode.py +7 -1
  80. sphinx/ext/mathjax.py +1 -2
  81. sphinx/ext/napoleon/__init__.py +37 -24
  82. sphinx/ext/napoleon/docstring.py +202 -134
  83. sphinx/ext/todo.py +5 -3
  84. sphinx/highlighting.py +9 -2
  85. sphinx/io.py +1 -1
  86. sphinx/jinja2glue.py +27 -6
  87. sphinx/locale/__init__.py +6 -2
  88. sphinx/locale/ar/LC_MESSAGES/sphinx.js +8 -1
  89. sphinx/locale/ar/LC_MESSAGES/sphinx.mo +0 -0
  90. sphinx/locale/ar/LC_MESSAGES/sphinx.po +2246 -2288
  91. sphinx/locale/bg/LC_MESSAGES/sphinx.js +4 -1
  92. sphinx/locale/bg/LC_MESSAGES/sphinx.mo +0 -0
  93. sphinx/locale/bg/LC_MESSAGES/sphinx.po +2113 -2159
  94. sphinx/locale/bn/LC_MESSAGES/sphinx.js +4 -1
  95. sphinx/locale/bn/LC_MESSAGES/sphinx.mo +0 -0
  96. sphinx/locale/bn/LC_MESSAGES/sphinx.po +2349 -2395
  97. sphinx/locale/ca/LC_MESSAGES/sphinx.js +4 -1
  98. sphinx/locale/ca/LC_MESSAGES/sphinx.mo +0 -0
  99. sphinx/locale/ca/LC_MESSAGES/sphinx.po +2846 -2892
  100. sphinx/locale/cak/LC_MESSAGES/sphinx.js +4 -1
  101. sphinx/locale/cak/LC_MESSAGES/sphinx.mo +0 -0
  102. sphinx/locale/cak/LC_MESSAGES/sphinx.po +2213 -2259
  103. sphinx/locale/cs/LC_MESSAGES/sphinx.js +6 -1
  104. sphinx/locale/cs/LC_MESSAGES/sphinx.mo +0 -0
  105. sphinx/locale/cs/LC_MESSAGES/sphinx.po +2225 -2269
  106. sphinx/locale/cy/LC_MESSAGES/sphinx.js +6 -1
  107. sphinx/locale/cy/LC_MESSAGES/sphinx.mo +0 -0
  108. sphinx/locale/cy/LC_MESSAGES/sphinx.po +2403 -2447
  109. sphinx/locale/da/LC_MESSAGES/sphinx.js +4 -1
  110. sphinx/locale/da/LC_MESSAGES/sphinx.mo +0 -0
  111. sphinx/locale/da/LC_MESSAGES/sphinx.po +2214 -2260
  112. sphinx/locale/de/LC_MESSAGES/sphinx.js +4 -1
  113. sphinx/locale/de/LC_MESSAGES/sphinx.mo +0 -0
  114. sphinx/locale/de/LC_MESSAGES/sphinx.po +2230 -2276
  115. sphinx/locale/de_DE/LC_MESSAGES/sphinx.js +4 -1
  116. sphinx/locale/de_DE/LC_MESSAGES/sphinx.mo +0 -0
  117. sphinx/locale/de_DE/LC_MESSAGES/sphinx.po +2113 -2159
  118. sphinx/locale/el/LC_MESSAGES/sphinx.js +4 -1
  119. sphinx/locale/el/LC_MESSAGES/sphinx.mo +0 -0
  120. sphinx/locale/el/LC_MESSAGES/sphinx.po +2619 -2665
  121. sphinx/locale/en_DE/LC_MESSAGES/sphinx.js +4 -1
  122. sphinx/locale/en_DE/LC_MESSAGES/sphinx.mo +0 -0
  123. sphinx/locale/en_DE/LC_MESSAGES/sphinx.po +2113 -2159
  124. sphinx/locale/en_FR/LC_MESSAGES/sphinx.js +4 -1
  125. sphinx/locale/en_FR/LC_MESSAGES/sphinx.mo +0 -0
  126. sphinx/locale/en_FR/LC_MESSAGES/sphinx.po +2113 -2159
  127. sphinx/locale/en_GB/LC_MESSAGES/sphinx.js +4 -1
  128. sphinx/locale/en_GB/LC_MESSAGES/sphinx.mo +0 -0
  129. sphinx/locale/en_GB/LC_MESSAGES/sphinx.po +2519 -2565
  130. sphinx/locale/en_HK/LC_MESSAGES/sphinx.js +4 -1
  131. sphinx/locale/en_HK/LC_MESSAGES/sphinx.mo +0 -0
  132. sphinx/locale/en_HK/LC_MESSAGES/sphinx.po +2113 -2159
  133. sphinx/locale/eo/LC_MESSAGES/sphinx.js +4 -1
  134. sphinx/locale/eo/LC_MESSAGES/sphinx.mo +0 -0
  135. sphinx/locale/eo/LC_MESSAGES/sphinx.po +2232 -2278
  136. sphinx/locale/es/LC_MESSAGES/sphinx.js +5 -1
  137. sphinx/locale/es/LC_MESSAGES/sphinx.mo +0 -0
  138. sphinx/locale/es/LC_MESSAGES/sphinx.po +2516 -2561
  139. sphinx/locale/es_CO/LC_MESSAGES/sphinx.js +5 -1
  140. sphinx/locale/es_CO/LC_MESSAGES/sphinx.mo +0 -0
  141. sphinx/locale/es_CO/LC_MESSAGES/sphinx.po +2114 -2159
  142. sphinx/locale/et/LC_MESSAGES/sphinx.js +4 -1
  143. sphinx/locale/et/LC_MESSAGES/sphinx.mo +0 -0
  144. sphinx/locale/et/LC_MESSAGES/sphinx.po +2317 -2363
  145. sphinx/locale/eu/LC_MESSAGES/sphinx.js +4 -1
  146. sphinx/locale/eu/LC_MESSAGES/sphinx.mo +0 -0
  147. sphinx/locale/eu/LC_MESSAGES/sphinx.po +2218 -2264
  148. sphinx/locale/fa/LC_MESSAGES/sphinx.js +4 -1
  149. sphinx/locale/fa/LC_MESSAGES/sphinx.mo +0 -0
  150. sphinx/locale/fa/LC_MESSAGES/sphinx.po +2505 -2551
  151. sphinx/locale/fi/LC_MESSAGES/sphinx.js +4 -1
  152. sphinx/locale/fi/LC_MESSAGES/sphinx.mo +0 -0
  153. sphinx/locale/fi/LC_MESSAGES/sphinx.po +2303 -2349
  154. sphinx/locale/fr/LC_MESSAGES/sphinx.js +6 -2
  155. sphinx/locale/fr/LC_MESSAGES/sphinx.mo +0 -0
  156. sphinx/locale/fr/LC_MESSAGES/sphinx.po +2863 -2908
  157. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.js +5 -1
  158. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.mo +0 -0
  159. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.po +2114 -2159
  160. sphinx/locale/gl/LC_MESSAGES/sphinx.js +4 -1
  161. sphinx/locale/gl/LC_MESSAGES/sphinx.mo +0 -0
  162. sphinx/locale/gl/LC_MESSAGES/sphinx.po +2571 -2617
  163. sphinx/locale/he/LC_MESSAGES/sphinx.js +5 -1
  164. sphinx/locale/he/LC_MESSAGES/sphinx.mo +0 -0
  165. sphinx/locale/he/LC_MESSAGES/sphinx.po +2307 -2352
  166. sphinx/locale/hi/LC_MESSAGES/sphinx.js +4 -1
  167. sphinx/locale/hi/LC_MESSAGES/sphinx.mo +0 -0
  168. sphinx/locale/hi/LC_MESSAGES/sphinx.po +2580 -2626
  169. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.js +4 -1
  170. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.mo +0 -0
  171. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.po +2113 -2159
  172. sphinx/locale/hr/LC_MESSAGES/sphinx.js +5 -1
  173. sphinx/locale/hr/LC_MESSAGES/sphinx.mo +0 -0
  174. sphinx/locale/hr/LC_MESSAGES/sphinx.po +2238 -2283
  175. sphinx/locale/hu/LC_MESSAGES/sphinx.js +4 -1
  176. sphinx/locale/hu/LC_MESSAGES/sphinx.mo +0 -0
  177. sphinx/locale/hu/LC_MESSAGES/sphinx.po +2228 -2274
  178. sphinx/locale/id/LC_MESSAGES/sphinx.js +3 -1
  179. sphinx/locale/id/LC_MESSAGES/sphinx.mo +0 -0
  180. sphinx/locale/id/LC_MESSAGES/sphinx.po +2787 -2834
  181. sphinx/locale/is/LC_MESSAGES/sphinx.js +4 -1
  182. sphinx/locale/is/LC_MESSAGES/sphinx.mo +0 -0
  183. sphinx/locale/is/LC_MESSAGES/sphinx.po +2224 -2270
  184. sphinx/locale/it/LC_MESSAGES/sphinx.js +5 -1
  185. sphinx/locale/it/LC_MESSAGES/sphinx.mo +0 -0
  186. sphinx/locale/it/LC_MESSAGES/sphinx.po +2231 -2276
  187. sphinx/locale/ja/LC_MESSAGES/sphinx.js +3 -1
  188. sphinx/locale/ja/LC_MESSAGES/sphinx.mo +0 -0
  189. sphinx/locale/ja/LC_MESSAGES/sphinx.po +2507 -2554
  190. sphinx/locale/ka/LC_MESSAGES/sphinx.js +4 -1
  191. sphinx/locale/ka/LC_MESSAGES/sphinx.mo +0 -0
  192. sphinx/locale/ka/LC_MESSAGES/sphinx.po +2428 -2474
  193. sphinx/locale/ko/LC_MESSAGES/sphinx.js +3 -1
  194. sphinx/locale/ko/LC_MESSAGES/sphinx.mo +0 -0
  195. sphinx/locale/ko/LC_MESSAGES/sphinx.po +2516 -2563
  196. sphinx/locale/lt/LC_MESSAGES/sphinx.js +6 -1
  197. sphinx/locale/lt/LC_MESSAGES/sphinx.mo +0 -0
  198. sphinx/locale/lt/LC_MESSAGES/sphinx.po +2425 -2469
  199. sphinx/locale/lv/LC_MESSAGES/sphinx.js +5 -1
  200. sphinx/locale/lv/LC_MESSAGES/sphinx.mo +0 -0
  201. sphinx/locale/lv/LC_MESSAGES/sphinx.po +2362 -2407
  202. sphinx/locale/mk/LC_MESSAGES/sphinx.js +4 -1
  203. sphinx/locale/mk/LC_MESSAGES/sphinx.mo +0 -0
  204. sphinx/locale/mk/LC_MESSAGES/sphinx.po +2121 -2167
  205. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.js +4 -1
  206. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.mo +0 -0
  207. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.po +2220 -2266
  208. sphinx/locale/ne/LC_MESSAGES/sphinx.js +4 -1
  209. sphinx/locale/ne/LC_MESSAGES/sphinx.mo +0 -0
  210. sphinx/locale/ne/LC_MESSAGES/sphinx.po +2221 -2267
  211. sphinx/locale/nl/LC_MESSAGES/sphinx.js +4 -1
  212. sphinx/locale/nl/LC_MESSAGES/sphinx.mo +0 -0
  213. sphinx/locale/nl/LC_MESSAGES/sphinx.po +2240 -2286
  214. sphinx/locale/pl/LC_MESSAGES/sphinx.js +6 -1
  215. sphinx/locale/pl/LC_MESSAGES/sphinx.mo +0 -0
  216. sphinx/locale/pl/LC_MESSAGES/sphinx.po +2319 -2363
  217. sphinx/locale/pt/LC_MESSAGES/sphinx.js +5 -1
  218. sphinx/locale/pt/LC_MESSAGES/sphinx.mo +0 -0
  219. sphinx/locale/pt/LC_MESSAGES/sphinx.po +2114 -2159
  220. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.js +5 -1
  221. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +0 -0
  222. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +2854 -2899
  223. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.js +5 -1
  224. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo +0 -0
  225. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po +2224 -2269
  226. sphinx/locale/ro/LC_MESSAGES/sphinx.js +5 -1
  227. sphinx/locale/ro/LC_MESSAGES/sphinx.mo +0 -0
  228. sphinx/locale/ro/LC_MESSAGES/sphinx.po +2226 -2271
  229. sphinx/locale/ru/LC_MESSAGES/sphinx.js +8 -3
  230. sphinx/locale/ru/LC_MESSAGES/sphinx.mo +0 -0
  231. sphinx/locale/ru/LC_MESSAGES/sphinx.po +2841 -2885
  232. sphinx/locale/si/LC_MESSAGES/sphinx.js +4 -1
  233. sphinx/locale/si/LC_MESSAGES/sphinx.mo +0 -0
  234. sphinx/locale/si/LC_MESSAGES/sphinx.po +2294 -2340
  235. sphinx/locale/sk/LC_MESSAGES/sphinx.js +6 -1
  236. sphinx/locale/sk/LC_MESSAGES/sphinx.mo +0 -0
  237. sphinx/locale/sk/LC_MESSAGES/sphinx.po +2497 -2541
  238. sphinx/locale/sl/LC_MESSAGES/sphinx.js +6 -1
  239. sphinx/locale/sl/LC_MESSAGES/sphinx.mo +0 -0
  240. sphinx/locale/sl/LC_MESSAGES/sphinx.po +2331 -2375
  241. sphinx/locale/sphinx.pot +2121 -2167
  242. sphinx/locale/sq/LC_MESSAGES/sphinx.js +4 -1
  243. sphinx/locale/sq/LC_MESSAGES/sphinx.mo +0 -0
  244. sphinx/locale/sq/LC_MESSAGES/sphinx.po +2855 -2901
  245. sphinx/locale/sr/LC_MESSAGES/sphinx.js +5 -1
  246. sphinx/locale/sr/LC_MESSAGES/sphinx.mo +0 -0
  247. sphinx/locale/sr/LC_MESSAGES/sphinx.po +2203 -2248
  248. sphinx/locale/sr@latin/LC_MESSAGES/sphinx.mo +0 -0
  249. sphinx/locale/sr_RS/LC_MESSAGES/sphinx.mo +0 -0
  250. sphinx/locale/sv/LC_MESSAGES/sphinx.js +4 -1
  251. sphinx/locale/sv/LC_MESSAGES/sphinx.mo +0 -0
  252. sphinx/locale/sv/LC_MESSAGES/sphinx.po +2423 -2469
  253. sphinx/locale/te/LC_MESSAGES/sphinx.js +4 -1
  254. sphinx/locale/te/LC_MESSAGES/sphinx.mo +0 -0
  255. sphinx/locale/te/LC_MESSAGES/sphinx.po +2113 -2159
  256. sphinx/locale/tr/LC_MESSAGES/sphinx.js +4 -1
  257. sphinx/locale/tr/LC_MESSAGES/sphinx.mo +0 -0
  258. sphinx/locale/tr/LC_MESSAGES/sphinx.po +2443 -2489
  259. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.js +6 -1
  260. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +0 -0
  261. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +2329 -2373
  262. sphinx/locale/ur/LC_MESSAGES/sphinx.js +4 -1
  263. sphinx/locale/ur/LC_MESSAGES/sphinx.mo +0 -0
  264. sphinx/locale/ur/LC_MESSAGES/sphinx.po +2113 -2159
  265. sphinx/locale/vi/LC_MESSAGES/sphinx.js +3 -1
  266. sphinx/locale/vi/LC_MESSAGES/sphinx.mo +0 -0
  267. sphinx/locale/vi/LC_MESSAGES/sphinx.po +2199 -2246
  268. sphinx/locale/yue/LC_MESSAGES/sphinx.js +3 -1
  269. sphinx/locale/yue/LC_MESSAGES/sphinx.mo +0 -0
  270. sphinx/locale/yue/LC_MESSAGES/sphinx.po +2112 -2159
  271. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.js +3 -1
  272. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.mo +0 -0
  273. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.po +2112 -2159
  274. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.js +3 -1
  275. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +0 -0
  276. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +2845 -2892
  277. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.js +3 -1
  278. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.mo +0 -0
  279. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.po +2112 -2159
  280. sphinx/parsers.py +3 -1
  281. sphinx/project.py +6 -2
  282. sphinx/pycode/__init__.py +11 -4
  283. sphinx/pycode/ast.py +58 -58
  284. sphinx/pycode/parser.py +49 -28
  285. sphinx/pygments_styles.py +49 -49
  286. sphinx/registry.py +8 -3
  287. sphinx/roles.py +136 -13
  288. sphinx/search/__init__.py +146 -87
  289. sphinx/search/da.py +2 -4
  290. sphinx/search/de.py +2 -4
  291. sphinx/search/en.py +4 -4
  292. sphinx/search/es.py +2 -4
  293. sphinx/search/fi.py +2 -4
  294. sphinx/search/fr.py +2 -4
  295. sphinx/search/hu.py +2 -4
  296. sphinx/search/it.py +2 -4
  297. sphinx/search/ja.py +55 -32
  298. sphinx/search/nl.py +2 -4
  299. sphinx/search/no.py +2 -4
  300. sphinx/search/pt.py +2 -4
  301. sphinx/search/ro.py +0 -2
  302. sphinx/search/ru.py +2 -4
  303. sphinx/search/sv.py +2 -4
  304. sphinx/search/tr.py +0 -2
  305. sphinx/search/zh.py +18 -13
  306. sphinx/templates/graphviz/graphviz.css +0 -7
  307. sphinx/testing/fixtures.py +6 -5
  308. sphinx/testing/path.py +7 -5
  309. sphinx/testing/util.py +63 -29
  310. sphinx/texinputs/sphinx.sty +115 -50
  311. sphinx/texinputs/sphinxlatexadmonitions.sty +56 -38
  312. sphinx/texinputs/sphinxlatexcontainers.sty +1 -1
  313. sphinx/texinputs/sphinxlatexgraphics.sty +3 -2
  314. sphinx/texinputs/sphinxlatexindbibtoc.sty +1 -1
  315. sphinx/texinputs/sphinxlatexlists.sty +1 -1
  316. sphinx/texinputs/sphinxlatexliterals.sty +4 -1
  317. sphinx/texinputs/sphinxlatexnumfig.sty +22 -9
  318. sphinx/texinputs/sphinxlatexobjects.sty +1 -1
  319. sphinx/texinputs/sphinxlatexshadowbox.sty +72 -10
  320. sphinx/texinputs/sphinxlatexstyleheadings.sty +7 -2
  321. sphinx/texinputs/sphinxlatexstylepage.sty +2 -8
  322. sphinx/texinputs/sphinxlatexstyletext.sty +2 -4
  323. sphinx/texinputs/sphinxlatextables.sty +1 -1
  324. sphinx/texinputs/sphinxoptionsgeometry.sty +1 -1
  325. sphinx/texinputs/sphinxoptionshyperref.sty +1 -1
  326. sphinx/themes/agogo/layout.html +1 -10
  327. sphinx/themes/agogo/static/agogo.css.jinja +0 -7
  328. sphinx/themes/basic/defindex.html +1 -8
  329. sphinx/themes/basic/domainindex.html +1 -9
  330. sphinx/themes/basic/genindex-single.html +1 -9
  331. sphinx/themes/basic/genindex-split.html +1 -9
  332. sphinx/themes/basic/genindex.html +1 -9
  333. sphinx/themes/basic/globaltoc.html +1 -9
  334. sphinx/themes/basic/layout.html +1 -9
  335. sphinx/themes/basic/localtoc.html +1 -9
  336. sphinx/themes/basic/page.html +1 -9
  337. sphinx/themes/basic/relations.html +1 -9
  338. sphinx/themes/basic/search.html +1 -9
  339. sphinx/themes/basic/searchbox.html +1 -9
  340. sphinx/themes/basic/searchfield.html +4 -10
  341. sphinx/themes/basic/sourcelink.html +1 -9
  342. sphinx/themes/basic/static/basic.css.jinja +2 -13
  343. sphinx/themes/basic/static/doctools.js +0 -7
  344. sphinx/themes/basic/static/language_data.js.jinja +0 -7
  345. sphinx/themes/basic/static/searchtools.js +25 -13
  346. sphinx/themes/bizstyle/layout.html +1 -9
  347. sphinx/themes/bizstyle/static/bizstyle.css.jinja +0 -7
  348. sphinx/themes/bizstyle/static/bizstyle.js.jinja +5 -11
  349. sphinx/themes/classic/layout.html +1 -9
  350. sphinx/themes/classic/static/classic.css.jinja +0 -7
  351. sphinx/themes/classic/static/sidebar.js.jinja +0 -6
  352. sphinx/themes/epub/epub-cover.html +1 -9
  353. sphinx/themes/epub/layout.html +1 -9
  354. sphinx/themes/epub/static/epub.css.jinja +0 -7
  355. sphinx/themes/haiku/layout.html +1 -9
  356. sphinx/themes/haiku/static/haiku.css.jinja +0 -6
  357. sphinx/themes/nature/static/nature.css.jinja +0 -7
  358. sphinx/themes/nonav/layout.html +1 -9
  359. sphinx/themes/nonav/static/nonav.css.jinja +0 -7
  360. sphinx/themes/pyramid/static/epub.css.jinja +0 -7
  361. sphinx/themes/pyramid/static/pyramid.css.jinja +0 -7
  362. sphinx/themes/scrolls/layout.html +1 -10
  363. sphinx/themes/scrolls/static/scrolls.css.jinja +0 -7
  364. sphinx/themes/sphinxdoc/static/sphinxdoc.css.jinja +2 -7
  365. sphinx/themes/traditional/static/traditional.css.jinja +0 -7
  366. sphinx/theming.py +18 -6
  367. sphinx/transforms/__init__.py +56 -35
  368. sphinx/transforms/compact_bullet_list.py +3 -2
  369. sphinx/transforms/i18n.py +132 -50
  370. sphinx/transforms/post_transforms/__init__.py +94 -43
  371. sphinx/transforms/post_transforms/code.py +7 -6
  372. sphinx/transforms/post_transforms/images.py +71 -54
  373. sphinx/transforms/references.py +1 -2
  374. sphinx/util/__init__.py +23 -194
  375. sphinx/util/_files.py +80 -0
  376. sphinx/util/_importer.py +27 -0
  377. sphinx/util/_io.py +1 -2
  378. sphinx/util/_lines.py +26 -0
  379. sphinx/util/_pathlib.py +5 -2
  380. sphinx/util/_serialise.py +53 -0
  381. sphinx/util/_timestamps.py +2 -1
  382. sphinx/util/_uri.py +16 -0
  383. sphinx/util/cfamily.py +48 -25
  384. sphinx/util/console.py +1 -0
  385. sphinx/util/display.py +1 -1
  386. sphinx/util/docfields.py +125 -45
  387. sphinx/util/docstrings.py +1 -1
  388. sphinx/util/docutils.py +118 -44
  389. sphinx/util/exceptions.py +11 -5
  390. sphinx/util/fileutil.py +53 -32
  391. sphinx/util/http_date.py +9 -7
  392. sphinx/util/i18n.py +49 -16
  393. sphinx/util/images.py +7 -6
  394. sphinx/util/inspect.py +29 -12
  395. sphinx/util/inventory.py +47 -29
  396. sphinx/util/logging.py +58 -85
  397. sphinx/util/matching.py +3 -3
  398. sphinx/util/math.py +1 -1
  399. sphinx/util/nodes.py +176 -108
  400. sphinx/util/osutil.py +13 -10
  401. sphinx/util/parallel.py +5 -4
  402. sphinx/util/parsing.py +5 -3
  403. sphinx/util/png.py +3 -3
  404. sphinx/util/requests.py +8 -4
  405. sphinx/util/rst.py +5 -3
  406. sphinx/util/tags.py +5 -2
  407. sphinx/util/template.py +26 -11
  408. sphinx/util/texescape.py +2 -2
  409. sphinx/util/typing.py +89 -38
  410. sphinx/versioning.py +3 -1
  411. sphinx/writers/html.py +22 -7
  412. sphinx/writers/html5.py +113 -64
  413. sphinx/writers/latex.py +408 -221
  414. sphinx/writers/manpage.py +25 -15
  415. sphinx/writers/texinfo.py +94 -82
  416. sphinx/writers/text.py +87 -53
  417. sphinx/writers/xml.py +5 -4
  418. sphinx-8.1.1.dist-info/LICENSE.rst +31 -0
  419. {sphinx-8.0.2.dist-info → sphinx-8.1.1.dist-info}/METADATA +13 -11
  420. sphinx-8.1.1.dist-info/RECORD +598 -0
  421. sphinx-8.0.2.dist-info/LICENSE.rst +0 -67
  422. sphinx-8.0.2.dist-info/RECORD +0 -590
  423. {sphinx-8.0.2.dist-info → sphinx-8.1.1.dist-info}/WHEEL +0 -0
  424. {sphinx-8.0.2.dist-info → sphinx-8.1.1.dist-info}/entry_points.txt +0 -0
@@ -31,7 +31,8 @@ _xref_or_code_regex = re.compile(
31
31
  r'((?::(?:[a-zA-Z0-9]+[\-_+:.])*[a-zA-Z0-9]+:`.+?`)|'
32
32
  r'(?:``.+?``)|'
33
33
  r'(?::meta .+:.*)|'
34
- r'(?:`.+?\s*(?<!\x00)<.*?>`))')
34
+ r'(?:`.+?\s*(?<!\x00)<.*?>`))'
35
+ )
35
36
  _xref_regex = re.compile(
36
37
  r'(?:(?::(?:[a-zA-Z0-9]+[\-_+:.])*[a-zA-Z0-9]+:)?`.+?`)',
37
38
  )
@@ -39,20 +40,21 @@ _bullet_list_regex = re.compile(r'^(\*|\+|\-)(\s+\S|\s*$)')
39
40
  _enumerated_list_regex = re.compile(
40
41
  r'^(?P<paren>\()?'
41
42
  r'(\d+|#|[ivxlcdm]+|[IVXLCDM]+|[a-zA-Z])'
42
- r'(?(paren)\)|\.)(\s+\S|\s*$)')
43
+ r'(?(paren)\)|\.)(\s+\S|\s*$)'
44
+ )
43
45
  _token_regex = re.compile(
44
- r"(,\sor\s|\sor\s|\sof\s|:\s|\sto\s|,\sand\s|\sand\s|,\s"
45
- r"|[{]|[}]"
46
+ r'(,\sor\s|\sor\s|\sof\s|:\s|\sto\s|,\sand\s|\sand\s|,\s'
47
+ r'|[{]|[}]'
46
48
  r'|"(?:\\"|[^"])*"'
47
49
  r"|'(?:\\'|[^'])*')",
48
50
  )
49
51
  _default_regex = re.compile(
50
- r"^default[^_0-9A-Za-z].*$",
52
+ r'^default[^_0-9A-Za-z].*$',
51
53
  )
52
- _SINGLETONS = ("None", "True", "False", "Ellipsis")
54
+ _SINGLETONS = ('None', 'True', 'False', 'Ellipsis')
53
55
 
54
56
 
55
- class Deque(collections.deque):
57
+ class Deque(collections.deque[Any]):
56
58
  """
57
59
  A subclass of deque that mimics ``pockets.iterators.modify_iter``.
58
60
 
@@ -147,8 +149,11 @@ class GoogleDocstring:
147
149
 
148
150
  """
149
151
 
150
- _name_rgx = re.compile(r"^\s*((?::(?P<role>\S+):)?`(?P<name>~?[a-zA-Z0-9_.-]+)`|"
151
- r" (?P<name2>~?[a-zA-Z0-9_.-]+))\s*", re.VERBOSE)
152
+ _name_rgx = re.compile(
153
+ r'^\s*((?::(?P<role>\S+):)?`(?P<name>~?[a-zA-Z0-9_.-]+)`|'
154
+ r' (?P<name2>~?[a-zA-Z0-9_.-]+))\s*',
155
+ re.VERBOSE,
156
+ )
152
157
 
153
158
  def __init__(
154
159
  self,
@@ -195,7 +200,7 @@ class GoogleDocstring:
195
200
  if not hasattr(self, '_directive_sections'):
196
201
  self._directive_sections: list[str] = []
197
202
  if not hasattr(self, '_sections'):
198
- self._sections: dict[str, Callable] = {
203
+ self._sections: dict[str, Callable[..., list[str]]] = {
199
204
  'args': self._parse_parameters_section,
200
205
  'arguments': self._parse_parameters_section,
201
206
  'attention': partial(self._parse_admonition, 'attention'),
@@ -261,9 +266,8 @@ class GoogleDocstring:
261
266
  def _consume_indented_block(self, indent: int = 1) -> list[str]:
262
267
  lines = []
263
268
  line = self._lines.get(0)
264
- while (
265
- not self._is_section_break() and
266
- (not line or self._is_indented(line, indent))
269
+ while not self._is_section_break() and (
270
+ not line or self._is_indented(line, indent)
267
271
  ):
268
272
  lines.append(self._lines.next())
269
273
  line = self._lines.get(0)
@@ -271,9 +275,7 @@ class GoogleDocstring:
271
275
 
272
276
  def _consume_contiguous(self) -> list[str]:
273
277
  lines = []
274
- while (self._lines and
275
- self._lines.get(0) and
276
- not self._is_section_header()):
278
+ while self._lines and self._lines.get(0) and not self._is_section_header():
277
279
  lines.append(self._lines.next())
278
280
  return lines
279
281
 
@@ -285,8 +287,11 @@ class GoogleDocstring:
285
287
  line = self._lines.get(0)
286
288
  return lines
287
289
 
288
- def _consume_field(self, parse_type: bool = True, prefer_type: bool = False,
289
- ) -> tuple[str, str, list[str]]:
290
+ def _consume_field(
291
+ self,
292
+ parse_type: bool = True,
293
+ prefer_type: bool = False,
294
+ ) -> tuple[str, str, list[str]]:
290
295
  line = self._lines.next()
291
296
 
292
297
  before, colon, after = self._partition_field_on_colon(line)
@@ -311,14 +316,15 @@ class GoogleDocstring:
311
316
  _descs = self.__class__(_descs, self._config).lines()
312
317
  return _name, _type, _descs
313
318
 
314
- def _consume_fields(self, parse_type: bool = True, prefer_type: bool = False,
315
- multiple: bool = False) -> list[tuple[str, str, list[str]]]:
319
+ def _consume_fields(
320
+ self, parse_type: bool = True, prefer_type: bool = False, multiple: bool = False
321
+ ) -> list[tuple[str, str, list[str]]]:
316
322
  self._consume_empty()
317
323
  fields: list[tuple[str, str, list[str]]] = []
318
324
  while not self._is_section_break():
319
325
  _name, _type, _desc = self._consume_field(parse_type, prefer_type)
320
326
  if multiple and _name:
321
- fields.extend((name.strip(), _type, _desc) for name in _name.split(","))
327
+ fields.extend((name.strip(), _type, _desc) for name in _name.split(','))
322
328
  elif _name or _type or _desc:
323
329
  fields.append((_name, _type, _desc))
324
330
  return fields
@@ -333,8 +339,9 @@ class GoogleDocstring:
333
339
  _descs = self.__class__(_descs, self._config).lines()
334
340
  return _type, _descs
335
341
 
336
- def _consume_returns_section(self, preprocess_types: bool = False,
337
- ) -> list[tuple[str, str, list[str]]]:
342
+ def _consume_returns_section(
343
+ self, preprocess_types: bool = False
344
+ ) -> list[tuple[str, str, list[str]]]:
338
345
  lines = self._dedent(self._consume_to_next_section())
339
346
  if lines:
340
347
  before, colon, after = self._partition_field_on_colon(lines[0])
@@ -348,9 +355,10 @@ class GoogleDocstring:
348
355
 
349
356
  _type = before
350
357
 
351
- if (_type and preprocess_types and
352
- self._config.napoleon_preprocess_types):
353
- _type = _convert_type_spec(_type, self._config.napoleon_type_aliases or {})
358
+ if _type and preprocess_types and self._config.napoleon_preprocess_types:
359
+ _type = _convert_type_spec(
360
+ _type, self._config.napoleon_type_aliases or {}
361
+ )
354
362
 
355
363
  _desc = self.__class__(_desc, self._config).lines()
356
364
  return [(_name, _type, _desc)]
@@ -389,7 +397,9 @@ class GoogleDocstring:
389
397
  return [line[min_indent:] for line in lines]
390
398
 
391
399
  def _escape_args_and_kwargs(self, name: str) -> str:
392
- if name.endswith('_') and getattr(self._config, 'strip_signature_backslash', False):
400
+ if name.endswith('_') and getattr(
401
+ self._config, 'strip_signature_backslash', False
402
+ ):
393
403
  name = name[:-1] + r'\_'
394
404
 
395
405
  if name[:2] == '**':
@@ -423,7 +433,10 @@ class GoogleDocstring:
423
433
  return ['.. %s::' % admonition, '']
424
434
 
425
435
  def _format_block(
426
- self, prefix: str, lines: list[str], padding: str | None = None,
436
+ self,
437
+ prefix: str,
438
+ lines: list[str],
439
+ padding: str | None = None,
427
440
  ) -> list[str]:
428
441
  if lines:
429
442
  if padding is None:
@@ -440,9 +453,12 @@ class GoogleDocstring:
440
453
  else:
441
454
  return [prefix]
442
455
 
443
- def _format_docutils_params(self, fields: list[tuple[str, str, list[str]]],
444
- field_role: str = 'param', type_role: str = 'type',
445
- ) -> list[str]:
456
+ def _format_docutils_params(
457
+ self,
458
+ fields: list[tuple[str, str, list[str]]],
459
+ field_role: str = 'param',
460
+ type_role: str = 'type',
461
+ ) -> list[str]:
446
462
  lines = []
447
463
  for _name, _type, _desc in fields:
448
464
  _desc = self._strip_empty(_desc)
@@ -486,8 +502,11 @@ class GoogleDocstring:
486
502
  else:
487
503
  return [field]
488
504
 
489
- def _format_fields(self, field_type: str, fields: list[tuple[str, str, list[str]]],
490
- ) -> list[str]:
505
+ def _format_fields(
506
+ self,
507
+ field_type: str,
508
+ fields: list[tuple[str, str, list[str]]],
509
+ ) -> list[str]:
491
510
  field_type = ':%s:' % field_type.strip()
492
511
  padding = ' ' * len(field_type)
493
512
  multi = len(fields) > 1
@@ -579,11 +598,15 @@ class GoogleDocstring:
579
598
 
580
599
  def _is_section_break(self) -> bool:
581
600
  line = self._lines.get(0)
582
- return (not self._lines or
583
- self._is_section_header() or
584
- (self._is_in_section and
585
- line and
586
- not self._is_indented(line, self._section_indent)))
601
+ return (
602
+ not self._lines
603
+ or self._is_section_header()
604
+ or (
605
+ self._is_in_section
606
+ and line
607
+ and not self._is_indented(line, self._section_indent)
608
+ )
609
+ )
587
610
 
588
611
  def _load_custom_sections(self) -> None:
589
612
  if self._config.napoleon_custom_sections is not None:
@@ -594,18 +617,20 @@ class GoogleDocstring:
594
617
  self._sections[entry.lower()] = self._parse_custom_generic_section
595
618
  else:
596
619
  # otherwise, assume entry is container;
597
- if entry[1] == "params_style":
598
- self._sections[entry[0].lower()] = \
620
+ if entry[1] == 'params_style':
621
+ self._sections[entry[0].lower()] = (
599
622
  self._parse_custom_params_style_section
600
- elif entry[1] == "returns_style":
601
- self._sections[entry[0].lower()] = \
623
+ )
624
+ elif entry[1] == 'returns_style':
625
+ self._sections[entry[0].lower()] = (
602
626
  self._parse_custom_returns_style_section
627
+ )
603
628
  else:
604
629
  # [0] is new section, [1] is the section to alias.
605
630
  # in the case of key mismatch, just handle as generic section.
606
- self._sections[entry[0].lower()] = \
607
- self._sections.get(entry[1].lower(),
608
- self._parse_custom_generic_section)
631
+ self._sections[entry[0].lower()] = self._sections.get(
632
+ entry[1].lower(), self._parse_custom_generic_section
633
+ )
609
634
 
610
635
  def _parse(self) -> None:
611
636
  self._parsed_lines = self._consume_empty()
@@ -721,9 +746,8 @@ class GoogleDocstring:
721
746
  fields = self._consume_fields()
722
747
  if self._config.napoleon_use_keyword:
723
748
  return self._format_docutils_params(
724
- fields,
725
- field_role="keyword",
726
- type_role="kwtype")
749
+ fields, field_role='keyword', type_role='kwtype'
750
+ )
727
751
  else:
728
752
  return self._format_fields(_('Keyword Arguments'), fields)
729
753
 
@@ -770,7 +794,7 @@ class GoogleDocstring:
770
794
  _type = m.group('name')
771
795
  elif _xref_regex.match(_type):
772
796
  pos = _type.find('`')
773
- _type = _type[pos + 1:-1]
797
+ _type = _type[pos + 1 : -1]
774
798
  _type = ' ' + _type if _type else ''
775
799
  _desc = self._strip_empty(_desc)
776
800
  _descs = ' ' + '\n '.join(_desc) if any(_desc) else ''
@@ -840,15 +864,13 @@ class GoogleDocstring:
840
864
  m = _single_colon_regex.search(source)
841
865
  if (i % 2) == 0 and m:
842
866
  found_colon = True
843
- colon = source[m.start(): m.end()]
844
- before_colon.append(source[:m.start()])
845
- after_colon.append(source[m.end():])
867
+ colon = source[m.start() : m.end()]
868
+ before_colon.append(source[: m.start()])
869
+ after_colon.append(source[m.end() :])
846
870
  else:
847
871
  before_colon.append(source)
848
872
 
849
- return ("".join(before_colon).strip(),
850
- colon,
851
- "".join(after_colon).strip())
873
+ return ''.join(before_colon).strip(), colon, ''.join(after_colon).strip()
852
874
 
853
875
  def _strip_empty(self, lines: list[str]) -> list[str]:
854
876
  if lines:
@@ -866,29 +888,35 @@ class GoogleDocstring:
866
888
  end = i
867
889
  break
868
890
  if start > 0 or end + 1 < len(lines):
869
- lines = lines[start:end + 1]
891
+ lines = lines[start : end + 1]
870
892
  return lines
871
893
 
872
894
  def _lookup_annotation(self, _name: str) -> str:
873
895
  if self._config.napoleon_attr_annotations:
874
- if self._what in ("module", "class", "exception") and self._obj:
896
+ if self._what in ('module', 'class', 'exception') and self._obj:
875
897
  # cache the class annotations
876
- if not hasattr(self, "_annotations"):
877
- localns = getattr(self._config, "autodoc_type_aliases", {})
878
- localns.update(getattr(
879
- self._config, "napoleon_type_aliases", {},
880
- ) or {})
898
+ if not hasattr(self, '_annotations'):
899
+ localns = getattr(self._config, 'autodoc_type_aliases', {})
900
+ localns.update(
901
+ getattr(
902
+ self._config,
903
+ 'napoleon_type_aliases',
904
+ {},
905
+ )
906
+ or {}
907
+ )
881
908
  self._annotations = get_type_hints(self._obj, None, localns)
882
909
  if _name in self._annotations:
883
- return stringify_annotation(self._annotations[_name],
884
- 'fully-qualified-except-typing')
910
+ return stringify_annotation(
911
+ self._annotations[_name], 'fully-qualified-except-typing'
912
+ )
885
913
  # No annotation found
886
- return ""
914
+ return ''
887
915
 
888
916
 
889
917
  def _recombine_set_tokens(tokens: list[str]) -> list[str]:
890
918
  token_queue = collections.deque(tokens)
891
- keywords = ("optional", "default")
919
+ keywords = ('optional', 'default')
892
920
 
893
921
  def takewhile_set(tokens: collections.deque[str]) -> Iterator[str]:
894
922
  open_braces = 0
@@ -899,7 +927,7 @@ def _recombine_set_tokens(tokens: list[str]) -> list[str]:
899
927
  except IndexError:
900
928
  break
901
929
 
902
- if token == ", ":
930
+ if token == ', ':
903
931
  previous_token = token
904
932
  continue
905
933
 
@@ -916,9 +944,9 @@ def _recombine_set_tokens(tokens: list[str]) -> list[str]:
916
944
  yield previous_token
917
945
  previous_token = None
918
946
 
919
- if token == "{":
947
+ if token == '{':
920
948
  open_braces += 1
921
- elif token == "}":
949
+ elif token == '}':
922
950
  open_braces -= 1
923
951
 
924
952
  yield token
@@ -933,9 +961,9 @@ def _recombine_set_tokens(tokens: list[str]) -> list[str]:
933
961
  except IndexError:
934
962
  break
935
963
 
936
- if token == "{":
937
- tokens.appendleft("{")
938
- yield "".join(takewhile_set(tokens))
964
+ if token == '{':
965
+ tokens.appendleft('{')
966
+ yield ''.join(takewhile_set(tokens))
939
967
  else:
940
968
  yield token
941
969
 
@@ -950,7 +978,7 @@ def _tokenize_type_spec(spec: str) -> list[str]:
950
978
  # for now
951
979
  other = item[8:]
952
980
 
953
- return [default, " ", other]
981
+ return [default, ' ', other]
954
982
  else:
955
983
  return [item]
956
984
 
@@ -973,70 +1001,74 @@ def _token_type(token: str, location: str | None = None) -> str:
973
1001
  else:
974
1002
  return True
975
1003
 
976
- if token.startswith(" ") or token.endswith(" "):
977
- type_ = "delimiter"
1004
+ if token.startswith(' ') or token.endswith(' '):
1005
+ type_ = 'delimiter'
978
1006
  elif (
979
- is_numeric(token) or
980
- (token.startswith("{") and token.endswith("}")) or
981
- (token.startswith('"') and token.endswith('"')) or
982
- (token.startswith("'") and token.endswith("'"))
1007
+ is_numeric(token)
1008
+ or (token.startswith('{') and token.endswith('}'))
1009
+ or (token.startswith('"') and token.endswith('"'))
1010
+ or (token.startswith("'") and token.endswith("'"))
983
1011
  ):
984
- type_ = "literal"
985
- elif token.startswith("{"):
1012
+ type_ = 'literal'
1013
+ elif token.startswith('{'):
986
1014
  logger.warning(
987
- __("invalid value set (missing closing brace): %s"),
1015
+ __('invalid value set (missing closing brace): %s'),
988
1016
  token,
989
1017
  location=location,
990
1018
  )
991
- type_ = "literal"
992
- elif token.endswith("}"):
1019
+ type_ = 'literal'
1020
+ elif token.endswith('}'):
993
1021
  logger.warning(
994
- __("invalid value set (missing opening brace): %s"),
1022
+ __('invalid value set (missing opening brace): %s'),
995
1023
  token,
996
1024
  location=location,
997
1025
  )
998
- type_ = "literal"
1026
+ type_ = 'literal'
999
1027
  elif token.startswith(("'", '"')):
1000
1028
  logger.warning(
1001
- __("malformed string literal (missing closing quote): %s"),
1029
+ __('malformed string literal (missing closing quote): %s'),
1002
1030
  token,
1003
1031
  location=location,
1004
1032
  )
1005
- type_ = "literal"
1033
+ type_ = 'literal'
1006
1034
  elif token.endswith(("'", '"')):
1007
1035
  logger.warning(
1008
- __("malformed string literal (missing opening quote): %s"),
1036
+ __('malformed string literal (missing opening quote): %s'),
1009
1037
  token,
1010
1038
  location=location,
1011
1039
  )
1012
- type_ = "literal"
1013
- elif token in ("optional", "default"):
1040
+ type_ = 'literal'
1041
+ elif token in ('optional', 'default'):
1014
1042
  # default is not a official keyword (yet) but supported by the
1015
1043
  # reference implementation (numpydoc) and widely used
1016
- type_ = "control"
1044
+ type_ = 'control'
1017
1045
  elif _xref_regex.match(token):
1018
- type_ = "reference"
1046
+ type_ = 'reference'
1019
1047
  else:
1020
- type_ = "obj"
1048
+ type_ = 'obj'
1021
1049
 
1022
1050
  return type_
1023
1051
 
1024
1052
 
1025
1053
  def _convert_numpy_type_spec(
1026
- _type: str, location: str | None = None, translations: dict | None = None,
1054
+ _type: str,
1055
+ location: str | None = None,
1056
+ translations: dict[str, str] | None = None,
1027
1057
  ) -> str:
1028
1058
  if translations is None:
1029
1059
  translations = {}
1030
1060
 
1031
- def convert_obj(obj: str, translations: dict[str, str], default_translation: str) -> str:
1061
+ def convert_obj(
1062
+ obj: str, translations: dict[str, str], default_translation: str
1063
+ ) -> str:
1032
1064
  translation = translations.get(obj, obj)
1033
1065
 
1034
1066
  # use :class: (the default) only if obj is not a standard singleton
1035
- if translation in _SINGLETONS and default_translation == ":class:`%s`":
1036
- default_translation = ":obj:`%s`"
1037
- elif translation == "..." and default_translation == ":class:`%s`":
1067
+ if translation in _SINGLETONS and default_translation == ':class:`%s`':
1068
+ default_translation = ':obj:`%s`'
1069
+ elif translation == '...' and default_translation == ':class:`%s`':
1038
1070
  # allow referencing the builtin ...
1039
- default_translation = ":obj:`%s <Ellipsis>`"
1071
+ default_translation = ':obj:`%s <Ellipsis>`'
1040
1072
 
1041
1073
  if _xref_regex.match(translation) is None:
1042
1074
  translation = default_translation % translation
@@ -1045,21 +1077,20 @@ def _convert_numpy_type_spec(
1045
1077
 
1046
1078
  tokens = _tokenize_type_spec(_type)
1047
1079
  combined_tokens = _recombine_set_tokens(tokens)
1048
- types = [
1049
- (token, _token_type(token, location))
1050
- for token in combined_tokens
1051
- ]
1080
+ types = [(token, _token_type(token, location)) for token in combined_tokens]
1052
1081
 
1053
1082
  converters = {
1054
- "literal": lambda x: "``%s``" % x,
1055
- "obj": lambda x: convert_obj(x, translations, ":class:`%s`"),
1056
- "control": lambda x: "*%s*" % x,
1057
- "delimiter": lambda x: x,
1058
- "reference": lambda x: x,
1083
+ 'literal': lambda x: '``%s``' % x,
1084
+ 'obj': lambda x: convert_obj(x, translations, ':class:`%s`'),
1085
+ 'control': lambda x: '*%s*' % x,
1086
+ 'delimiter': lambda x: x,
1087
+ 'reference': lambda x: x,
1059
1088
  }
1060
1089
 
1061
- converted = "".join(converters.get(type_)(token) # type: ignore[misc]
1062
- for token, type_ in types)
1090
+ converted = ''.join(
1091
+ converters.get(type_)(token) # type: ignore[misc]
1092
+ for token, type_ in types
1093
+ )
1063
1094
 
1064
1095
  return converted
1065
1096
 
@@ -1181,20 +1212,21 @@ class NumpyDocstring(GoogleDocstring):
1181
1212
  if filepath is None and name is None:
1182
1213
  return None
1183
1214
  elif filepath is None:
1184
- filepath = ""
1215
+ filepath = ''
1185
1216
 
1186
- return f"{filepath}:docstring of {name}"
1217
+ return f'{filepath}:docstring of {name}'
1187
1218
 
1188
1219
  def _escape_args_and_kwargs(self, name: str) -> str:
1189
1220
  func = super()._escape_args_and_kwargs
1190
1221
 
1191
- if ", " in name:
1192
- return ", ".join(map(func, name.split(", ")))
1222
+ if ', ' in name:
1223
+ return ', '.join(map(func, name.split(', ')))
1193
1224
  else:
1194
1225
  return func(name)
1195
1226
 
1196
- def _consume_field(self, parse_type: bool = True, prefer_type: bool = False,
1197
- ) -> tuple[str, str, list[str]]:
1227
+ def _consume_field(
1228
+ self, parse_type: bool = True, prefer_type: bool = False
1229
+ ) -> tuple[str, str, list[str]]:
1198
1230
  line = self._lines.next()
1199
1231
  if parse_type:
1200
1232
  _name, _, _type = self._partition_field_on_colon(line)
@@ -1221,8 +1253,9 @@ class NumpyDocstring(GoogleDocstring):
1221
1253
  _desc = self.__class__(_desc, self._config).lines()
1222
1254
  return _name, _type, _desc
1223
1255
 
1224
- def _consume_returns_section(self, preprocess_types: bool = False,
1225
- ) -> list[tuple[str, str, list[str]]]:
1256
+ def _consume_returns_section(
1257
+ self, preprocess_types: bool = False
1258
+ ) -> list[tuple[str, str, list[str]]]:
1226
1259
  return self._consume_fields(prefer_type=True)
1227
1260
 
1228
1261
  def _consume_section_header(self) -> str:
@@ -1234,12 +1267,16 @@ class NumpyDocstring(GoogleDocstring):
1234
1267
 
1235
1268
  def _is_section_break(self) -> bool:
1236
1269
  line1, line2 = self._lines.get(0), self._lines.get(1)
1237
- return (not self._lines or
1238
- self._is_section_header() or
1239
- (line1 == line2 == '') or
1240
- (self._is_in_section and
1241
- line1 and
1242
- not self._is_indented(line1, self._section_indent)))
1270
+ return (
1271
+ not self._lines
1272
+ or self._is_section_header()
1273
+ or (line1 == line2 == '')
1274
+ or (
1275
+ self._is_in_section
1276
+ and line1
1277
+ and not self._is_indented(line1, self._section_indent)
1278
+ )
1279
+ )
1243
1280
 
1244
1281
  def _is_section_header(self) -> bool:
1245
1282
  section, underline = self._lines.get(0), self._lines.get(1)
@@ -1262,8 +1299,6 @@ class NumpyDocstring(GoogleDocstring):
1262
1299
 
1263
1300
  def _parse_numpydoc_see_also_section(self, content: list[str]) -> list[str]:
1264
1301
  """
1265
- Derived from the NumpyDoc implementation of _parse_see_also.
1266
-
1267
1302
  See Also
1268
1303
  --------
1269
1304
  func_name : Descriptive text
@@ -1271,6 +1306,37 @@ class NumpyDocstring(GoogleDocstring):
1271
1306
  another_func_name : Descriptive text
1272
1307
  func_name1, func_name2, :meth:`func_name`, func_name3
1273
1308
 
1309
+ Licence
1310
+ -------
1311
+
1312
+ Derived from the NumpyDoc implementation of ``_parse_see_also``,
1313
+ which was under the following licence:
1314
+
1315
+ Copyright (C) 2008 Stefan van der Walt <stefan@mentat.za.net>,
1316
+ Pauli Virtanen <pav@iki.fi>
1317
+
1318
+ Redistribution and use in source and binary forms, with or without
1319
+ modification, are permitted provided that the following conditions are
1320
+ met:
1321
+
1322
+ 1. Redistributions of source code must retain the above copyright
1323
+ notice, this list of conditions and the following disclaimer.
1324
+ 2. Redistributions in binary form must reproduce the above copyright
1325
+ notice, this list of conditions and the following disclaimer in
1326
+ the documentation and/or other materials provided with the
1327
+ distribution.
1328
+
1329
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
1330
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1331
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1332
+ DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
1333
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1334
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1335
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1336
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1337
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
1338
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1339
+ POSSIBILITY OF SUCH DAMAGE.
1274
1340
  """
1275
1341
  items: list[tuple[str, list[str], str | None]] = []
1276
1342
 
@@ -1283,7 +1349,7 @@ class NumpyDocstring(GoogleDocstring):
1283
1349
  return g[3], None
1284
1350
  else:
1285
1351
  return g[2], g[1]
1286
- raise ValueError("%s is not a item name" % text)
1352
+ raise ValueError('%s is not a item name' % text)
1287
1353
 
1288
1354
  def push_item(name: str | None, rest: list[str]) -> None:
1289
1355
  if not name:
@@ -1293,7 +1359,9 @@ class NumpyDocstring(GoogleDocstring):
1293
1359
  rest.clear()
1294
1360
 
1295
1361
  def translate(
1296
- func: str, description: list[str], role: str | None,
1362
+ func: str,
1363
+ description: list[str],
1364
+ role: str | None,
1297
1365
  ) -> tuple[str, list[str], str | None]:
1298
1366
  translations = self._config.napoleon_type_aliases
1299
1367
  if role is not None or not translations:
@@ -1305,8 +1373,8 @@ class NumpyDocstring(GoogleDocstring):
1305
1373
  return translated, description, role
1306
1374
 
1307
1375
  groups = match.groupdict()
1308
- role = groups["role"]
1309
- new_func = groups["name"] or groups["name2"]
1376
+ role = groups['role']
1377
+ new_func = groups['name'] or groups['name2']
1310
1378
 
1311
1379
  return new_func, description, role
1312
1380
 
@@ -1318,9 +1386,9 @@ class NumpyDocstring(GoogleDocstring):
1318
1386
  continue
1319
1387
 
1320
1388
  m = self._name_rgx.match(line)
1321
- if m and line[m.end():].strip().startswith(':'):
1389
+ if m and line[m.end() :].strip().startswith(':'):
1322
1390
  push_item(current_func, rest)
1323
- current_func, line = line[:m.end()], line[m.end():]
1391
+ current_func, line = line[: m.end()], line[m.end() :]
1324
1392
  rest = [line.split(':', 1)[1].strip()]
1325
1393
  if not rest[0]:
1326
1394
  rest = []
@@ -1354,7 +1422,7 @@ class NumpyDocstring(GoogleDocstring):
1354
1422
  lines += ['']
1355
1423
  lines += [link]
1356
1424
  else:
1357
- lines[-1] += ", %s" % link
1425
+ lines[-1] += ', %s' % link
1358
1426
  if desc:
1359
1427
  lines += self._indent([' '.join(desc)])
1360
1428
  last_had_desc = True