Sphinx 7.3.7__py3-none-any.whl → 7.4.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 (357) hide show
  1. sphinx/__init__.py +5 -6
  2. sphinx/_cli/__init__.py +296 -0
  3. sphinx/_cli/util/__init__.py +0 -0
  4. sphinx/_cli/util/colour.py +103 -0
  5. sphinx/_cli/util/errors.py +165 -0
  6. sphinx/application.py +78 -43
  7. sphinx/builders/__init__.py +59 -15
  8. sphinx/builders/_epub_base.py +11 -5
  9. sphinx/builders/changes.py +2 -2
  10. sphinx/builders/epub3.py +2 -2
  11. sphinx/builders/gettext.py +10 -10
  12. sphinx/builders/html/__init__.py +56 -54
  13. sphinx/builders/latex/__init__.py +5 -5
  14. sphinx/builders/latex/constants.py +5 -0
  15. sphinx/builders/linkcheck.py +73 -38
  16. sphinx/builders/texinfo.py +1 -1
  17. sphinx/cmd/build.py +1 -1
  18. sphinx/cmd/quickstart.py +11 -11
  19. sphinx/config.py +57 -38
  20. sphinx/directives/__init__.py +7 -9
  21. sphinx/directives/code.py +12 -15
  22. sphinx/directives/other.py +12 -15
  23. sphinx/directives/patches.py +26 -0
  24. sphinx/domains/__init__.py +1 -1
  25. sphinx/domains/c/__init__.py +5 -5
  26. sphinx/domains/c/_ast.py +436 -12
  27. sphinx/domains/c/_symbol.py +89 -134
  28. sphinx/domains/changeset.py +3 -4
  29. sphinx/domains/cpp/__init__.py +5 -6
  30. sphinx/domains/cpp/_ast.py +822 -25
  31. sphinx/domains/cpp/_symbol.py +3 -0
  32. sphinx/domains/javascript.py +3 -6
  33. sphinx/domains/math.py +3 -2
  34. sphinx/domains/python/__init__.py +44 -6
  35. sphinx/domains/python/_object.py +7 -5
  36. sphinx/domains/rst.py +2 -2
  37. sphinx/domains/std/__init__.py +95 -14
  38. sphinx/environment/__init__.py +35 -15
  39. sphinx/environment/adapters/indexentries.py +71 -24
  40. sphinx/environment/adapters/toctree.py +1 -1
  41. sphinx/environment/collectors/__init__.py +18 -4
  42. sphinx/environment/collectors/asset.py +4 -4
  43. sphinx/environment/collectors/toctree.py +27 -14
  44. sphinx/events.py +7 -6
  45. sphinx/ext/apidoc.py +377 -170
  46. sphinx/ext/autodoc/__init__.py +13 -13
  47. sphinx/ext/autodoc/directive.py +10 -13
  48. sphinx/ext/autodoc/mock.py +10 -7
  49. sphinx/ext/autodoc/preserve_defaults.py +1 -1
  50. sphinx/ext/autodoc/typehints.py +2 -2
  51. sphinx/ext/autosummary/__init__.py +15 -9
  52. sphinx/ext/autosummary/generate.py +270 -154
  53. sphinx/ext/coverage.py +108 -18
  54. sphinx/ext/duration.py +10 -3
  55. sphinx/ext/extlinks.py +3 -2
  56. sphinx/ext/graphviz.py +3 -3
  57. sphinx/ext/ifconfig.py +1 -2
  58. sphinx/ext/imgconverter.py +1 -0
  59. sphinx/ext/imgmath.py +7 -6
  60. sphinx/ext/inheritance_diagram.py +3 -3
  61. sphinx/ext/intersphinx/__init__.py +81 -0
  62. sphinx/ext/intersphinx/__main__.py +10 -0
  63. sphinx/ext/intersphinx/_cli.py +44 -0
  64. sphinx/ext/intersphinx/_load.py +253 -0
  65. sphinx/ext/{intersphinx.py → intersphinx/_resolve.py} +17 -368
  66. sphinx/ext/intersphinx/_shared.py +53 -0
  67. sphinx/ext/mathjax.py +1 -1
  68. sphinx/ext/todo.py +2 -2
  69. sphinx/io.py +2 -6
  70. sphinx/locale/__init__.py +1 -5
  71. sphinx/locale/ar/LC_MESSAGES/sphinx.js +1 -1
  72. sphinx/locale/ar/LC_MESSAGES/sphinx.mo +0 -0
  73. sphinx/locale/ar/LC_MESSAGES/sphinx.po +678 -471
  74. sphinx/locale/bg/LC_MESSAGES/sphinx.js +1 -1
  75. sphinx/locale/bg/LC_MESSAGES/sphinx.mo +0 -0
  76. sphinx/locale/bg/LC_MESSAGES/sphinx.po +684 -476
  77. sphinx/locale/bn/LC_MESSAGES/sphinx.js +1 -1
  78. sphinx/locale/bn/LC_MESSAGES/sphinx.mo +0 -0
  79. sphinx/locale/bn/LC_MESSAGES/sphinx.po +679 -472
  80. sphinx/locale/ca/LC_MESSAGES/sphinx.js +1 -1
  81. sphinx/locale/ca/LC_MESSAGES/sphinx.mo +0 -0
  82. sphinx/locale/ca/LC_MESSAGES/sphinx.po +681 -474
  83. sphinx/locale/cak/LC_MESSAGES/sphinx.js +1 -1
  84. sphinx/locale/cak/LC_MESSAGES/sphinx.mo +0 -0
  85. sphinx/locale/cak/LC_MESSAGES/sphinx.po +678 -471
  86. sphinx/locale/cs/LC_MESSAGES/sphinx.js +1 -1
  87. sphinx/locale/cs/LC_MESSAGES/sphinx.mo +0 -0
  88. sphinx/locale/cs/LC_MESSAGES/sphinx.po +679 -472
  89. sphinx/locale/cy/LC_MESSAGES/sphinx.js +1 -1
  90. sphinx/locale/cy/LC_MESSAGES/sphinx.mo +0 -0
  91. sphinx/locale/cy/LC_MESSAGES/sphinx.po +679 -472
  92. sphinx/locale/da/LC_MESSAGES/sphinx.js +1 -1
  93. sphinx/locale/da/LC_MESSAGES/sphinx.mo +0 -0
  94. sphinx/locale/da/LC_MESSAGES/sphinx.po +679 -472
  95. sphinx/locale/de/LC_MESSAGES/sphinx.js +1 -1
  96. sphinx/locale/de/LC_MESSAGES/sphinx.mo +0 -0
  97. sphinx/locale/de/LC_MESSAGES/sphinx.po +679 -472
  98. sphinx/locale/de_DE/LC_MESSAGES/sphinx.js +1 -1
  99. sphinx/locale/de_DE/LC_MESSAGES/sphinx.mo +0 -0
  100. sphinx/locale/de_DE/LC_MESSAGES/sphinx.po +678 -471
  101. sphinx/locale/el/LC_MESSAGES/sphinx.js +1 -1
  102. sphinx/locale/el/LC_MESSAGES/sphinx.mo +0 -0
  103. sphinx/locale/el/LC_MESSAGES/sphinx.po +701 -494
  104. sphinx/locale/en_DE/LC_MESSAGES/sphinx.js +1 -1
  105. sphinx/locale/en_DE/LC_MESSAGES/sphinx.mo +0 -0
  106. sphinx/locale/en_DE/LC_MESSAGES/sphinx.po +700 -493
  107. sphinx/locale/en_FR/LC_MESSAGES/sphinx.js +1 -1
  108. sphinx/locale/en_FR/LC_MESSAGES/sphinx.mo +0 -0
  109. sphinx/locale/en_FR/LC_MESSAGES/sphinx.po +700 -493
  110. sphinx/locale/en_GB/LC_MESSAGES/sphinx.js +1 -1
  111. sphinx/locale/en_GB/LC_MESSAGES/sphinx.mo +0 -0
  112. sphinx/locale/en_GB/LC_MESSAGES/sphinx.po +701 -494
  113. sphinx/locale/en_HK/LC_MESSAGES/sphinx.js +1 -1
  114. sphinx/locale/en_HK/LC_MESSAGES/sphinx.mo +0 -0
  115. sphinx/locale/en_HK/LC_MESSAGES/sphinx.po +700 -493
  116. sphinx/locale/eo/LC_MESSAGES/sphinx.js +1 -1
  117. sphinx/locale/eo/LC_MESSAGES/sphinx.mo +0 -0
  118. sphinx/locale/eo/LC_MESSAGES/sphinx.po +701 -494
  119. sphinx/locale/es/LC_MESSAGES/sphinx.js +1 -1
  120. sphinx/locale/es/LC_MESSAGES/sphinx.mo +0 -0
  121. sphinx/locale/es/LC_MESSAGES/sphinx.po +701 -494
  122. sphinx/locale/es_CO/LC_MESSAGES/sphinx.js +1 -1
  123. sphinx/locale/es_CO/LC_MESSAGES/sphinx.mo +0 -0
  124. sphinx/locale/es_CO/LC_MESSAGES/sphinx.po +700 -493
  125. sphinx/locale/et/LC_MESSAGES/sphinx.js +1 -1
  126. sphinx/locale/et/LC_MESSAGES/sphinx.mo +0 -0
  127. sphinx/locale/et/LC_MESSAGES/sphinx.po +701 -494
  128. sphinx/locale/eu/LC_MESSAGES/sphinx.js +1 -1
  129. sphinx/locale/eu/LC_MESSAGES/sphinx.mo +0 -0
  130. sphinx/locale/eu/LC_MESSAGES/sphinx.po +701 -494
  131. sphinx/locale/fa/LC_MESSAGES/sphinx.js +1 -1
  132. sphinx/locale/fa/LC_MESSAGES/sphinx.mo +0 -0
  133. sphinx/locale/fa/LC_MESSAGES/sphinx.po +701 -494
  134. sphinx/locale/fi/LC_MESSAGES/sphinx.js +1 -1
  135. sphinx/locale/fi/LC_MESSAGES/sphinx.mo +0 -0
  136. sphinx/locale/fi/LC_MESSAGES/sphinx.po +700 -493
  137. sphinx/locale/fr/LC_MESSAGES/sphinx.js +1 -1
  138. sphinx/locale/fr/LC_MESSAGES/sphinx.mo +0 -0
  139. sphinx/locale/fr/LC_MESSAGES/sphinx.po +725 -518
  140. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.js +1 -1
  141. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.mo +0 -0
  142. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.po +700 -493
  143. sphinx/locale/gl/LC_MESSAGES/sphinx.js +1 -1
  144. sphinx/locale/gl/LC_MESSAGES/sphinx.mo +0 -0
  145. sphinx/locale/gl/LC_MESSAGES/sphinx.po +701 -494
  146. sphinx/locale/he/LC_MESSAGES/sphinx.js +1 -1
  147. sphinx/locale/he/LC_MESSAGES/sphinx.mo +0 -0
  148. sphinx/locale/he/LC_MESSAGES/sphinx.po +700 -493
  149. sphinx/locale/hi/LC_MESSAGES/sphinx.js +1 -1
  150. sphinx/locale/hi/LC_MESSAGES/sphinx.mo +0 -0
  151. sphinx/locale/hi/LC_MESSAGES/sphinx.po +701 -494
  152. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.js +1 -1
  153. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.mo +0 -0
  154. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.po +700 -493
  155. sphinx/locale/hr/LC_MESSAGES/sphinx.js +1 -1
  156. sphinx/locale/hr/LC_MESSAGES/sphinx.mo +0 -0
  157. sphinx/locale/hr/LC_MESSAGES/sphinx.po +701 -494
  158. sphinx/locale/hu/LC_MESSAGES/sphinx.js +1 -1
  159. sphinx/locale/hu/LC_MESSAGES/sphinx.mo +0 -0
  160. sphinx/locale/hu/LC_MESSAGES/sphinx.po +701 -494
  161. sphinx/locale/id/LC_MESSAGES/sphinx.js +1 -1
  162. sphinx/locale/id/LC_MESSAGES/sphinx.mo +0 -0
  163. sphinx/locale/id/LC_MESSAGES/sphinx.po +701 -494
  164. sphinx/locale/is/LC_MESSAGES/sphinx.js +1 -1
  165. sphinx/locale/is/LC_MESSAGES/sphinx.mo +0 -0
  166. sphinx/locale/is/LC_MESSAGES/sphinx.po +700 -493
  167. sphinx/locale/it/LC_MESSAGES/sphinx.js +1 -1
  168. sphinx/locale/it/LC_MESSAGES/sphinx.mo +0 -0
  169. sphinx/locale/it/LC_MESSAGES/sphinx.po +708 -500
  170. sphinx/locale/ja/LC_MESSAGES/sphinx.js +1 -1
  171. sphinx/locale/ja/LC_MESSAGES/sphinx.mo +0 -0
  172. sphinx/locale/ja/LC_MESSAGES/sphinx.po +701 -494
  173. sphinx/locale/ka/LC_MESSAGES/sphinx.js +1 -1
  174. sphinx/locale/ka/LC_MESSAGES/sphinx.mo +0 -0
  175. sphinx/locale/ka/LC_MESSAGES/sphinx.po +700 -493
  176. sphinx/locale/ko/LC_MESSAGES/sphinx.js +1 -1
  177. sphinx/locale/ko/LC_MESSAGES/sphinx.mo +0 -0
  178. sphinx/locale/ko/LC_MESSAGES/sphinx.po +701 -494
  179. sphinx/locale/lt/LC_MESSAGES/sphinx.js +1 -1
  180. sphinx/locale/lt/LC_MESSAGES/sphinx.mo +0 -0
  181. sphinx/locale/lt/LC_MESSAGES/sphinx.po +701 -494
  182. sphinx/locale/lv/LC_MESSAGES/sphinx.js +1 -1
  183. sphinx/locale/lv/LC_MESSAGES/sphinx.mo +0 -0
  184. sphinx/locale/lv/LC_MESSAGES/sphinx.po +701 -494
  185. sphinx/locale/mk/LC_MESSAGES/sphinx.js +1 -1
  186. sphinx/locale/mk/LC_MESSAGES/sphinx.mo +0 -0
  187. sphinx/locale/mk/LC_MESSAGES/sphinx.po +700 -493
  188. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.js +1 -1
  189. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.mo +0 -0
  190. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.po +701 -494
  191. sphinx/locale/ne/LC_MESSAGES/sphinx.js +1 -1
  192. sphinx/locale/ne/LC_MESSAGES/sphinx.mo +0 -0
  193. sphinx/locale/ne/LC_MESSAGES/sphinx.po +701 -494
  194. sphinx/locale/nl/LC_MESSAGES/sphinx.js +1 -1
  195. sphinx/locale/nl/LC_MESSAGES/sphinx.mo +0 -0
  196. sphinx/locale/nl/LC_MESSAGES/sphinx.po +701 -494
  197. sphinx/locale/pl/LC_MESSAGES/sphinx.js +1 -1
  198. sphinx/locale/pl/LC_MESSAGES/sphinx.mo +0 -0
  199. sphinx/locale/pl/LC_MESSAGES/sphinx.po +701 -494
  200. sphinx/locale/pt/LC_MESSAGES/sphinx.js +1 -1
  201. sphinx/locale/pt/LC_MESSAGES/sphinx.mo +0 -0
  202. sphinx/locale/pt/LC_MESSAGES/sphinx.po +700 -493
  203. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.js +1 -1
  204. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +0 -0
  205. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +705 -498
  206. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.js +1 -1
  207. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo +0 -0
  208. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po +701 -494
  209. sphinx/locale/ro/LC_MESSAGES/sphinx.js +1 -1
  210. sphinx/locale/ro/LC_MESSAGES/sphinx.mo +0 -0
  211. sphinx/locale/ro/LC_MESSAGES/sphinx.po +701 -494
  212. sphinx/locale/ru/LC_MESSAGES/sphinx.js +1 -1
  213. sphinx/locale/ru/LC_MESSAGES/sphinx.mo +0 -0
  214. sphinx/locale/ru/LC_MESSAGES/sphinx.po +890 -680
  215. sphinx/locale/si/LC_MESSAGES/sphinx.js +1 -1
  216. sphinx/locale/si/LC_MESSAGES/sphinx.mo +0 -0
  217. sphinx/locale/si/LC_MESSAGES/sphinx.po +700 -493
  218. sphinx/locale/sk/LC_MESSAGES/sphinx.js +1 -1
  219. sphinx/locale/sk/LC_MESSAGES/sphinx.mo +0 -0
  220. sphinx/locale/sk/LC_MESSAGES/sphinx.po +701 -494
  221. sphinx/locale/sl/LC_MESSAGES/sphinx.js +1 -1
  222. sphinx/locale/sl/LC_MESSAGES/sphinx.mo +0 -0
  223. sphinx/locale/sl/LC_MESSAGES/sphinx.po +701 -494
  224. sphinx/locale/sphinx.pot +702 -494
  225. sphinx/locale/sq/LC_MESSAGES/sphinx.js +1 -1
  226. sphinx/locale/sq/LC_MESSAGES/sphinx.mo +0 -0
  227. sphinx/locale/sq/LC_MESSAGES/sphinx.po +704 -497
  228. sphinx/locale/sr/LC_MESSAGES/sphinx.js +1 -1
  229. sphinx/locale/sr/LC_MESSAGES/sphinx.mo +0 -0
  230. sphinx/locale/sr/LC_MESSAGES/sphinx.po +700 -493
  231. sphinx/locale/sr@latin/LC_MESSAGES/sphinx.mo +0 -0
  232. sphinx/locale/sr_RS/LC_MESSAGES/sphinx.mo +0 -0
  233. sphinx/locale/sv/LC_MESSAGES/sphinx.js +1 -1
  234. sphinx/locale/sv/LC_MESSAGES/sphinx.mo +0 -0
  235. sphinx/locale/sv/LC_MESSAGES/sphinx.po +701 -494
  236. sphinx/locale/ta/LC_MESSAGES/sphinx.po +1016 -808
  237. sphinx/locale/te/LC_MESSAGES/sphinx.js +1 -1
  238. sphinx/locale/te/LC_MESSAGES/sphinx.mo +0 -0
  239. sphinx/locale/te/LC_MESSAGES/sphinx.po +700 -493
  240. sphinx/locale/tr/LC_MESSAGES/sphinx.js +1 -1
  241. sphinx/locale/tr/LC_MESSAGES/sphinx.mo +0 -0
  242. sphinx/locale/tr/LC_MESSAGES/sphinx.po +701 -494
  243. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.js +1 -1
  244. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +0 -0
  245. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +701 -494
  246. sphinx/locale/ur/LC_MESSAGES/sphinx.js +1 -1
  247. sphinx/locale/ur/LC_MESSAGES/sphinx.mo +0 -0
  248. sphinx/locale/ur/LC_MESSAGES/sphinx.po +700 -493
  249. sphinx/locale/vi/LC_MESSAGES/sphinx.js +1 -1
  250. sphinx/locale/vi/LC_MESSAGES/sphinx.mo +0 -0
  251. sphinx/locale/vi/LC_MESSAGES/sphinx.po +701 -494
  252. sphinx/locale/yue/LC_MESSAGES/sphinx.js +1 -1
  253. sphinx/locale/yue/LC_MESSAGES/sphinx.mo +0 -0
  254. sphinx/locale/yue/LC_MESSAGES/sphinx.po +700 -493
  255. sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po +704 -496
  256. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.js +1 -1
  257. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.mo +0 -0
  258. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.po +700 -493
  259. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.js +1 -1
  260. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +0 -0
  261. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +729 -522
  262. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.js +1 -1
  263. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.mo +0 -0
  264. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.po +700 -493
  265. sphinx/roles.py +1 -1
  266. sphinx/search/__init__.py +17 -9
  267. sphinx/templates/quickstart/{root_doc.rst_t → root_doc.rst.jinja} +7 -10
  268. sphinx/testing/fixtures.py +22 -20
  269. sphinx/testing/path.py +6 -2
  270. sphinx/testing/util.py +8 -13
  271. sphinx/texinputs/sphinx.sty +449 -332
  272. sphinx/texinputs/sphinxlatexadmonitions.sty +209 -66
  273. sphinx/texinputs/sphinxlatexliterals.sty +9 -16
  274. sphinx/texinputs/sphinxlatexstyletext.sty +4 -38
  275. sphinx/texinputs/sphinxlatextables.sty +6 -14
  276. sphinx/texinputs/sphinxpackageboxes.sty +15 -42
  277. sphinx/texinputs/sphinxpackagefootnote.sty +4 -3
  278. sphinx/themes/agogo/layout.html +3 -3
  279. sphinx/themes/basic/genindex-single.html +2 -1
  280. sphinx/themes/basic/layout.html +3 -6
  281. sphinx/themes/basic/static/searchtools.js +4 -3
  282. sphinx/themes/haiku/layout.html +4 -4
  283. sphinx/themes/pyramid/layout.html +1 -1
  284. sphinx/themes/scrolls/layout.html +2 -2
  285. sphinx/theming.py +3 -3
  286. sphinx/transforms/__init__.py +34 -20
  287. sphinx/transforms/i18n.py +8 -7
  288. sphinx/transforms/post_transforms/__init__.py +1 -1
  289. sphinx/transforms/post_transforms/images.py +7 -10
  290. sphinx/util/_pathlib.py +2 -2
  291. sphinx/util/cfamily.py +52 -30
  292. sphinx/util/console.py +1 -1
  293. sphinx/util/display.py +16 -11
  294. sphinx/util/docutils.py +88 -40
  295. sphinx/util/fileutil.py +15 -3
  296. sphinx/util/images.py +1 -0
  297. sphinx/util/inspect.py +66 -22
  298. sphinx/util/inventory.py +15 -0
  299. sphinx/util/logging.py +14 -21
  300. sphinx/util/math.py +3 -1
  301. sphinx/util/nodes.py +9 -12
  302. sphinx/util/osutil.py +5 -5
  303. sphinx/util/parsing.py +93 -0
  304. sphinx/util/tags.py +71 -47
  305. sphinx/util/typing.py +261 -143
  306. sphinx/versioning.py +17 -17
  307. sphinx/writers/html5.py +26 -19
  308. sphinx/writers/latex.py +58 -28
  309. sphinx/writers/manpage.py +4 -3
  310. sphinx/writers/texinfo.py +19 -14
  311. {sphinx-7.3.7.dist-info → sphinx-7.4.0.dist-info}/METADATA +21 -20
  312. sphinx-7.4.0.dist-info/RECORD +591 -0
  313. sphinx-7.3.7.dist-info/RECORD +0 -581
  314. /sphinx/templates/apidoc/{module.rst_t → module.rst.jinja} +0 -0
  315. /sphinx/templates/apidoc/{package.rst_t → package.rst.jinja} +0 -0
  316. /sphinx/templates/apidoc/{toc.rst_t → toc.rst.jinja} +0 -0
  317. /sphinx/templates/epub3/{content.opf_t → content.opf.jinja} +0 -0
  318. /sphinx/templates/epub3/{nav.xhtml_t → nav.xhtml.jinja} +0 -0
  319. /sphinx/templates/epub3/{toc.ncx_t → toc.ncx.jinja} +0 -0
  320. /sphinx/templates/gettext/{message.pot_t → message.pot.jinja} +0 -0
  321. /sphinx/templates/imgmath/{preview.tex_t → preview.tex.jinja} +0 -0
  322. /sphinx/templates/imgmath/{template.tex_t → template.tex.jinja} +0 -0
  323. /sphinx/templates/latex/{latex.tex_t → latex.tex.jinja} +0 -0
  324. /sphinx/templates/latex/{longtable.tex_t → longtable.tex.jinja} +0 -0
  325. /sphinx/templates/latex/{sphinxmessages.sty_t → sphinxmessages.sty.jinja} +0 -0
  326. /sphinx/templates/latex/{tabular.tex_t → tabular.tex.jinja} +0 -0
  327. /sphinx/templates/latex/{tabulary.tex_t → tabulary.tex.jinja} +0 -0
  328. /sphinx/templates/quickstart/{Makefile_t → Makefile.jinja} +0 -0
  329. /sphinx/templates/quickstart/{Makefile.new_t → Makefile.new.jinja} +0 -0
  330. /sphinx/templates/quickstart/{conf.py_t → conf.py.jinja} +0 -0
  331. /sphinx/templates/quickstart/{make.bat_t → make.bat.jinja} +0 -0
  332. /sphinx/templates/quickstart/{make.bat.new_t → make.bat.new.jinja} +0 -0
  333. /sphinx/texinputs/{Makefile_t → Makefile.jinja} +0 -0
  334. /sphinx/texinputs/{latexmkjarc_t → latexmkjarc.jinja} +0 -0
  335. /sphinx/texinputs/{latexmkrc_t → latexmkrc.jinja} +0 -0
  336. /sphinx/texinputs/{make.bat_t → make.bat.jinja} +0 -0
  337. /sphinx/texinputs_win/{Makefile_t → Makefile.jinja} +0 -0
  338. /sphinx/themes/agogo/static/{agogo.css_t → agogo.css.jinja} +0 -0
  339. /sphinx/themes/basic/static/{basic.css_t → basic.css.jinja} +0 -0
  340. /sphinx/themes/basic/static/{documentation_options.js_t → documentation_options.js.jinja} +0 -0
  341. /sphinx/themes/basic/static/{language_data.js_t → language_data.js.jinja} +0 -0
  342. /sphinx/themes/bizstyle/static/{bizstyle.css_t → bizstyle.css.jinja} +0 -0
  343. /sphinx/themes/bizstyle/static/{bizstyle.js_t → bizstyle.js.jinja} +0 -0
  344. /sphinx/themes/classic/static/{classic.css_t → classic.css.jinja} +0 -0
  345. /sphinx/themes/classic/static/{sidebar.js_t → sidebar.js.jinja} +0 -0
  346. /sphinx/themes/epub/static/{epub.css_t → epub.css.jinja} +0 -0
  347. /sphinx/themes/haiku/static/{haiku.css_t → haiku.css.jinja} +0 -0
  348. /sphinx/themes/nature/static/{nature.css_t → nature.css.jinja} +0 -0
  349. /sphinx/themes/nonav/static/{nonav.css_t → nonav.css.jinja} +0 -0
  350. /sphinx/themes/pyramid/static/{epub.css_t → epub.css.jinja} +0 -0
  351. /sphinx/themes/pyramid/static/{pyramid.css_t → pyramid.css.jinja} +0 -0
  352. /sphinx/themes/scrolls/static/{scrolls.css_t → scrolls.css.jinja} +0 -0
  353. /sphinx/themes/sphinxdoc/static/{sphinxdoc.css_t → sphinxdoc.css.jinja} +0 -0
  354. /sphinx/themes/traditional/static/{traditional.css_t → traditional.css.jinja} +0 -0
  355. {sphinx-7.3.7.dist-info → sphinx-7.4.0.dist-info}/LICENSE.rst +0 -0
  356. {sphinx-7.3.7.dist-info → sphinx-7.4.0.dist-info}/WHEEL +0 -0
  357. {sphinx-7.3.7.dist-info → sphinx-7.4.0.dist-info}/entry_points.txt +0 -0
sphinx/domains/c/_ast.py CHANGED
@@ -1,5 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import sys
4
+ import warnings
3
5
  from typing import TYPE_CHECKING, Any, Union, cast
4
6
 
5
7
  from docutils import nodes
@@ -38,39 +40,40 @@ class ASTBase(ASTBaseBase):
38
40
  ################################################################################
39
41
 
40
42
  class ASTIdentifier(ASTBaseBase):
41
- def __init__(self, identifier: str) -> None:
42
- assert identifier is not None
43
- assert len(identifier) != 0
44
- self.identifier = identifier
43
+ def __init__(self, name: str) -> None:
44
+ if not isinstance(name, str) or len(name) == 0:
45
+ raise AssertionError
46
+ self.name = sys.intern(name)
47
+ self.is_anonymous = name[0] == '@'
45
48
 
46
49
  # ASTBaseBase already implements this method,
47
50
  # but specialising it here improves performance
48
51
  def __eq__(self, other: object) -> bool:
49
- if type(other) is not ASTIdentifier:
52
+ if not isinstance(other, ASTIdentifier):
50
53
  return NotImplemented
51
- return self.identifier == other.identifier
54
+ return self.name == other.name
52
55
 
53
56
  def is_anon(self) -> bool:
54
- return self.identifier[0] == '@'
57
+ return self.is_anonymous
55
58
 
56
59
  # and this is where we finally make a difference between __str__ and the display string
57
60
 
58
61
  def __str__(self) -> str:
59
- return self.identifier
62
+ return self.name
60
63
 
61
64
  def get_display_string(self) -> str:
62
- return "[anonymous]" if self.is_anon() else self.identifier
65
+ return "[anonymous]" if self.is_anonymous else self.name
63
66
 
64
67
  def describe_signature(self, signode: TextElement, mode: str, env: BuildEnvironment,
65
68
  prefix: str, symbol: Symbol) -> None:
66
69
  # note: slightly different signature of describe_signature due to the prefix
67
70
  verify_description_mode(mode)
68
- if self.is_anon():
71
+ if self.is_anonymous:
69
72
  node = addnodes.desc_sig_name(text="[anonymous]")
70
73
  else:
71
- node = addnodes.desc_sig_name(self.identifier, self.identifier)
74
+ node = addnodes.desc_sig_name(self.name, self.name)
72
75
  if mode == 'markType':
73
- targetText = prefix + self.identifier
76
+ targetText = prefix + self.name
74
77
  pnode = addnodes.pending_xref('', refdomain='c',
75
78
  reftype='identifier',
76
79
  reftarget=targetText, modname=None,
@@ -87,6 +90,14 @@ class ASTIdentifier(ASTBaseBase):
87
90
  else:
88
91
  raise Exception('Unknown description mode: %s' % mode)
89
92
 
93
+ @property
94
+ def identifier(self) -> str:
95
+ warnings.warn(
96
+ '`ASTIdentifier.identifier` is deprecated, use `ASTIdentifier.name` instead',
97
+ DeprecationWarning, stacklevel=2,
98
+ )
99
+ return self.name
100
+
90
101
 
91
102
  class ASTNestedName(ASTBase):
92
103
  def __init__(self, names: list[ASTIdentifier], rooted: bool) -> None:
@@ -94,6 +105,14 @@ class ASTNestedName(ASTBase):
94
105
  self.names = names
95
106
  self.rooted = rooted
96
107
 
108
+ def __eq__(self, other: object) -> bool:
109
+ if not isinstance(other, ASTNestedName):
110
+ return NotImplemented
111
+ return self.names == other.names and self.rooted == other.rooted
112
+
113
+ def __hash__(self) -> int:
114
+ return hash((self.names, self.rooted))
115
+
97
116
  @property
98
117
  def name(self) -> ASTNestedName:
99
118
  return self
@@ -186,6 +205,14 @@ class ASTBooleanLiteral(ASTLiteral):
186
205
  def __init__(self, value: bool) -> None:
187
206
  self.value = value
188
207
 
208
+ def __eq__(self, other: object) -> bool:
209
+ if not isinstance(other, ASTBooleanLiteral):
210
+ return NotImplemented
211
+ return self.value == other.value
212
+
213
+ def __hash__(self) -> int:
214
+ return hash(self.value)
215
+
189
216
  def _stringify(self, transform: StringifyTransform) -> str:
190
217
  if self.value:
191
218
  return 'true'
@@ -202,6 +229,14 @@ class ASTNumberLiteral(ASTLiteral):
202
229
  def __init__(self, data: str) -> None:
203
230
  self.data = data
204
231
 
232
+ def __eq__(self, other: object) -> bool:
233
+ if not isinstance(other, ASTNumberLiteral):
234
+ return NotImplemented
235
+ return self.data == other.data
236
+
237
+ def __hash__(self) -> int:
238
+ return hash(self.data)
239
+
205
240
  def _stringify(self, transform: StringifyTransform) -> str:
206
241
  return self.data
207
242
 
@@ -221,6 +256,17 @@ class ASTCharLiteral(ASTLiteral):
221
256
  else:
222
257
  raise UnsupportedMultiCharacterCharLiteral(decoded)
223
258
 
259
+ def __eq__(self, other: object) -> bool:
260
+ if not isinstance(other, ASTCharLiteral):
261
+ return NotImplemented
262
+ return (
263
+ self.prefix == other.prefix
264
+ and self.value == other.value
265
+ )
266
+
267
+ def __hash__(self) -> int:
268
+ return hash((self.prefix, self.value))
269
+
224
270
  def _stringify(self, transform: StringifyTransform) -> str:
225
271
  if self.prefix is None:
226
272
  return "'" + self.data + "'"
@@ -237,6 +283,14 @@ class ASTStringLiteral(ASTLiteral):
237
283
  def __init__(self, data: str) -> None:
238
284
  self.data = data
239
285
 
286
+ def __eq__(self, other: object) -> bool:
287
+ if not isinstance(other, ASTStringLiteral):
288
+ return NotImplemented
289
+ return self.data == other.data
290
+
291
+ def __hash__(self) -> int:
292
+ return hash(self.data)
293
+
240
294
  def _stringify(self, transform: StringifyTransform) -> str:
241
295
  return self.data
242
296
 
@@ -251,6 +305,14 @@ class ASTIdExpression(ASTExpression):
251
305
  # note: this class is basically to cast a nested name as an expression
252
306
  self.name = name
253
307
 
308
+ def __eq__(self, other: object) -> bool:
309
+ if not isinstance(other, ASTIdExpression):
310
+ return NotImplemented
311
+ return self.name == other.name
312
+
313
+ def __hash__(self) -> int:
314
+ return hash(self.name)
315
+
254
316
  def _stringify(self, transform: StringifyTransform) -> str:
255
317
  return transform(self.name)
256
318
 
@@ -266,6 +328,14 @@ class ASTParenExpr(ASTExpression):
266
328
  def __init__(self, expr: ASTExpression) -> None:
267
329
  self.expr = expr
268
330
 
331
+ def __eq__(self, other: object) -> bool:
332
+ if not isinstance(other, ASTParenExpr):
333
+ return NotImplemented
334
+ return self.expr == other.expr
335
+
336
+ def __hash__(self) -> int:
337
+ return hash(self.expr)
338
+
269
339
  def _stringify(self, transform: StringifyTransform) -> str:
270
340
  return '(' + transform(self.expr) + ')'
271
341
 
@@ -290,6 +360,14 @@ class ASTPostfixCallExpr(ASTPostfixOp):
290
360
  def __init__(self, lst: ASTParenExprList | ASTBracedInitList) -> None:
291
361
  self.lst = lst
292
362
 
363
+ def __eq__(self, other: object) -> bool:
364
+ if not isinstance(other, ASTPostfixCallExpr):
365
+ return NotImplemented
366
+ return self.lst == other.lst
367
+
368
+ def __hash__(self) -> int:
369
+ return hash(self.lst)
370
+
293
371
  def _stringify(self, transform: StringifyTransform) -> str:
294
372
  return transform(self.lst)
295
373
 
@@ -302,6 +380,14 @@ class ASTPostfixArray(ASTPostfixOp):
302
380
  def __init__(self, expr: ASTExpression) -> None:
303
381
  self.expr = expr
304
382
 
383
+ def __eq__(self, other: object) -> bool:
384
+ if not isinstance(other, ASTPostfixArray):
385
+ return NotImplemented
386
+ return self.expr == other.expr
387
+
388
+ def __hash__(self) -> int:
389
+ return hash(self.expr)
390
+
305
391
  def _stringify(self, transform: StringifyTransform) -> str:
306
392
  return '[' + transform(self.expr) + ']'
307
393
 
@@ -334,6 +420,14 @@ class ASTPostfixMemberOfPointer(ASTPostfixOp):
334
420
  def __init__(self, name: ASTNestedName) -> None:
335
421
  self.name = name
336
422
 
423
+ def __eq__(self, other: object) -> bool:
424
+ if not isinstance(other, ASTPostfixMemberOfPointer):
425
+ return NotImplemented
426
+ return self.name == other.name
427
+
428
+ def __hash__(self) -> int:
429
+ return hash(self.name)
430
+
337
431
  def _stringify(self, transform: StringifyTransform) -> str:
338
432
  return '->' + transform(self.name)
339
433
 
@@ -348,6 +442,14 @@ class ASTPostfixExpr(ASTExpression):
348
442
  self.prefix = prefix
349
443
  self.postFixes = postFixes
350
444
 
445
+ def __eq__(self, other: object) -> bool:
446
+ if not isinstance(other, ASTPostfixExpr):
447
+ return NotImplemented
448
+ return self.prefix == other.prefix and self.postFixes == other.postFixes
449
+
450
+ def __hash__(self) -> int:
451
+ return hash((self.prefix, self.postFixes))
452
+
351
453
  def _stringify(self, transform: StringifyTransform) -> str:
352
454
  return ''.join([transform(self.prefix), *(transform(p) for p in self.postFixes)])
353
455
 
@@ -366,6 +468,14 @@ class ASTUnaryOpExpr(ASTExpression):
366
468
  self.op = op
367
469
  self.expr = expr
368
470
 
471
+ def __eq__(self, other: object) -> bool:
472
+ if not isinstance(other, ASTUnaryOpExpr):
473
+ return NotImplemented
474
+ return self.op == other.op and self.expr == other.expr
475
+
476
+ def __hash__(self) -> int:
477
+ return hash((self.op, self.expr))
478
+
369
479
  def _stringify(self, transform: StringifyTransform) -> str:
370
480
  if self.op[0] in 'cn':
371
481
  return self.op + " " + transform(self.expr)
@@ -386,6 +496,14 @@ class ASTSizeofType(ASTExpression):
386
496
  def __init__(self, typ: ASTType) -> None:
387
497
  self.typ = typ
388
498
 
499
+ def __eq__(self, other: object) -> bool:
500
+ if not isinstance(other, ASTSizeofType):
501
+ return NotImplemented
502
+ return self.typ == other.typ
503
+
504
+ def __hash__(self) -> int:
505
+ return hash(self.typ)
506
+
389
507
  def _stringify(self, transform: StringifyTransform) -> str:
390
508
  return "sizeof(" + transform(self.typ) + ")"
391
509
 
@@ -401,6 +519,14 @@ class ASTSizeofExpr(ASTExpression):
401
519
  def __init__(self, expr: ASTExpression) -> None:
402
520
  self.expr = expr
403
521
 
522
+ def __eq__(self, other: object) -> bool:
523
+ if not isinstance(other, ASTSizeofExpr):
524
+ return NotImplemented
525
+ return self.expr == other.expr
526
+
527
+ def __hash__(self) -> int:
528
+ return hash(self.expr)
529
+
404
530
  def _stringify(self, transform: StringifyTransform) -> str:
405
531
  return "sizeof " + transform(self.expr)
406
532
 
@@ -415,6 +541,14 @@ class ASTAlignofExpr(ASTExpression):
415
541
  def __init__(self, typ: ASTType) -> None:
416
542
  self.typ = typ
417
543
 
544
+ def __eq__(self, other: object) -> bool:
545
+ if not isinstance(other, ASTAlignofExpr):
546
+ return NotImplemented
547
+ return self.typ == other.typ
548
+
549
+ def __hash__(self) -> int:
550
+ return hash(self.typ)
551
+
418
552
  def _stringify(self, transform: StringifyTransform) -> str:
419
553
  return "alignof(" + transform(self.typ) + ")"
420
554
 
@@ -434,6 +568,17 @@ class ASTCastExpr(ASTExpression):
434
568
  self.typ = typ
435
569
  self.expr = expr
436
570
 
571
+ def __eq__(self, other: object) -> bool:
572
+ if not isinstance(other, ASTCastExpr):
573
+ return NotImplemented
574
+ return (
575
+ self.typ == other.typ
576
+ and self.expr == other.expr
577
+ )
578
+
579
+ def __hash__(self) -> int:
580
+ return hash((self.typ, self.expr))
581
+
437
582
  def _stringify(self, transform: StringifyTransform) -> str:
438
583
  res = ['(']
439
584
  res.append(transform(self.typ))
@@ -456,6 +601,17 @@ class ASTBinOpExpr(ASTBase):
456
601
  self.exprs = exprs
457
602
  self.ops = ops
458
603
 
604
+ def __eq__(self, other: object) -> bool:
605
+ if not isinstance(other, ASTBinOpExpr):
606
+ return NotImplemented
607
+ return (
608
+ self.exprs == other.exprs
609
+ and self.ops == other.ops
610
+ )
611
+
612
+ def __hash__(self) -> int:
613
+ return hash((self.exprs, self.ops))
614
+
459
615
  def _stringify(self, transform: StringifyTransform) -> str:
460
616
  res = []
461
617
  res.append(transform(self.exprs[0]))
@@ -487,6 +643,17 @@ class ASTAssignmentExpr(ASTExpression):
487
643
  self.exprs = exprs
488
644
  self.ops = ops
489
645
 
646
+ def __eq__(self, other: object) -> bool:
647
+ if not isinstance(other, ASTAssignmentExpr):
648
+ return NotImplemented
649
+ return (
650
+ self.exprs == other.exprs
651
+ and self.ops == other.ops
652
+ )
653
+
654
+ def __hash__(self) -> int:
655
+ return hash((self.exprs, self.ops))
656
+
490
657
  def _stringify(self, transform: StringifyTransform) -> str:
491
658
  res = []
492
659
  res.append(transform(self.exprs[0]))
@@ -515,6 +682,14 @@ class ASTFallbackExpr(ASTExpression):
515
682
  def __init__(self, expr: str) -> None:
516
683
  self.expr = expr
517
684
 
685
+ def __eq__(self, other: object) -> bool:
686
+ if not isinstance(other, ASTFallbackExpr):
687
+ return NotImplemented
688
+ return self.expr == other.expr
689
+
690
+ def __hash__(self) -> int:
691
+ return hash(self.expr)
692
+
518
693
  def _stringify(self, transform: StringifyTransform) -> str:
519
694
  return self.expr
520
695
 
@@ -539,6 +714,14 @@ class ASTTrailingTypeSpecFundamental(ASTTrailingTypeSpec):
539
714
  assert len(names) != 0
540
715
  self.names = names
541
716
 
717
+ def __eq__(self, other: object) -> bool:
718
+ if not isinstance(other, ASTTrailingTypeSpecFundamental):
719
+ return NotImplemented
720
+ return self.names == other.names
721
+
722
+ def __hash__(self) -> int:
723
+ return hash(self.names)
724
+
542
725
  def _stringify(self, transform: StringifyTransform) -> str:
543
726
  return ' '.join(self.names)
544
727
 
@@ -558,6 +741,17 @@ class ASTTrailingTypeSpecName(ASTTrailingTypeSpec):
558
741
  self.prefix = prefix
559
742
  self.nestedName = nestedName
560
743
 
744
+ def __eq__(self, other: object) -> bool:
745
+ if not isinstance(other, ASTTrailingTypeSpecName):
746
+ return NotImplemented
747
+ return (
748
+ self.prefix == other.prefix
749
+ and self.nestedName == other.nestedName
750
+ )
751
+
752
+ def __hash__(self) -> int:
753
+ return hash((self.prefix, self.nestedName))
754
+
561
755
  @property
562
756
  def name(self) -> ASTNestedName:
563
757
  return self.nestedName
@@ -583,6 +777,14 @@ class ASTFunctionParameter(ASTBase):
583
777
  self.arg = arg
584
778
  self.ellipsis = ellipsis
585
779
 
780
+ def __eq__(self, other: object) -> bool:
781
+ if not isinstance(other, ASTFunctionParameter):
782
+ return NotImplemented
783
+ return self.arg == other.arg and self.ellipsis == other.ellipsis
784
+
785
+ def __hash__(self) -> int:
786
+ return hash((self.arg, self.ellipsis))
787
+
586
788
  def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
587
789
  # the anchor will be our parent
588
790
  return symbol.parent.declaration.get_id(version, prefixed=False)
@@ -607,6 +809,14 @@ class ASTParameters(ASTBase):
607
809
  self.args = args
608
810
  self.attrs = attrs
609
811
 
812
+ def __eq__(self, other: object) -> bool:
813
+ if not isinstance(other, ASTParameters):
814
+ return NotImplemented
815
+ return self.args == other.args and self.attrs == other.attrs
816
+
817
+ def __hash__(self) -> int:
818
+ return hash((self.args, self.attrs))
819
+
610
820
  @property
611
821
  def function_params(self) -> list[ASTFunctionParameter]:
612
822
  return self.args
@@ -674,6 +884,30 @@ class ASTDeclSpecsSimple(ASTBaseBase):
674
884
  self.const = const
675
885
  self.attrs = attrs
676
886
 
887
+ def __eq__(self, other: object) -> bool:
888
+ if not isinstance(other, ASTDeclSpecsSimple):
889
+ return NotImplemented
890
+ return (
891
+ self.storage == other.storage
892
+ and self.threadLocal == other.threadLocal
893
+ and self.inline == other.inline
894
+ and self.restrict == other.restrict
895
+ and self.volatile == other.volatile
896
+ and self.const == other.const
897
+ and self.attrs == other.attrs
898
+ )
899
+
900
+ def __hash__(self) -> int:
901
+ return hash((
902
+ self.storage,
903
+ self.threadLocal,
904
+ self.inline,
905
+ self.restrict,
906
+ self.volatile,
907
+ self.const,
908
+ self.attrs,
909
+ ))
910
+
677
911
  def mergeWith(self, other: ASTDeclSpecsSimple) -> ASTDeclSpecsSimple:
678
912
  if not other:
679
913
  return self
@@ -741,6 +975,24 @@ class ASTDeclSpecs(ASTBase):
741
975
  self.allSpecs = self.leftSpecs.mergeWith(self.rightSpecs)
742
976
  self.trailingTypeSpec = trailing
743
977
 
978
+ def __eq__(self, other: object) -> bool:
979
+ if not isinstance(other, ASTDeclSpecs):
980
+ return NotImplemented
981
+ return (
982
+ self.outer == other.outer
983
+ and self.leftSpecs == other.leftSpecs
984
+ and self.rightSpecs == other.rightSpecs
985
+ and self.trailingTypeSpec == other.trailingTypeSpec
986
+ )
987
+
988
+ def __hash__(self) -> int:
989
+ return hash((
990
+ self.outer,
991
+ self.leftSpecs,
992
+ self.rightSpecs,
993
+ self.trailingTypeSpec,
994
+ ))
995
+
744
996
  def _stringify(self, transform: StringifyTransform) -> str:
745
997
  res: list[str] = []
746
998
  l = transform(self.leftSpecs)
@@ -796,6 +1048,28 @@ class ASTArray(ASTBase):
796
1048
  if size is not None:
797
1049
  assert not vla
798
1050
 
1051
+ def __eq__(self, other: object) -> bool:
1052
+ if not isinstance(other, ASTArray):
1053
+ return NotImplemented
1054
+ return (
1055
+ self.static == other.static
1056
+ and self.const == other.const
1057
+ and self.volatile == other.volatile
1058
+ and self.restrict == other.restrict
1059
+ and self.vla == other.vla
1060
+ and self.size == other.size
1061
+ )
1062
+
1063
+ def __hash__(self) -> int:
1064
+ return hash((
1065
+ self.static,
1066
+ self.const,
1067
+ self.volatile,
1068
+ self.restrict,
1069
+ self.vla,
1070
+ self.size,
1071
+ ))
1072
+
799
1073
  def _stringify(self, transform: StringifyTransform) -> str:
800
1074
  el = []
801
1075
  if self.static:
@@ -861,6 +1135,18 @@ class ASTDeclaratorNameParam(ASTDeclarator):
861
1135
  self.arrayOps = arrayOps
862
1136
  self.param = param
863
1137
 
1138
+ def __eq__(self, other: object) -> bool:
1139
+ if not isinstance(other, ASTDeclaratorNameParam):
1140
+ return NotImplemented
1141
+ return (
1142
+ self.declId == other.declId
1143
+ and self.arrayOps == other.arrayOps
1144
+ and self.param == other.param
1145
+ )
1146
+
1147
+ def __hash__(self) -> int:
1148
+ return hash((self.declId, self.arrayOps, self.param))
1149
+
864
1150
  @property
865
1151
  def name(self) -> ASTNestedName:
866
1152
  return self.declId
@@ -899,6 +1185,14 @@ class ASTDeclaratorNameBitField(ASTDeclarator):
899
1185
  self.declId = declId
900
1186
  self.size = size
901
1187
 
1188
+ def __eq__(self, other: object) -> bool:
1189
+ if not isinstance(other, ASTDeclaratorNameBitField):
1190
+ return NotImplemented
1191
+ return self.declId == other.declId and self.size == other.size
1192
+
1193
+ def __hash__(self) -> int:
1194
+ return hash((self.declId, self.size))
1195
+
902
1196
  @property
903
1197
  def name(self) -> ASTNestedName:
904
1198
  return self.declId
@@ -937,6 +1231,20 @@ class ASTDeclaratorPtr(ASTDeclarator):
937
1231
  self.const = const
938
1232
  self.attrs = attrs
939
1233
 
1234
+ def __eq__(self, other: object) -> bool:
1235
+ if not isinstance(other, ASTDeclaratorPtr):
1236
+ return NotImplemented
1237
+ return (
1238
+ self.next == other.next
1239
+ and self.restrict == other.restrict
1240
+ and self.volatile == other.volatile
1241
+ and self.const == other.const
1242
+ and self.attrs == other.attrs
1243
+ )
1244
+
1245
+ def __hash__(self) -> int:
1246
+ return hash((self.next, self.restrict, self.volatile, self.const, self.attrs))
1247
+
940
1248
  @property
941
1249
  def name(self) -> ASTNestedName:
942
1250
  return self.next.name
@@ -1006,6 +1314,14 @@ class ASTDeclaratorParen(ASTDeclarator):
1006
1314
  self.next = next
1007
1315
  # TODO: we assume the name and params are in inner
1008
1316
 
1317
+ def __eq__(self, other: object) -> bool:
1318
+ if not isinstance(other, ASTDeclaratorParen):
1319
+ return NotImplemented
1320
+ return self.inner == other.inner and self.next == other.next
1321
+
1322
+ def __hash__(self) -> int:
1323
+ return hash((self.inner, self.next))
1324
+
1009
1325
  @property
1010
1326
  def name(self) -> ASTNestedName:
1011
1327
  return self.inner.name
@@ -1040,6 +1356,14 @@ class ASTParenExprList(ASTBaseParenExprList):
1040
1356
  def __init__(self, exprs: list[ASTExpression]) -> None:
1041
1357
  self.exprs = exprs
1042
1358
 
1359
+ def __eq__(self, other: object) -> bool:
1360
+ if not isinstance(other, ASTParenExprList):
1361
+ return NotImplemented
1362
+ return self.exprs == other.exprs
1363
+
1364
+ def __hash__(self) -> int:
1365
+ return hash(self.exprs)
1366
+
1043
1367
  def _stringify(self, transform: StringifyTransform) -> str:
1044
1368
  exprs = [transform(e) for e in self.exprs]
1045
1369
  return '(%s)' % ', '.join(exprs)
@@ -1064,6 +1388,14 @@ class ASTBracedInitList(ASTBase):
1064
1388
  self.exprs = exprs
1065
1389
  self.trailingComma = trailingComma
1066
1390
 
1391
+ def __eq__(self, other: object) -> bool:
1392
+ if not isinstance(other, ASTBracedInitList):
1393
+ return NotImplemented
1394
+ return self.exprs == other.exprs and self.trailingComma == other.trailingComma
1395
+
1396
+ def __hash__(self) -> int:
1397
+ return hash((self.exprs, self.trailingComma))
1398
+
1067
1399
  def _stringify(self, transform: StringifyTransform) -> str:
1068
1400
  exprs = ', '.join(transform(e) for e in self.exprs)
1069
1401
  trailingComma = ',' if self.trailingComma else ''
@@ -1092,6 +1424,14 @@ class ASTInitializer(ASTBase):
1092
1424
  self.value = value
1093
1425
  self.hasAssign = hasAssign
1094
1426
 
1427
+ def __eq__(self, other: object) -> bool:
1428
+ if not isinstance(other, ASTInitializer):
1429
+ return NotImplemented
1430
+ return self.value == other.value and self.hasAssign == other.hasAssign
1431
+
1432
+ def __hash__(self) -> int:
1433
+ return hash((self.value, self.hasAssign))
1434
+
1095
1435
  def _stringify(self, transform: StringifyTransform) -> str:
1096
1436
  val = transform(self.value)
1097
1437
  if self.hasAssign:
@@ -1116,6 +1456,14 @@ class ASTType(ASTBase):
1116
1456
  self.declSpecs = declSpecs
1117
1457
  self.decl = decl
1118
1458
 
1459
+ def __eq__(self, other: object) -> bool:
1460
+ if not isinstance(other, ASTType):
1461
+ return NotImplemented
1462
+ return self.declSpecs == other.declSpecs and self.decl == other.decl
1463
+
1464
+ def __hash__(self) -> int:
1465
+ return hash((self.declSpecs, self.decl))
1466
+
1119
1467
  @property
1120
1468
  def name(self) -> ASTNestedName:
1121
1469
  return self.decl.name
@@ -1161,6 +1509,14 @@ class ASTTypeWithInit(ASTBase):
1161
1509
  self.type = type
1162
1510
  self.init = init
1163
1511
 
1512
+ def __eq__(self, other: object) -> bool:
1513
+ if not isinstance(other, ASTTypeWithInit):
1514
+ return NotImplemented
1515
+ return self.type == other.type and self.init == other.init
1516
+
1517
+ def __hash__(self) -> int:
1518
+ return hash((self.type, self.init))
1519
+
1164
1520
  @property
1165
1521
  def name(self) -> ASTNestedName:
1166
1522
  return self.type.name
@@ -1190,6 +1546,18 @@ class ASTMacroParameter(ASTBase):
1190
1546
  self.ellipsis = ellipsis
1191
1547
  self.variadic = variadic
1192
1548
 
1549
+ def __eq__(self, other: object) -> bool:
1550
+ if not isinstance(other, ASTMacroParameter):
1551
+ return NotImplemented
1552
+ return (
1553
+ self.arg == other.arg
1554
+ and self.ellipsis == other.ellipsis
1555
+ and self.variadic == other.variadic
1556
+ )
1557
+
1558
+ def __hash__(self) -> int:
1559
+ return hash((self.arg, self.ellipsis, self.variadic))
1560
+
1193
1561
  def _stringify(self, transform: StringifyTransform) -> str:
1194
1562
  if self.ellipsis:
1195
1563
  return '...'
@@ -1215,6 +1583,14 @@ class ASTMacro(ASTBase):
1215
1583
  self.ident = ident
1216
1584
  self.args = args
1217
1585
 
1586
+ def __eq__(self, other: object) -> bool:
1587
+ if not isinstance(other, ASTMacro):
1588
+ return NotImplemented
1589
+ return self.ident == other.ident and self.args == other.args
1590
+
1591
+ def __hash__(self) -> int:
1592
+ return hash((self.ident, self.args))
1593
+
1218
1594
  @property
1219
1595
  def name(self) -> ASTNestedName:
1220
1596
  return self.ident
@@ -1254,6 +1630,14 @@ class ASTStruct(ASTBase):
1254
1630
  def __init__(self, name: ASTNestedName) -> None:
1255
1631
  self.name = name
1256
1632
 
1633
+ def __eq__(self, other: object) -> bool:
1634
+ if not isinstance(other, ASTStruct):
1635
+ return NotImplemented
1636
+ return self.name == other.name
1637
+
1638
+ def __hash__(self) -> int:
1639
+ return hash(self.name)
1640
+
1257
1641
  def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
1258
1642
  return symbol.get_full_nested_name().get_id(version)
1259
1643
 
@@ -1270,6 +1654,14 @@ class ASTUnion(ASTBase):
1270
1654
  def __init__(self, name: ASTNestedName) -> None:
1271
1655
  self.name = name
1272
1656
 
1657
+ def __eq__(self, other: object) -> bool:
1658
+ if not isinstance(other, ASTUnion):
1659
+ return NotImplemented
1660
+ return self.name == other.name
1661
+
1662
+ def __hash__(self) -> int:
1663
+ return hash(self.name)
1664
+
1273
1665
  def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
1274
1666
  return symbol.get_full_nested_name().get_id(version)
1275
1667
 
@@ -1286,6 +1678,14 @@ class ASTEnum(ASTBase):
1286
1678
  def __init__(self, name: ASTNestedName) -> None:
1287
1679
  self.name = name
1288
1680
 
1681
+ def __eq__(self, other: object) -> bool:
1682
+ if not isinstance(other, ASTEnum):
1683
+ return NotImplemented
1684
+ return self.name == other.name
1685
+
1686
+ def __hash__(self) -> int:
1687
+ return hash(self.name)
1688
+
1289
1689
  def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
1290
1690
  return symbol.get_full_nested_name().get_id(version)
1291
1691
 
@@ -1305,6 +1705,18 @@ class ASTEnumerator(ASTBase):
1305
1705
  self.init = init
1306
1706
  self.attrs = attrs
1307
1707
 
1708
+ def __eq__(self, other: object) -> bool:
1709
+ if not isinstance(other, ASTEnumerator):
1710
+ return NotImplemented
1711
+ return (
1712
+ self.name == other.name
1713
+ and self.init == other.init
1714
+ and self.attrs == other.attrs
1715
+ )
1716
+
1717
+ def __hash__(self) -> int:
1718
+ return hash((self.name, self.init, self.attrs))
1719
+
1308
1720
  def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
1309
1721
  return symbol.get_full_nested_name().get_id(version)
1310
1722
 
@@ -1346,6 +1758,18 @@ class ASTDeclaration(ASTBaseBase):
1346
1758
  # further changes will be made to this object
1347
1759
  self._newest_id_cache: str | None = None
1348
1760
 
1761
+ def __eq__(self, other: object) -> bool:
1762
+ if not isinstance(other, ASTDeclaration):
1763
+ return NotImplemented
1764
+ return (
1765
+ self.objectType == other.objectType
1766
+ and self.directiveType == other.directiveType
1767
+ and self.declaration == other.declaration
1768
+ and self.semicolon == other.semicolon
1769
+ and self.symbol == other.symbol
1770
+ and self.enumeratorScopedSymbol == other.enumeratorScopedSymbol
1771
+ )
1772
+
1349
1773
  def clone(self) -> ASTDeclaration:
1350
1774
  return ASTDeclaration(self.objectType, self.directiveType,
1351
1775
  self.declaration.clone(), self.semicolon)