Sphinx 7.4.6__py3-none-any.whl → 8.0.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 (242) hide show
  1. sphinx/__init__.py +2 -2
  2. sphinx/_cli/__init__.py +4 -4
  3. sphinx/application.py +2 -2
  4. sphinx/builders/__init__.py +2 -3
  5. sphinx/builders/_epub_base.py +33 -12
  6. sphinx/builders/changes.py +13 -5
  7. sphinx/builders/epub3.py +6 -2
  8. sphinx/builders/html/__init__.py +90 -59
  9. sphinx/builders/latex/__init__.py +38 -12
  10. sphinx/builders/latex/transforms.py +1 -1
  11. sphinx/builders/linkcheck.py +8 -49
  12. sphinx/builders/texinfo.py +12 -6
  13. sphinx/builders/text.py +7 -3
  14. sphinx/builders/xml.py +7 -3
  15. sphinx/cmd/quickstart.py +10 -20
  16. sphinx/config.py +13 -13
  17. sphinx/deprecation.py +8 -8
  18. sphinx/directives/__init__.py +14 -9
  19. sphinx/directives/other.py +2 -3
  20. sphinx/directives/patches.py +2 -2
  21. sphinx/domains/__init__.py +4 -2
  22. sphinx/domains/c/__init__.py +2 -2
  23. sphinx/domains/c/_ast.py +3 -2
  24. sphinx/domains/c/_parser.py +4 -3
  25. sphinx/domains/cpp/__init__.py +2 -2
  26. sphinx/domains/cpp/_ast.py +1 -2
  27. sphinx/domains/cpp/_parser.py +2 -2
  28. sphinx/domains/cpp/_symbol.py +2 -2
  29. sphinx/domains/javascript.py +1 -1
  30. sphinx/domains/math.py +1 -1
  31. sphinx/domains/python/__init__.py +1 -1
  32. sphinx/domains/python/_annotations.py +23 -1
  33. sphinx/domains/python/_object.py +0 -1
  34. sphinx/domains/std/__init__.py +7 -8
  35. sphinx/environment/__init__.py +15 -32
  36. sphinx/environment/adapters/indexentries.py +4 -6
  37. sphinx/environment/adapters/toctree.py +4 -4
  38. sphinx/environment/collectors/title.py +1 -1
  39. sphinx/environment/collectors/toctree.py +1 -1
  40. sphinx/events.py +3 -1
  41. sphinx/ext/autodoc/__init__.py +25 -67
  42. sphinx/ext/autodoc/directive.py +7 -5
  43. sphinx/ext/autodoc/importer.py +2 -1
  44. sphinx/ext/autodoc/preserve_defaults.py +2 -2
  45. sphinx/ext/autosummary/__init__.py +15 -7
  46. sphinx/ext/autosummary/generate.py +5 -4
  47. sphinx/ext/doctest.py +5 -5
  48. sphinx/ext/graphviz.py +1 -1
  49. sphinx/ext/imgmath.py +1 -1
  50. sphinx/ext/inheritance_diagram.py +1 -1
  51. sphinx/ext/intersphinx/__init__.py +25 -5
  52. sphinx/ext/intersphinx/_cli.py +7 -6
  53. sphinx/ext/intersphinx/_load.py +240 -115
  54. sphinx/ext/intersphinx/_resolve.py +12 -11
  55. sphinx/ext/intersphinx/_shared.py +102 -9
  56. sphinx/ext/mathjax.py +1 -1
  57. sphinx/ext/napoleon/docstring.py +2 -2
  58. sphinx/ext/todo.py +2 -2
  59. sphinx/ext/viewcode.py +2 -1
  60. sphinx/highlighting.py +3 -3
  61. sphinx/io.py +2 -2
  62. sphinx/jinja2glue.py +13 -6
  63. sphinx/locale/__init__.py +4 -3
  64. sphinx/locale/ar/LC_MESSAGES/sphinx.mo +0 -0
  65. sphinx/locale/ar/LC_MESSAGES/sphinx.po +2383 -2186
  66. sphinx/locale/bg/LC_MESSAGES/sphinx.mo +0 -0
  67. sphinx/locale/bg/LC_MESSAGES/sphinx.po +2249 -2052
  68. sphinx/locale/bn/LC_MESSAGES/sphinx.mo +0 -0
  69. sphinx/locale/bn/LC_MESSAGES/sphinx.po +2412 -2215
  70. sphinx/locale/ca/LC_MESSAGES/sphinx.mo +0 -0
  71. sphinx/locale/ca/LC_MESSAGES/sphinx.po +3029 -2832
  72. sphinx/locale/cak/LC_MESSAGES/sphinx.mo +0 -0
  73. sphinx/locale/cak/LC_MESSAGES/sphinx.po +2308 -2111
  74. sphinx/locale/cs/LC_MESSAGES/sphinx.mo +0 -0
  75. sphinx/locale/cs/LC_MESSAGES/sphinx.po +2469 -2272
  76. sphinx/locale/cy/LC_MESSAGES/sphinx.mo +0 -0
  77. sphinx/locale/cy/LC_MESSAGES/sphinx.po +2393 -2196
  78. sphinx/locale/da/LC_MESSAGES/sphinx.mo +0 -0
  79. sphinx/locale/da/LC_MESSAGES/sphinx.po +2532 -2335
  80. sphinx/locale/de/LC_MESSAGES/sphinx.mo +0 -0
  81. sphinx/locale/de/LC_MESSAGES/sphinx.po +2492 -2295
  82. sphinx/locale/de_DE/LC_MESSAGES/sphinx.mo +0 -0
  83. sphinx/locale/de_DE/LC_MESSAGES/sphinx.po +2250 -2053
  84. sphinx/locale/el/LC_MESSAGES/sphinx.mo +0 -0
  85. sphinx/locale/el/LC_MESSAGES/sphinx.po +2879 -2682
  86. sphinx/locale/en_DE/LC_MESSAGES/sphinx.mo +0 -0
  87. sphinx/locale/en_DE/LC_MESSAGES/sphinx.po +2250 -2053
  88. sphinx/locale/en_FR/LC_MESSAGES/sphinx.mo +0 -0
  89. sphinx/locale/en_FR/LC_MESSAGES/sphinx.po +2250 -2053
  90. sphinx/locale/en_GB/LC_MESSAGES/sphinx.mo +0 -0
  91. sphinx/locale/en_GB/LC_MESSAGES/sphinx.po +2989 -2792
  92. sphinx/locale/en_HK/LC_MESSAGES/sphinx.mo +0 -0
  93. sphinx/locale/en_HK/LC_MESSAGES/sphinx.po +2250 -2053
  94. sphinx/locale/eo/LC_MESSAGES/sphinx.mo +0 -0
  95. sphinx/locale/eo/LC_MESSAGES/sphinx.po +2297 -2100
  96. sphinx/locale/es/LC_MESSAGES/sphinx.mo +0 -0
  97. sphinx/locale/es/LC_MESSAGES/sphinx.po +3017 -2820
  98. sphinx/locale/es_CO/LC_MESSAGES/sphinx.mo +0 -0
  99. sphinx/locale/es_CO/LC_MESSAGES/sphinx.po +2250 -2053
  100. sphinx/locale/et/LC_MESSAGES/sphinx.mo +0 -0
  101. sphinx/locale/et/LC_MESSAGES/sphinx.po +2748 -2551
  102. sphinx/locale/eu/LC_MESSAGES/sphinx.mo +0 -0
  103. sphinx/locale/eu/LC_MESSAGES/sphinx.po +2459 -2262
  104. sphinx/locale/fa/LC_MESSAGES/sphinx.mo +0 -0
  105. sphinx/locale/fa/LC_MESSAGES/sphinx.po +2957 -2760
  106. sphinx/locale/fi/LC_MESSAGES/sphinx.mo +0 -0
  107. sphinx/locale/fi/LC_MESSAGES/sphinx.po +2321 -2124
  108. sphinx/locale/fr/LC_MESSAGES/sphinx.mo +0 -0
  109. sphinx/locale/fr/LC_MESSAGES/sphinx.po +2977 -2780
  110. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.mo +0 -0
  111. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.po +2250 -2053
  112. sphinx/locale/gl/LC_MESSAGES/sphinx.mo +0 -0
  113. sphinx/locale/gl/LC_MESSAGES/sphinx.po +2992 -2795
  114. sphinx/locale/he/LC_MESSAGES/sphinx.mo +0 -0
  115. sphinx/locale/he/LC_MESSAGES/sphinx.po +2375 -2178
  116. sphinx/locale/hi/LC_MESSAGES/sphinx.mo +0 -0
  117. sphinx/locale/hi/LC_MESSAGES/sphinx.po +2937 -2740
  118. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.mo +0 -0
  119. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.po +2250 -2053
  120. sphinx/locale/hr/LC_MESSAGES/sphinx.mo +0 -0
  121. sphinx/locale/hr/LC_MESSAGES/sphinx.po +2532 -2335
  122. sphinx/locale/hu/LC_MESSAGES/sphinx.mo +0 -0
  123. sphinx/locale/hu/LC_MESSAGES/sphinx.po +2505 -2308
  124. sphinx/locale/id/LC_MESSAGES/sphinx.mo +0 -0
  125. sphinx/locale/id/LC_MESSAGES/sphinx.po +2925 -2728
  126. sphinx/locale/is/LC_MESSAGES/sphinx.mo +0 -0
  127. sphinx/locale/is/LC_MESSAGES/sphinx.po +2307 -2110
  128. sphinx/locale/it/LC_MESSAGES/sphinx.mo +0 -0
  129. sphinx/locale/it/LC_MESSAGES/sphinx.po +2514 -2317
  130. sphinx/locale/ja/LC_MESSAGES/sphinx.mo +0 -0
  131. sphinx/locale/ja/LC_MESSAGES/sphinx.po +2970 -2773
  132. sphinx/locale/ka/LC_MESSAGES/sphinx.mo +0 -0
  133. sphinx/locale/ka/LC_MESSAGES/sphinx.po +2868 -2671
  134. sphinx/locale/ko/LC_MESSAGES/sphinx.mo +0 -0
  135. sphinx/locale/ko/LC_MESSAGES/sphinx.po +3016 -2819
  136. sphinx/locale/lt/LC_MESSAGES/sphinx.mo +0 -0
  137. sphinx/locale/lt/LC_MESSAGES/sphinx.po +2476 -2279
  138. sphinx/locale/lv/LC_MESSAGES/sphinx.mo +0 -0
  139. sphinx/locale/lv/LC_MESSAGES/sphinx.po +2477 -2280
  140. sphinx/locale/mk/LC_MESSAGES/sphinx.mo +0 -0
  141. sphinx/locale/mk/LC_MESSAGES/sphinx.po +2292 -2095
  142. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.mo +0 -0
  143. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.po +2479 -2282
  144. sphinx/locale/ne/LC_MESSAGES/sphinx.mo +0 -0
  145. sphinx/locale/ne/LC_MESSAGES/sphinx.po +2481 -2284
  146. sphinx/locale/nl/LC_MESSAGES/sphinx.mo +0 -0
  147. sphinx/locale/nl/LC_MESSAGES/sphinx.po +2557 -2360
  148. sphinx/locale/pl/LC_MESSAGES/sphinx.mo +0 -0
  149. sphinx/locale/pl/LC_MESSAGES/sphinx.po +2696 -2499
  150. sphinx/locale/pt/LC_MESSAGES/sphinx.mo +0 -0
  151. sphinx/locale/pt/LC_MESSAGES/sphinx.po +2250 -2053
  152. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +0 -0
  153. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +2979 -2782
  154. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo +0 -0
  155. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po +2469 -2272
  156. sphinx/locale/ro/LC_MESSAGES/sphinx.mo +0 -0
  157. sphinx/locale/ro/LC_MESSAGES/sphinx.po +2473 -2276
  158. sphinx/locale/ru/LC_MESSAGES/sphinx.mo +0 -0
  159. sphinx/locale/ru/LC_MESSAGES/sphinx.po +2746 -2549
  160. sphinx/locale/si/LC_MESSAGES/sphinx.mo +0 -0
  161. sphinx/locale/si/LC_MESSAGES/sphinx.po +2331 -2134
  162. sphinx/locale/sk/LC_MESSAGES/sphinx.mo +0 -0
  163. sphinx/locale/sk/LC_MESSAGES/sphinx.po +2966 -2769
  164. sphinx/locale/sl/LC_MESSAGES/sphinx.mo +0 -0
  165. sphinx/locale/sl/LC_MESSAGES/sphinx.po +2404 -2207
  166. sphinx/locale/sphinx.pot +2262 -2065
  167. sphinx/locale/sq/LC_MESSAGES/sphinx.mo +0 -0
  168. sphinx/locale/sq/LC_MESSAGES/sphinx.po +2972 -2775
  169. sphinx/locale/sr/LC_MESSAGES/sphinx.mo +0 -0
  170. sphinx/locale/sr/LC_MESSAGES/sphinx.po +2440 -2243
  171. sphinx/locale/sv/LC_MESSAGES/sphinx.mo +0 -0
  172. sphinx/locale/sv/LC_MESSAGES/sphinx.po +2483 -2286
  173. sphinx/locale/ta/LC_MESSAGES/sphinx.js +54 -54
  174. sphinx/locale/ta/LC_MESSAGES/sphinx.mo +0 -0
  175. sphinx/locale/ta/LC_MESSAGES/sphinx.po +1578 -1843
  176. sphinx/locale/te/LC_MESSAGES/sphinx.mo +0 -0
  177. sphinx/locale/te/LC_MESSAGES/sphinx.po +2250 -2053
  178. sphinx/locale/tr/LC_MESSAGES/sphinx.mo +0 -0
  179. sphinx/locale/tr/LC_MESSAGES/sphinx.po +2892 -2695
  180. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +0 -0
  181. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +2400 -2203
  182. sphinx/locale/ur/LC_MESSAGES/sphinx.mo +0 -0
  183. sphinx/locale/ur/LC_MESSAGES/sphinx.po +2250 -2053
  184. sphinx/locale/vi/LC_MESSAGES/sphinx.mo +0 -0
  185. sphinx/locale/vi/LC_MESSAGES/sphinx.po +2422 -2225
  186. sphinx/locale/yue/LC_MESSAGES/sphinx.mo +0 -0
  187. sphinx/locale/yue/LC_MESSAGES/sphinx.po +2250 -2053
  188. sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po +496 -704
  189. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.mo +0 -0
  190. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.po +2250 -2053
  191. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +0 -0
  192. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +3028 -2831
  193. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.mo +0 -0
  194. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.po +2250 -2053
  195. sphinx/project.py +25 -20
  196. sphinx/pycode/ast.py +2 -2
  197. sphinx/pycode/parser.py +2 -2
  198. sphinx/pygments_styles.py +3 -3
  199. sphinx/registry.py +3 -8
  200. sphinx/search/__init__.py +1 -1
  201. sphinx/testing/path.py +2 -1
  202. sphinx/testing/util.py +1 -1
  203. sphinx/texinputs/Makefile.jinja +2 -1
  204. sphinx/texinputs_win/Makefile.jinja +2 -1
  205. sphinx/theming.py +3 -12
  206. sphinx/transforms/__init__.py +5 -5
  207. sphinx/transforms/references.py +1 -1
  208. sphinx/util/__init__.py +11 -35
  209. sphinx/util/_pathlib.py +31 -19
  210. sphinx/util/_timestamps.py +12 -0
  211. sphinx/util/cfamily.py +5 -5
  212. sphinx/util/console.py +4 -3
  213. sphinx/util/display.py +3 -3
  214. sphinx/util/docfields.py +1 -1
  215. sphinx/util/docutils.py +44 -10
  216. sphinx/util/fileutil.py +41 -9
  217. sphinx/util/i18n.py +9 -4
  218. sphinx/util/images.py +3 -2
  219. sphinx/util/inspect.py +29 -44
  220. sphinx/util/inventory.py +2 -2
  221. sphinx/util/matching.py +2 -2
  222. sphinx/util/math.py +1 -1
  223. sphinx/util/nodes.py +8 -8
  224. sphinx/util/osutil.py +52 -26
  225. sphinx/util/parallel.py +2 -2
  226. sphinx/util/requests.py +1 -1
  227. sphinx/util/template.py +3 -3
  228. sphinx/util/typing.py +67 -70
  229. sphinx/writers/html.py +1 -1
  230. sphinx/writers/html5.py +1 -1
  231. sphinx/writers/latex.py +4 -4
  232. sphinx/writers/manpage.py +2 -2
  233. sphinx/writers/texinfo.py +5 -5
  234. sphinx/writers/text.py +4 -4
  235. sphinx/writers/xml.py +2 -2
  236. {sphinx-7.4.6.dist-info → sphinx-8.0.0.dist-info}/METADATA +11 -10
  237. {sphinx-7.4.6.dist-info → sphinx-8.0.0.dist-info}/RECORD +240 -241
  238. sphinx/templates/quickstart/Makefile.jinja +0 -98
  239. sphinx/templates/quickstart/make.bat.jinja +0 -110
  240. {sphinx-7.4.6.dist-info → sphinx-8.0.0.dist-info}/LICENSE.rst +0 -0
  241. {sphinx-7.4.6.dist-info → sphinx-8.0.0.dist-info}/WHEEL +0 -0
  242. {sphinx-7.4.6.dist-info → sphinx-8.0.0.dist-info}/entry_points.txt +0 -0
@@ -417,7 +417,7 @@ class LaTeXFootnoteVisitor(nodes.NodeVisitor):
417
417
  self.unrestrict(node)
418
418
 
419
419
  def visit_title(self, node: nodes.title) -> None:
420
- if isinstance(node.parent, (nodes.section, nodes.table)):
420
+ if isinstance(node.parent, nodes.section | nodes.table):
421
421
  self.restrict(node)
422
422
 
423
423
  def depart_title(self, node: nodes.title) -> None:
@@ -7,7 +7,6 @@ import json
7
7
  import re
8
8
  import socket
9
9
  import time
10
- import warnings
11
10
  from html.parser import HTMLParser
12
11
  from os import path
13
12
  from queue import PriorityQueue, Queue
@@ -20,7 +19,6 @@ from requests.exceptions import ConnectionError, HTTPError, SSLError, TooManyRed
20
19
  from requests.exceptions import Timeout as RequestTimeout
21
20
 
22
21
  from sphinx.builders.dummy import DummyBuilder
23
- from sphinx.deprecation import RemovedInSphinx80Warning
24
22
  from sphinx.locale import __
25
23
  from sphinx.transforms.post_transforms import SphinxPostTransform
26
24
  from sphinx.util import encode_uri, logging, requests
@@ -29,13 +27,14 @@ from sphinx.util.http_date import rfc1123_to_epoch
29
27
  from sphinx.util.nodes import get_node_line
30
28
 
31
29
  if TYPE_CHECKING:
32
- from collections.abc import Iterator
33
- from typing import Any, Callable
30
+ from collections.abc import Callable, Iterator
31
+ from typing import Any
34
32
 
35
33
  from requests import Response
36
34
 
37
35
  from sphinx.application import Sphinx
38
36
  from sphinx.config import Config
37
+ from sphinx.util._pathlib import _StrPath
39
38
  from sphinx.util.typing import ExtensionMetadata
40
39
 
41
40
  logger = logging.getLogger(__name__)
@@ -66,25 +65,6 @@ class CheckExternalLinksBuilder(DummyBuilder):
66
65
  # set a timeout for non-responding servers
67
66
  socket.setdefaulttimeout(5.0)
68
67
 
69
- if not self.config.linkcheck_allow_unauthorized:
70
- deprecation_msg = (
71
- "The default value for 'linkcheck_allow_unauthorized' will change "
72
- "from `True` in Sphinx 7.3+ to `False`, meaning that HTTP 401 "
73
- "unauthorized responses will be reported as broken by default. "
74
- "See https://github.com/sphinx-doc/sphinx/issues/11433 for details."
75
- )
76
- warnings.warn(deprecation_msg, RemovedInSphinx80Warning, stacklevel=1)
77
-
78
- if self.config.linkcheck_report_timeouts_as_broken:
79
- deprecation_msg = (
80
- "The default value for 'linkcheck_report_timeouts_as_broken' will change "
81
- 'to False in Sphinx 8, meaning that request timeouts '
82
- "will be reported with a new 'timeout' status, instead of as 'broken'. "
83
- 'This is intended to provide more detail as to the failure mode. '
84
- 'See https://github.com/sphinx-doc/sphinx/issues/11868 for details.'
85
- )
86
- warnings.warn(deprecation_msg, RemovedInSphinx80Warning, stacklevel=1)
87
-
88
68
  def finish(self) -> None:
89
69
  checker = HyperlinkAvailabilityChecker(self.config)
90
70
  logger.info('')
@@ -103,7 +83,7 @@ class CheckExternalLinksBuilder(DummyBuilder):
103
83
  filename = self.env.doc2path(result.docname, False)
104
84
 
105
85
  linkstat: dict[str, str | int] = {
106
- 'filename': filename, 'lineno': result.lineno,
86
+ 'filename': str(filename), 'lineno': result.lineno,
107
87
  'status': result.status, 'code': result.code,
108
88
  'uri': result.uri, 'info': result.message,
109
89
  }
@@ -170,7 +150,7 @@ class CheckExternalLinksBuilder(DummyBuilder):
170
150
  self.json_outfile.write(json.dumps(data))
171
151
  self.json_outfile.write('\n')
172
152
 
173
- def write_entry(self, what: str, docname: str, filename: str, line: int,
153
+ def write_entry(self, what: str, docname: str, filename: _StrPath, line: int,
174
154
  uri: str) -> None:
175
155
  self.txt_outfile.write(f'{filename}:{line}: [{what}] {uri}\n')
176
156
 
@@ -246,7 +226,7 @@ class HyperlinkCollector(SphinxPostTransform):
246
226
  class Hyperlink(NamedTuple):
247
227
  uri: str
248
228
  docname: str
249
- docpath: str
229
+ docpath: _StrPath
250
230
  lineno: int
251
231
 
252
232
 
@@ -510,27 +490,6 @@ class HyperlinkAvailabilityCheckWorker(Thread):
510
490
 
511
491
  # Unauthorized: the client did not provide required credentials
512
492
  if status_code == 401:
513
- if self._allow_unauthorized:
514
- deprecation_msg = (
515
- "\n---\n"
516
- "The linkcheck builder encountered an HTTP 401 "
517
- "(unauthorized) response, and will report it as "
518
- "'working' in this version of Sphinx to maintain "
519
- "backwards-compatibility."
520
- "\n"
521
- "This logic will change in Sphinx 8.0 which will "
522
- "report the hyperlink as 'broken'."
523
- "\n"
524
- "To explicitly continue treating unauthorized "
525
- "hyperlink responses as 'working', set the "
526
- "'linkcheck_allow_unauthorized' config option to "
527
- "``True``."
528
- "\n"
529
- "See https://github.com/sphinx-doc/sphinx/issues/11433 "
530
- "for details."
531
- "\n---"
532
- )
533
- warnings.warn(deprecation_msg, RemovedInSphinx80Warning, stacklevel=1)
534
493
  status = 'working' if self._allow_unauthorized else 'broken'
535
494
  return status, 'unauthorized', 0
536
495
 
@@ -717,8 +676,8 @@ def setup(app: Sphinx) -> ExtensionMetadata:
717
676
  app.add_config_value('linkcheck_anchors_ignore', ['^!'], '')
718
677
  app.add_config_value('linkcheck_anchors_ignore_for_url', (), '', (tuple, list))
719
678
  app.add_config_value('linkcheck_rate_limit_timeout', 300.0, '', (int, float))
720
- app.add_config_value('linkcheck_allow_unauthorized', True, '')
721
- app.add_config_value('linkcheck_report_timeouts_as_broken', True, '', bool)
679
+ app.add_config_value('linkcheck_allow_unauthorized', False, '')
680
+ app.add_config_value('linkcheck_report_timeouts_as_broken', False, '', bool)
722
681
 
723
682
  app.add_event('linkcheck-process-uri')
724
683
 
@@ -20,9 +20,8 @@ from sphinx.util import logging
20
20
  from sphinx.util.console import darkgreen
21
21
  from sphinx.util.display import progress_message, status_iterator
22
22
  from sphinx.util.docutils import new_document
23
- from sphinx.util.fileutil import copy_asset_file
24
23
  from sphinx.util.nodes import inline_all_toctrees
25
- from sphinx.util.osutil import SEP, ensuredir, make_filename_from_project
24
+ from sphinx.util.osutil import SEP, copyfile, ensuredir, make_filename_from_project
26
25
  from sphinx.writers.texinfo import TexinfoTranslator, TexinfoWriter
27
26
 
28
27
  if TYPE_CHECKING:
@@ -189,10 +188,13 @@ class TexinfoBuilder(Builder):
189
188
  stringify_func=stringify_func):
190
189
  dest = self.images[src]
191
190
  try:
192
- imagedir = path.join(self.outdir, targetname + '-figures')
191
+ imagedir = self.outdir / f'{targetname}-figures'
193
192
  ensuredir(imagedir)
194
- copy_asset_file(path.join(self.srcdir, src),
195
- path.join(imagedir, dest))
193
+ copyfile(
194
+ self.srcdir / src,
195
+ imagedir / dest,
196
+ force=True,
197
+ )
196
198
  except Exception as err:
197
199
  logger.warning(__('cannot copy image file %r: %s'),
198
200
  path.join(self.srcdir, src), err)
@@ -201,7 +203,11 @@ class TexinfoBuilder(Builder):
201
203
  try:
202
204
  with progress_message(__('copying Texinfo support files')):
203
205
  logger.info('Makefile ', nonl=True)
204
- copy_asset_file(os.path.join(template_dir, 'Makefile'), self.outdir)
206
+ copyfile(
207
+ os.path.join(template_dir, 'Makefile'),
208
+ self.outdir / 'Makefile',
209
+ force=True,
210
+ )
205
211
  except OSError as err:
206
212
  logger.warning(__("error writing file Makefile: %s"), err)
207
213
 
sphinx/builders/text.py CHANGED
@@ -10,7 +10,11 @@ from docutils.io import StringOutput
10
10
  from sphinx.builders import Builder
11
11
  from sphinx.locale import __
12
12
  from sphinx.util import logging
13
- from sphinx.util.osutil import ensuredir, os_path
13
+ from sphinx.util.osutil import (
14
+ _last_modified_time,
15
+ ensuredir,
16
+ os_path,
17
+ )
14
18
  from sphinx.writers.text import TextTranslator, TextWriter
15
19
 
16
20
  if TYPE_CHECKING:
@@ -46,11 +50,11 @@ class TextBuilder(Builder):
46
50
  continue
47
51
  targetname = path.join(self.outdir, docname + self.out_suffix)
48
52
  try:
49
- targetmtime = path.getmtime(targetname)
53
+ targetmtime = _last_modified_time(targetname)
50
54
  except Exception:
51
55
  targetmtime = 0
52
56
  try:
53
- srcmtime = path.getmtime(self.env.doc2path(docname))
57
+ srcmtime = _last_modified_time(self.env.doc2path(docname))
54
58
  if srcmtime > targetmtime:
55
59
  yield docname
56
60
  except OSError:
sphinx/builders/xml.py CHANGED
@@ -12,7 +12,11 @@ from docutils.writers.docutils_xml import XMLTranslator
12
12
  from sphinx.builders import Builder
13
13
  from sphinx.locale import __
14
14
  from sphinx.util import logging
15
- from sphinx.util.osutil import ensuredir, os_path
15
+ from sphinx.util.osutil import (
16
+ _last_modified_time,
17
+ ensuredir,
18
+ os_path,
19
+ )
16
20
  from sphinx.writers.xml import PseudoXMLWriter, XMLWriter
17
21
 
18
22
  if TYPE_CHECKING:
@@ -52,11 +56,11 @@ class XMLBuilder(Builder):
52
56
  continue
53
57
  targetname = path.join(self.outdir, docname + self.out_suffix)
54
58
  try:
55
- targetmtime = path.getmtime(targetname)
59
+ targetmtime = _last_modified_time(targetname)
56
60
  except Exception:
57
61
  targetmtime = 0
58
62
  try:
59
- srcmtime = path.getmtime(self.env.doc2path(docname))
63
+ srcmtime = _last_modified_time(self.env.doc2path(docname))
60
64
  if srcmtime > targetmtime:
61
65
  yield docname
62
66
  except OSError:
sphinx/cmd/quickstart.py CHANGED
@@ -8,7 +8,7 @@ import os
8
8
  import sys
9
9
  import time
10
10
  from os import path
11
- from typing import TYPE_CHECKING, Any, Callable
11
+ from typing import TYPE_CHECKING, Any
12
12
 
13
13
  # try to import readline, unix specific enhancement
14
14
  try:
@@ -36,7 +36,7 @@ from sphinx.util.osutil import ensuredir
36
36
  from sphinx.util.template import SphinxRenderer
37
37
 
38
38
  if TYPE_CHECKING:
39
- from collections.abc import Sequence
39
+ from collections.abc import Callable, Sequence
40
40
 
41
41
  EXTENSIONS = {
42
42
  'autodoc': __('automatically insert docstrings from modules'),
@@ -326,7 +326,10 @@ def ask_user(d: dict[str, Any]) -> None:
326
326
 
327
327
 
328
328
  def generate(
329
- d: dict, overwrite: bool = True, silent: bool = False, templatedir: str | None = None,
329
+ d: dict[str, Any],
330
+ overwrite: bool = True,
331
+ silent: bool = False,
332
+ templatedir: str | None = None,
330
333
  ) -> None:
331
334
  """Generate project based on values in *d*."""
332
335
  template = QuickstartRenderer(templatedir or '')
@@ -389,15 +392,8 @@ def generate(
389
392
  else:
390
393
  write_file(masterfile, template.render('quickstart/root_doc.rst.jinja', d))
391
394
 
392
- if d.get('make_mode'):
393
- makefile_template = 'quickstart/Makefile.new.jinja'
394
- batchfile_template = 'quickstart/make.bat.new.jinja'
395
- else:
396
- # xref RemovedInSphinx80Warning
397
- msg = "Support for '--no-use-make-mode' will be removed in Sphinx 8."
398
- print(colorize('red', msg))
399
- makefile_template = 'quickstart/Makefile.jinja'
400
- batchfile_template = 'quickstart/make.bat.jinja'
395
+ makefile_template = 'quickstart/Makefile.new.jinja'
396
+ batchfile_template = 'quickstart/make.bat.new.jinja'
401
397
 
402
398
  if d['makefile'] is True:
403
399
  d['rsrcdir'] = 'source' if d['sep'] else '.'
@@ -428,13 +424,9 @@ def generate(
428
424
  print(__('where "builder" is one of the supported builders, '
429
425
  'e.g. html, latex or linkcheck.'))
430
426
  print()
431
- if not d.get('make_mode'):
432
- # xref RemovedInSphinx80Warning
433
- msg = "Support for '--no-use-make-mode' will be removed in Sphinx 8."
434
- print(colorize('red', msg))
435
427
 
436
428
 
437
- def valid_dir(d: dict) -> bool:
429
+ def valid_dir(d: dict[str, Any]) -> bool:
438
430
  dir = d['path']
439
431
  if not path.exists(dir):
440
432
  return True
@@ -527,12 +519,10 @@ def get_parser() -> argparse.ArgumentParser:
527
519
  group.add_argument('--no-batchfile', action='store_false',
528
520
  dest='batchfile',
529
521
  help=__('do not create batchfile'))
522
+ # --use-make-mode is a no-op from Sphinx 8.
530
523
  group.add_argument('-m', '--use-make-mode', action='store_true',
531
524
  dest='make_mode', default=True,
532
525
  help=__('use make-mode for Makefile/make.bat'))
533
- group.add_argument('-M', '--no-use-make-mode', action='store_false',
534
- dest='make_mode',
535
- help=__('do not use make-mode for Makefile/make.bat'))
536
526
 
537
527
  group = parser.add_argument_group(__('Project templating'))
538
528
  group.add_argument('-t', '--templatedir', metavar='TEMPLATEDIR',
sphinx/config.py CHANGED
@@ -8,14 +8,13 @@ import traceback
8
8
  import types
9
9
  import warnings
10
10
  from os import getenv, path
11
- from typing import TYPE_CHECKING, Any, Literal, NamedTuple, Union
11
+ from typing import TYPE_CHECKING, Any, Literal, NamedTuple
12
12
 
13
13
  from sphinx.deprecation import RemovedInSphinx90Warning
14
14
  from sphinx.errors import ConfigError, ExtensionError
15
15
  from sphinx.locale import _, __
16
16
  from sphinx.util import logging
17
17
  from sphinx.util.osutil import fs_encoding
18
- from sphinx.util.typing import ExtensionMetadata, NoneType
19
18
 
20
19
  if sys.version_info >= (3, 11):
21
20
  from contextlib import chdir
@@ -25,15 +24,16 @@ else:
25
24
  if TYPE_CHECKING:
26
25
  import os
27
26
  from collections.abc import Collection, Iterator, Sequence, Set
27
+ from typing import TypeAlias
28
28
 
29
29
  from sphinx.application import Sphinx
30
30
  from sphinx.environment import BuildEnvironment
31
31
  from sphinx.util.tags import Tags
32
- from sphinx.util.typing import _ExtensionSetupFunc
32
+ from sphinx.util.typing import ExtensionMetadata, _ExtensionSetupFunc
33
33
 
34
34
  logger = logging.getLogger(__name__)
35
35
 
36
- _ConfigRebuild = Literal[
36
+ _ConfigRebuild: TypeAlias = Literal[
37
37
  '', 'env', 'epub', 'gettext', 'html',
38
38
  # sphinxcontrib-applehelp
39
39
  'applehelp',
@@ -66,7 +66,7 @@ def is_serializable(obj: object, *, _seen: frozenset[int] = frozenset()) -> bool
66
66
  is_serializable(key, _seen=seen) and is_serializable(value, _seen=seen)
67
67
  for key, value in obj.items()
68
68
  )
69
- elif isinstance(obj, (list, tuple, set, frozenset)):
69
+ elif isinstance(obj, list | tuple | set | frozenset):
70
70
  seen = _seen | {id(obj)}
71
71
  return all(is_serializable(item, _seen=seen) for item in obj)
72
72
 
@@ -87,13 +87,13 @@ class ENUM:
87
87
  self.candidates = candidates
88
88
 
89
89
  def match(self, value: str | list | tuple) -> bool:
90
- if isinstance(value, (list, tuple)):
90
+ if isinstance(value, list | tuple):
91
91
  return all(item in self.candidates for item in value)
92
92
  else:
93
93
  return value in self.candidates
94
94
 
95
95
 
96
- _OptValidTypes = Union[tuple[()], tuple[type, ...], frozenset[type], ENUM]
96
+ _OptValidTypes: TypeAlias = tuple[()] | tuple[type, ...] | frozenset[type] | ENUM
97
97
 
98
98
 
99
99
  class _Opt:
@@ -244,12 +244,12 @@ class Config:
244
244
  'template_bridge': _Opt(None, 'html', frozenset((str,))),
245
245
  'keep_warnings': _Opt(False, 'env', ()),
246
246
  'suppress_warnings': _Opt([], 'env', ()),
247
- 'show_warning_types': _Opt(False, 'env', frozenset((bool,))),
247
+ 'show_warning_types': _Opt(True, 'env', frozenset((bool,))),
248
248
  'modindex_common_prefix': _Opt([], 'html', ()),
249
249
  'rst_epilog': _Opt(None, 'env', frozenset((str,))),
250
250
  'rst_prolog': _Opt(None, 'env', frozenset((str,))),
251
251
  'trim_doctest_flags': _Opt(True, 'env', ()),
252
- 'primary_domain': _Opt('py', 'env', frozenset((NoneType,))),
252
+ 'primary_domain': _Opt('py', 'env', frozenset((types.NoneType,))),
253
253
  'needs_sphinx': _Opt(None, '', frozenset((str,))),
254
254
  'needs_extensions': _Opt({}, '', ()),
255
255
  'manpages_url': _Opt(None, 'env', ()),
@@ -260,7 +260,7 @@ class Config:
260
260
  'numfig_secnum_depth': _Opt(1, 'env', ()),
261
261
  'numfig_format': _Opt({}, 'env', ()), # will be initialized in init_numfig_format()
262
262
  'maximum_signature_line_length': _Opt(
263
- None, 'env', frozenset((int, NoneType))),
263
+ None, 'env', frozenset((int, types.NoneType))),
264
264
  'math_number_all': _Opt(False, 'env', ()),
265
265
  'math_eqref_format': _Opt(None, 'env', frozenset((str,))),
266
266
  'math_numfig': _Opt(True, 'env', ()),
@@ -549,7 +549,7 @@ def _validate_valid_types(
549
549
  ) -> tuple[()] | tuple[type, ...] | frozenset[type] | ENUM:
550
550
  if not valid_types:
551
551
  return ()
552
- if isinstance(valid_types, (frozenset, ENUM)):
552
+ if isinstance(valid_types, frozenset | ENUM):
553
553
  return valid_types
554
554
  if isinstance(valid_types, type):
555
555
  return frozenset((valid_types,))
@@ -584,13 +584,13 @@ def convert_source_suffix(app: Sphinx, config: Config) -> None:
584
584
  config.source_suffix = {source_suffix: 'restructuredtext'}
585
585
  logger.info(__("Converting `source_suffix = %r` to `source_suffix = %r`."),
586
586
  source_suffix, config.source_suffix)
587
- elif isinstance(source_suffix, (list, tuple)):
587
+ elif isinstance(source_suffix, list | tuple):
588
588
  # if list, considers as all of them are default filetype
589
589
  config.source_suffix = dict.fromkeys(source_suffix, 'restructuredtext')
590
590
  logger.info(__("Converting `source_suffix = %r` to `source_suffix = %r`."),
591
591
  source_suffix, config.source_suffix)
592
592
  elif not isinstance(source_suffix, dict):
593
- msg = __("The config value `source_suffix' expects a dictionary,"
593
+ msg = __("The config value `source_suffix' expects a dictionary, "
594
594
  "a string, or a list of strings. Got `%r' instead (type %s).")
595
595
  raise ConfigError(msg % (source_suffix, type(source_suffix)))
596
596
 
sphinx/deprecation.py CHANGED
@@ -5,15 +5,15 @@ from __future__ import annotations
5
5
  import warnings
6
6
 
7
7
 
8
- class RemovedInSphinx80Warning(DeprecationWarning):
8
+ class RemovedInSphinx90Warning(DeprecationWarning):
9
9
  pass
10
10
 
11
11
 
12
- class RemovedInSphinx90Warning(PendingDeprecationWarning):
12
+ class RemovedInSphinx10Warning(PendingDeprecationWarning):
13
13
  pass
14
14
 
15
15
 
16
- RemovedInNextVersionWarning = RemovedInSphinx80Warning
16
+ RemovedInNextVersionWarning = RemovedInSphinx90Warning
17
17
 
18
18
 
19
19
  def _deprecation_warning(
@@ -40,7 +40,7 @@ def _deprecation_warning(
40
40
 
41
41
  # deprecated name -> (object to return, canonical path or empty string, removal version)
42
42
  _DEPRECATED_OBJECTS = {
43
- 'deprecated_name': (object_to_return, 'fully_qualified_replacement_name', (8, 0)),
43
+ 'deprecated_name': (object_to_return, 'fully_qualified_replacement_name', (9, 0)),
44
44
  }
45
45
 
46
46
 
@@ -55,10 +55,10 @@ def _deprecation_warning(
55
55
  _deprecation_warning(__name__, name, canonical_name, remove=remove)
56
56
  return deprecated_object
57
57
  """
58
- if remove == (8, 0):
59
- warning_class: type[Warning] = RemovedInSphinx80Warning
60
- elif remove == (9, 0):
61
- warning_class = RemovedInSphinx90Warning
58
+ if remove == (9, 0):
59
+ warning_class: type[Warning] = RemovedInSphinx90Warning
60
+ elif remove == (10, 0):
61
+ warning_class = RemovedInSphinx10Warning
62
62
  else:
63
63
  msg = f'removal version {remove!r} is invalid!'
64
64
  raise RuntimeError(msg)
@@ -220,21 +220,26 @@ class ObjectDescription(SphinxDirective, Generic[ObjDescT]):
220
220
  node['domain'] = self.domain
221
221
  # 'desctype' is a backwards compatible attribute
222
222
  node['objtype'] = node['desctype'] = self.objtype
223
+
224
+ # Copy old option names to new ones
225
+ # xref RemovedInSphinx90Warning
226
+ # deprecate noindex, noindexentry, and nocontentsentry in Sphinx 9.0
227
+ if 'no-index' not in self.options and 'noindex' in self.options:
228
+ self.options['no-index'] = self.options['noindex']
229
+ if 'no-index-entry' not in self.options and 'noindexentry' in self.options:
230
+ self.options['no-index-entry'] = self.options['noindexentry']
231
+ if 'no-contents-entry' not in self.options and 'nocontentsentry' in self.options:
232
+ self.options['no-contents-entry'] = self.options['nocontentsentry']
233
+
223
234
  node['no-index'] = node['noindex'] = no_index = (
224
235
  'no-index' in self.options
225
- # xref RemovedInSphinx90Warning
226
- # deprecate noindex in Sphinx 9.0
227
- or 'noindex' in self.options)
236
+ )
228
237
  node['no-index-entry'] = node['noindexentry'] = (
229
238
  'no-index-entry' in self.options
230
- # xref RemovedInSphinx90Warning
231
- # deprecate noindexentry in Sphinx 9.0
232
- or 'noindexentry' in self.options)
239
+ )
233
240
  node['no-contents-entry'] = node['nocontentsentry'] = (
234
241
  'no-contents-entry' in self.options
235
- # xref RemovedInSphinx90Warning
236
- # deprecate nocontentsentry in Sphinx 9.0
237
- or 'nocontentsentry' in self.options)
242
+ )
238
243
  node['no-typesetting'] = ('no-typesetting' in self.options)
239
244
  if self.domain:
240
245
  node['classes'].append(self.domain)
@@ -13,7 +13,6 @@ from docutils.parsers.rst.directives.misc import Include as BaseInclude
13
13
  from docutils.statemachine import StateMachine
14
14
 
15
15
  from sphinx import addnodes
16
- from sphinx.domains.changeset import VersionChange # NoQA: F401 # for compatibility
17
16
  from sphinx.domains.std import StandardDomain
18
17
  from sphinx.locale import _, __
19
18
  from sphinx.util import docname_join, logging, url_re
@@ -145,7 +144,7 @@ class TocTree(SphinxDirective):
145
144
  continue
146
145
 
147
146
  if docname not in frozen_all_docnames:
148
- if excluded(self.env.doc2path(docname, False)):
147
+ if excluded(str(self.env.doc2path(docname, False))):
149
148
  message = __('toctree contains reference to excluded document %r')
150
149
  subtype = 'excluded'
151
150
  else:
@@ -209,7 +208,7 @@ class Author(SphinxDirective):
209
208
  return ret
210
209
 
211
210
 
212
- class SeeAlso(BaseAdmonition):
211
+ class SeeAlso(BaseAdmonition): # type: ignore[misc]
213
212
  """
214
213
  An admonition mentioning things to look at as reference.
215
214
  """
@@ -27,7 +27,7 @@ if TYPE_CHECKING:
27
27
  logger = logging.getLogger(__name__)
28
28
 
29
29
 
30
- class Figure(images.Figure):
30
+ class Figure(images.Figure): # type: ignore[misc]
31
31
  """The figure directive which applies `:name:` option to the figure node
32
32
  instead of the image node.
33
33
  """
@@ -53,7 +53,7 @@ class Figure(images.Figure):
53
53
  return [figure_node]
54
54
 
55
55
 
56
- class CSVTable(tables.CSVTable):
56
+ class CSVTable(tables.CSVTable): # type: ignore[misc]
57
57
  """The csv-table directive which searches a CSV file from Sphinx project's source
58
58
  directory when an absolute path is given via :file: option.
59
59
  """
@@ -8,7 +8,8 @@ from __future__ import annotations
8
8
 
9
9
  import copy
10
10
  from abc import ABC, abstractmethod
11
- from typing import TYPE_CHECKING, Any, Callable, NamedTuple, Optional, cast
11
+ from collections.abc import Callable
12
+ from typing import TYPE_CHECKING, Any, NamedTuple, cast
12
13
 
13
14
  from docutils.nodes import Element, Node, system_message
14
15
 
@@ -17,6 +18,7 @@ from sphinx.locale import _
17
18
 
18
19
  if TYPE_CHECKING:
19
20
  from collections.abc import Iterable, Sequence
21
+ from typing import TypeAlias
20
22
 
21
23
  from docutils import nodes
22
24
  from docutils.parsers.rst import Directive
@@ -153,7 +155,7 @@ class Index(ABC):
153
155
  raise NotImplementedError
154
156
 
155
157
 
156
- TitleGetter = Callable[[Node], Optional[str]]
158
+ TitleGetter: TypeAlias = Callable[[Node], str | None]
157
159
 
158
160
 
159
161
  class Domain:
@@ -19,7 +19,7 @@ from sphinx.domains.c._ids import _macroKeywords, _max_id
19
19
  from sphinx.domains.c._parser import DefinitionParser
20
20
  from sphinx.domains.c._symbol import Symbol, _DuplicateSymbolError
21
21
  from sphinx.locale import _, __
22
- from sphinx.roles import SphinxRole, XRefRole
22
+ from sphinx.roles import XRefRole
23
23
  from sphinx.transforms import SphinxTransform
24
24
  from sphinx.transforms.post_transforms import ReferencesResolver
25
25
  from sphinx.util import logging
@@ -29,7 +29,7 @@ from sphinx.util.cfamily import (
29
29
  anon_identifier_re,
30
30
  )
31
31
  from sphinx.util.docfields import Field, GroupedField, TypedField
32
- from sphinx.util.docutils import SphinxDirective
32
+ from sphinx.util.docutils import SphinxDirective, SphinxRole
33
33
  from sphinx.util.nodes import make_refnode
34
34
 
35
35
  if TYPE_CHECKING:
sphinx/domains/c/_ast.py CHANGED
@@ -12,19 +12,20 @@ from sphinx.util.cfamily import (
12
12
  ASTAttributeList,
13
13
  ASTBaseBase,
14
14
  ASTBaseParenExprList,
15
- StringifyTransform,
16
15
  UnsupportedMultiCharacterCharLiteral,
17
16
  verify_description_mode,
18
17
  )
19
18
 
20
19
  if TYPE_CHECKING:
20
+ from typing import TypeAlias
21
21
 
22
22
  from docutils.nodes import Element, Node, TextElement
23
23
 
24
24
  from sphinx.domains.c._symbol import Symbol
25
25
  from sphinx.environment import BuildEnvironment
26
+ from sphinx.util.cfamily import StringifyTransform
26
27
 
27
- DeclarationType = Union[
28
+ DeclarationType: TypeAlias = Union[ # NoQA: UP007
28
29
  "ASTStruct", "ASTUnion", "ASTEnum", "ASTEnumerator",
29
30
  "ASTType", "ASTTypeWithInit", "ASTMacro",
30
31
  ]
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import TYPE_CHECKING, Any, Callable
3
+ from typing import TYPE_CHECKING, Any
4
4
 
5
5
  from sphinx.domains.c._ast import (
6
6
  ASTAlignofExpr,
@@ -53,7 +53,6 @@ from sphinx.domains.c._ast import (
53
53
  ASTTypeWithInit,
54
54
  ASTUnaryOpExpr,
55
55
  ASTUnion,
56
- DeclarationType,
57
56
  )
58
57
  from sphinx.domains.c._ids import (
59
58
  _expression_assignment_ops,
@@ -80,7 +79,9 @@ from sphinx.util.cfamily import (
80
79
  )
81
80
 
82
81
  if TYPE_CHECKING:
83
- from collections.abc import Sequence
82
+ from collections.abc import Callable, Sequence
83
+
84
+ from sphinx.domains.c._ast import DeclarationType
84
85
 
85
86
 
86
87
  class DefinitionParser(BaseParser):
@@ -23,7 +23,7 @@ from sphinx.domains.cpp._parser import DefinitionParser
23
23
  from sphinx.domains.cpp._symbol import Symbol, _DuplicateSymbolError
24
24
  from sphinx.errors import NoUri
25
25
  from sphinx.locale import _, __
26
- from sphinx.roles import SphinxRole, XRefRole
26
+ from sphinx.roles import XRefRole
27
27
  from sphinx.transforms import SphinxTransform
28
28
  from sphinx.transforms.post_transforms import ReferencesResolver
29
29
  from sphinx.util import logging
@@ -33,7 +33,7 @@ from sphinx.util.cfamily import (
33
33
  anon_identifier_re,
34
34
  )
35
35
  from sphinx.util.docfields import Field, GroupedField
36
- from sphinx.util.docutils import SphinxDirective
36
+ from sphinx.util.docutils import SphinxDirective, SphinxRole
37
37
  from sphinx.util.nodes import make_refnode
38
38
 
39
39
  if TYPE_CHECKING: