mkdocstrings-python 1.19.0__py3-none-any.whl → 2.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.
Files changed (143) hide show
  1. mkdocstrings_handlers/python/__init__.py +0 -4
  2. mkdocstrings_handlers/python/_internal/handler.py +5 -44
  3. mkdocstrings_handlers/python/_internal/rendering.py +14 -111
  4. mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja +2 -4
  5. mkdocstrings_handlers/python/templates/material/_base/class.html.jinja +8 -16
  6. mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja +4 -8
  7. mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja +1 -2
  8. mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja +1 -2
  9. mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja +1 -2
  10. mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja +1 -2
  11. mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja +4 -8
  12. mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja +7 -14
  13. mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja +4 -8
  14. mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja +5 -10
  15. mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja +5 -10
  16. mkdocstrings_handlers/python/templates/material/_base/docstring/type_aliases.html.jinja +1 -1
  17. mkdocstrings_handlers/python/templates/material/_base/docstring/type_parameters.html.jinja +9 -9
  18. mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja +4 -8
  19. mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja +5 -10
  20. mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja +15 -30
  21. mkdocstrings_handlers/python/templates/material/_base/function.html.jinja +5 -9
  22. mkdocstrings_handlers/python/templates/material/_base/language.html.jinja +3 -6
  23. mkdocstrings_handlers/python/templates/material/_base/module.html.jinja +4 -8
  24. mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja +3 -6
  25. mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html.jinja +1 -2
  26. mkdocstrings_handlers/python/templates/material/_base/summary/classes.html.jinja +1 -2
  27. mkdocstrings_handlers/python/templates/material/_base/summary/functions.html.jinja +1 -2
  28. mkdocstrings_handlers/python/templates/material/_base/summary/modules.html.jinja +1 -2
  29. mkdocstrings_handlers/python/templates/material/_base/summary/type_aliases.html.jinja +1 -2
  30. mkdocstrings_handlers/python/templates/material/_base/summary.html.jinja +5 -10
  31. mkdocstrings_handlers/python/templates/material/_base/type_alias.html.jinja +3 -6
  32. mkdocstrings_handlers/python/templates/material/_base/type_parameters.html.jinja +2 -4
  33. mkdocstrings_handlers/python/templates/readthedocs/_base/class.html.jinja +18 -18
  34. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja +2 -4
  35. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja +2 -4
  36. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja +3 -6
  37. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja +2 -4
  38. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja +2 -4
  39. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja +2 -4
  40. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja +2 -4
  41. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja +2 -4
  42. mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja +3 -6
  43. mkdocstrings_python-2.0.0.dist-info/METADATA +179 -0
  44. mkdocstrings_python-2.0.0.dist-info/RECORD +121 -0
  45. {mkdocstrings_python-1.19.0.dist-info → mkdocstrings_python-2.0.0.dist-info}/WHEEL +1 -1
  46. mkdocstrings_handlers/python/config.py +0 -17
  47. mkdocstrings_handlers/python/handler.py +0 -17
  48. mkdocstrings_handlers/python/rendering.py +0 -17
  49. mkdocstrings_handlers/python/templates/material/_base/attribute.html +0 -10
  50. mkdocstrings_handlers/python/templates/material/_base/children.html +0 -10
  51. mkdocstrings_handlers/python/templates/material/_base/class.html +0 -10
  52. mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html +0 -10
  53. mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html +0 -10
  54. mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html +0 -10
  55. mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html +0 -10
  56. mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html +0 -10
  57. mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html +0 -10
  58. mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html +0 -10
  59. mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html +0 -10
  60. mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html +0 -10
  61. mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html +0 -10
  62. mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html +0 -10
  63. mkdocstrings_handlers/python/templates/material/_base/docstring/type_aliases.html +0 -10
  64. mkdocstrings_handlers/python/templates/material/_base/docstring/type_parameters.html +0 -10
  65. mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html +0 -10
  66. mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html +0 -10
  67. mkdocstrings_handlers/python/templates/material/_base/docstring.html +0 -10
  68. mkdocstrings_handlers/python/templates/material/_base/expression.html +0 -10
  69. mkdocstrings_handlers/python/templates/material/_base/function.html +0 -10
  70. mkdocstrings_handlers/python/templates/material/_base/labels.html +0 -10
  71. mkdocstrings_handlers/python/templates/material/_base/language.html +0 -10
  72. mkdocstrings_handlers/python/templates/material/_base/languages/en.html +0 -10
  73. mkdocstrings_handlers/python/templates/material/_base/languages/ja.html +0 -10
  74. mkdocstrings_handlers/python/templates/material/_base/languages/zh.html +0 -10
  75. mkdocstrings_handlers/python/templates/material/_base/module.html +0 -10
  76. mkdocstrings_handlers/python/templates/material/_base/signature.html +0 -10
  77. mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html +0 -10
  78. mkdocstrings_handlers/python/templates/material/_base/summary/classes.html +0 -10
  79. mkdocstrings_handlers/python/templates/material/_base/summary/functions.html +0 -10
  80. mkdocstrings_handlers/python/templates/material/_base/summary/modules.html +0 -10
  81. mkdocstrings_handlers/python/templates/material/_base/summary/type_aliases.html +0 -10
  82. mkdocstrings_handlers/python/templates/material/_base/summary.html +0 -10
  83. mkdocstrings_handlers/python/templates/material/_base/type_alias.html +0 -10
  84. mkdocstrings_handlers/python/templates/material/_base/type_parameters.html +0 -10
  85. mkdocstrings_handlers/python/templates/material/attribute.html +0 -2
  86. mkdocstrings_handlers/python/templates/material/children.html +0 -2
  87. mkdocstrings_handlers/python/templates/material/class.html +0 -2
  88. mkdocstrings_handlers/python/templates/material/docstring/admonition.html +0 -2
  89. mkdocstrings_handlers/python/templates/material/docstring/attributes.html +0 -2
  90. mkdocstrings_handlers/python/templates/material/docstring/classes.html +0 -2
  91. mkdocstrings_handlers/python/templates/material/docstring/examples.html +0 -2
  92. mkdocstrings_handlers/python/templates/material/docstring/functions.html +0 -2
  93. mkdocstrings_handlers/python/templates/material/docstring/modules.html +0 -2
  94. mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html +0 -2
  95. mkdocstrings_handlers/python/templates/material/docstring/parameters.html +0 -2
  96. mkdocstrings_handlers/python/templates/material/docstring/raises.html +0 -2
  97. mkdocstrings_handlers/python/templates/material/docstring/receives.html +0 -2
  98. mkdocstrings_handlers/python/templates/material/docstring/returns.html +0 -2
  99. mkdocstrings_handlers/python/templates/material/docstring/warns.html +0 -2
  100. mkdocstrings_handlers/python/templates/material/docstring/yields.html +0 -2
  101. mkdocstrings_handlers/python/templates/material/docstring.html +0 -2
  102. mkdocstrings_handlers/python/templates/material/expression.html +0 -2
  103. mkdocstrings_handlers/python/templates/material/function.html +0 -2
  104. mkdocstrings_handlers/python/templates/material/labels.html +0 -2
  105. mkdocstrings_handlers/python/templates/material/language.html +0 -2
  106. mkdocstrings_handlers/python/templates/material/languages/en.html +0 -2
  107. mkdocstrings_handlers/python/templates/material/languages/ja.html +0 -2
  108. mkdocstrings_handlers/python/templates/material/languages/zh.html +0 -2
  109. mkdocstrings_handlers/python/templates/material/module.html +0 -2
  110. mkdocstrings_handlers/python/templates/material/signature.html +0 -2
  111. mkdocstrings_handlers/python/templates/material/summary/attributes.html +0 -2
  112. mkdocstrings_handlers/python/templates/material/summary/classes.html +0 -2
  113. mkdocstrings_handlers/python/templates/material/summary/functions.html +0 -2
  114. mkdocstrings_handlers/python/templates/material/summary/modules.html +0 -2
  115. mkdocstrings_handlers/python/templates/material/summary.html +0 -2
  116. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html +0 -10
  117. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html +0 -10
  118. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html +0 -10
  119. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html +0 -10
  120. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html +0 -10
  121. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html +0 -10
  122. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html +0 -10
  123. mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html +0 -10
  124. mkdocstrings_handlers/python/templates/readthedocs/_base/language.html +0 -10
  125. mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html +0 -10
  126. mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html +0 -10
  127. mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html +0 -10
  128. mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html +0 -2
  129. mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html +0 -2
  130. mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html +0 -2
  131. mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html +0 -2
  132. mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html +0 -2
  133. mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html +0 -2
  134. mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html +0 -2
  135. mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html +0 -2
  136. mkdocstrings_handlers/python/templates/readthedocs/language.html +0 -2
  137. mkdocstrings_handlers/python/templates/readthedocs/languages/en.html +0 -2
  138. mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html +0 -2
  139. mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html +0 -2
  140. mkdocstrings_python-1.19.0.dist-info/METADATA +0 -121
  141. mkdocstrings_python-1.19.0.dist-info/RECORD +0 -215
  142. {mkdocstrings_python-1.19.0.dist-info → mkdocstrings_python-2.0.0.dist-info}/entry_points.txt +0 -0
  143. {mkdocstrings_python-1.19.0.dist-info → mkdocstrings_python-2.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -24,14 +24,12 @@ from mkdocstrings_handlers.python._internal.rendering import (
24
24
  do_as_modules_section,
25
25
  do_as_type_aliases_section,
26
26
  do_backlink_tree,
27
- do_crossref,
28
27
  do_filter_objects,
29
28
  do_format_attribute,
30
29
  do_format_code,
31
30
  do_format_signature,
32
31
  do_format_type_alias,
33
32
  do_get_template,
34
- do_multi_crossref,
35
33
  do_order_members,
36
34
  do_split_path,
37
35
  do_stash_crossref,
@@ -59,14 +57,12 @@ __all__ = [
59
57
  "do_as_modules_section",
60
58
  "do_as_type_aliases_section",
61
59
  "do_backlink_tree",
62
- "do_crossref",
63
60
  "do_filter_objects",
64
61
  "do_format_attribute",
65
62
  "do_format_code",
66
63
  "do_format_signature",
67
64
  "do_format_type_alias",
68
65
  "do_get_template",
69
- "do_multi_crossref",
70
66
  "do_order_members",
71
67
  "do_split_path",
72
68
  "do_stash_crossref",
@@ -10,7 +10,6 @@ from contextlib import suppress
10
10
  from dataclasses import asdict
11
11
  from pathlib import Path
12
12
  from typing import TYPE_CHECKING, Any, BinaryIO, ClassVar
13
- from warnings import warn
14
13
 
15
14
  from griffe import (
16
15
  AliasResolutionError,
@@ -56,17 +55,6 @@ _logger = get_logger(__name__)
56
55
  patch_loggers(get_logger)
57
56
 
58
57
 
59
- # YORE: Bump 2: Remove block.
60
- def _warn_extra_options(names: Sequence[str]) -> None:
61
- warn(
62
- "Passing extra options directly under `options` is deprecated. "
63
- "Instead, pass them under `options.extra`, and update your templates. "
64
- f"Current extra (unrecognized) options: {', '.join(sorted(names))}",
65
- DeprecationWarning,
66
- stacklevel=3,
67
- )
68
-
69
-
70
58
  class PythonHandler(BaseHandler):
71
59
  """The Python handler class."""
72
60
 
@@ -97,18 +85,9 @@ class PythonHandler(BaseHandler):
97
85
  self.base_dir = base_dir
98
86
  """The base directory of the project."""
99
87
 
100
- # YORE: Bump 2: Remove block.
101
- global_extra, global_options = PythonOptions._extract_extra(config.options)
102
- if global_extra:
103
- _warn_extra_options(global_extra.keys()) # type: ignore[arg-type]
104
- self._global_extra = global_extra
105
- self.global_options = global_options
88
+ self.global_options = config.options
106
89
  """The global configuration options (in `mkdocs.yml`)."""
107
90
 
108
- # YORE: Bump 2: Replace `# ` with `` within block.
109
- # self.global_options = config.options
110
- # """The global configuration options (in `mkdocs.yml`)."""
111
-
112
91
  # Warn if user overrides base templates.
113
92
  if self.custom_templates:
114
93
  for theme_dir in base_dir.joinpath(self.custom_templates, "python").iterdir():
@@ -188,25 +167,13 @@ class PythonHandler(BaseHandler):
188
167
  Returns:
189
168
  The combined options.
190
169
  """
191
- # YORE: Bump 2: Remove block.
192
- local_extra, local_options = PythonOptions._extract_extra(local_options) # type: ignore[arg-type]
193
- if local_extra:
194
- _warn_extra_options(local_extra.keys()) # type: ignore[arg-type]
195
- unknown_extra = self._global_extra | local_extra
196
-
197
170
  extra = {**self.global_options.get("extra", {}), **local_options.get("extra", {})}
198
171
  options = {**self.global_options, **local_options, "extra": extra}
199
172
  try:
200
- # YORE: Bump 2: Replace `opts =` with `return` within line.
201
- opts = PythonOptions.from_data(**options)
173
+ return PythonOptions.from_data(**options)
202
174
  except Exception as error:
203
175
  raise PluginError(f"Invalid options: {error}") from error
204
176
 
205
- # YORE: Bump 2: Remove block.
206
- for key, value in unknown_extra.items():
207
- object.__setattr__(opts, key, value)
208
- return opts
209
-
210
177
  def collect(self, identifier: str, options: PythonOptions) -> CollectorItem:
211
178
  """Collect the documentation for the given identifier.
212
179
 
@@ -291,7 +258,7 @@ class PythonHandler(BaseHandler):
291
258
  Returns:
292
259
  The rendered data (HTML).
293
260
  """
294
- template_name = rendering.do_get_template(self.env, data)
261
+ template_name = rendering.do_get_template(data)
295
262
  template = self.env.get_template(template_name)
296
263
 
297
264
  return template.render(
@@ -303,8 +270,7 @@ class PythonHandler(BaseHandler):
303
270
  # than as an item in a dictionary.
304
271
  "heading_level": options.heading_level,
305
272
  "root": True,
306
- # YORE: Bump 2: Regex-replace ` or .+` with ` or "en",` within line.
307
- "locale": locale or self.config.locale,
273
+ "locale": locale or "en",
308
274
  },
309
275
  )
310
276
 
@@ -336,8 +302,6 @@ class PythonHandler(BaseHandler):
336
302
  self.env.lstrip_blocks = True
337
303
  self.env.keep_trailing_newline = False
338
304
  self.env.filters["split_path"] = rendering.do_split_path
339
- self.env.filters["crossref"] = rendering.do_crossref
340
- self.env.filters["multi_crossref"] = rendering.do_multi_crossref
341
305
  self.env.filters["order_members"] = rendering.do_order_members
342
306
  self.env.filters["format_code"] = rendering.do_format_code
343
307
  self.env.filters["format_signature"] = rendering.do_format_signature
@@ -434,10 +398,7 @@ def get_handler(
434
398
  # We therefore increase the limit here, once, before Griffe is used to collect or render stuff.
435
399
  sys.setrecursionlimit(max(sys.getrecursionlimit(), 2000))
436
400
 
437
- base_dir = Path(tool_config.config_file_path or "./mkdocs.yml").parent
438
- if "inventories" not in handler_config and "import" in handler_config:
439
- warn("The 'import' key is renamed 'inventories' for the Python handler", FutureWarning, stacklevel=1)
440
- handler_config["inventories"] = handler_config.pop("import", [])
401
+ base_dir = Path(getattr(tool_config, "config_file_path", None) or "./mkdocs.yml").parent
441
402
  return PythonHandler(
442
403
  config=PythonConfig.from_data(**handler_config),
443
404
  base_dir=base_dir,
@@ -7,13 +7,11 @@ import re
7
7
  import string
8
8
  import subprocess
9
9
  import sys
10
- import warnings
11
10
  from collections import defaultdict
12
11
  from contextlib import suppress
13
12
  from dataclasses import replace
14
13
  from functools import lru_cache
15
- from pathlib import Path
16
- from re import Match, Pattern
14
+ from re import Pattern
17
15
  from typing import TYPE_CHECKING, Any, Callable, ClassVar, Literal, TypeVar
18
16
 
19
17
  from griffe import (
@@ -33,7 +31,7 @@ from griffe import (
33
31
  Object,
34
32
  TypeAlias,
35
33
  )
36
- from jinja2 import TemplateNotFound, pass_context, pass_environment
34
+ from jinja2 import pass_context
37
35
  from markupsafe import Markup
38
36
  from mkdocs_autorefs import AutorefsHookInterface, Backlink, BacklinkCrumb
39
37
  from mkdocstrings import get_logger
@@ -42,7 +40,6 @@ if TYPE_CHECKING:
42
40
  from collections.abc import Iterable, Iterator, Sequence
43
41
 
44
42
  from griffe import Attribute, Class, Function, Module
45
- from jinja2 import Environment
46
43
  from jinja2.runtime import Context
47
44
  from mkdocstrings import CollectorItem
48
45
 
@@ -170,10 +167,8 @@ def do_format_signature(
170
167
  The same code, formatted.
171
168
  """
172
169
  env = context.environment
173
- # YORE: Bump 2: Replace `do_get_template(env, "type_parameters")` with `"type_parameters.html.jinja"` within line.
174
- type_params_template = env.get_template(do_get_template(env, "type_parameters"))
175
- # YORE: Bump 2: Replace `do_get_template(env, "signature")` with `"signature.html.jinja"` within line.
176
- signature_template = env.get_template(do_get_template(env, "signature"))
170
+ type_params_template = env.get_template("type_parameters.html.jinja")
171
+ signature_template = env.get_template("signature.html.jinja")
177
172
 
178
173
  if annotations is None:
179
174
  new_context = context.parent
@@ -237,8 +232,7 @@ def do_format_attribute(
237
232
  The same code, formatted.
238
233
  """
239
234
  env = context.environment
240
- # YORE: Bump 2: Replace `do_get_template(env, "expression")` with `"expression.html.jinja"` within line.
241
- template = env.get_template(do_get_template(env, "expression"))
235
+ template = env.get_template("expression.html.jinja")
242
236
  annotations = context.parent["config"].show_signature_annotations
243
237
 
244
238
  signature = str(attribute_path).strip()
@@ -295,10 +289,8 @@ def do_format_type_alias(
295
289
  The same code, formatted.
296
290
  """
297
291
  env = context.environment
298
- # YORE: Bump 2: Replace `do_get_template(env, "type_parameters")` with `"type_parameters.html.jinja"` within line.
299
- type_params_template = env.get_template(do_get_template(env, "type_parameters"))
300
- # YORE: Bump 2: Replace `do_get_template(env, "expression")` with `"expression.html.jinja"` within line.
301
- expr_template = env.get_template(do_get_template(env, "expression"))
292
+ type_params_template = env.get_template("type_parameters.html.jinja")
293
+ expr_template = env.get_template("expression.html.jinja")
302
294
 
303
295
  signature = str(type_alias_path).strip()
304
296
  signature += type_params_template.render(context.parent, obj=type_alias, signature=True)
@@ -364,76 +356,6 @@ def do_order_members(
364
356
  return members
365
357
 
366
358
 
367
- # YORE: Bump 2: Remove block.
368
- @lru_cache
369
- def _warn_crossref() -> None:
370
- warnings.warn(
371
- "The `crossref` filter is deprecated and will be removed in a future version",
372
- DeprecationWarning,
373
- stacklevel=1,
374
- )
375
-
376
-
377
- # YORE: Bump 2: Remove block.
378
- def do_crossref(path: str, *, brief: bool = True) -> Markup:
379
- """Deprecated. Filter to create cross-references.
380
-
381
- Parameters:
382
- path: The path to link to.
383
- brief: Show only the last part of the path, add full path as hover.
384
-
385
- Returns:
386
- Markup text.
387
- """
388
- _warn_crossref()
389
- full_path = path
390
- if brief:
391
- path = full_path.split(".")[-1]
392
- return Markup("<autoref identifier={full_path} optional hover>{path}</autoref>").format(
393
- full_path=full_path,
394
- path=path,
395
- )
396
-
397
-
398
- # YORE: Bump 2: Remove block.
399
- @lru_cache
400
- def _warn_multi_crossref() -> None:
401
- warnings.warn(
402
- "The `multi_crossref` filter is deprecated and will be removed in a future version",
403
- DeprecationWarning,
404
- stacklevel=1,
405
- )
406
-
407
-
408
- # YORE: Bump 2: Remove block.
409
- def do_multi_crossref(text: str, *, code: bool = True) -> Markup:
410
- """Deprecated. Filter to create cross-references.
411
-
412
- Parameters:
413
- text: The text to scan.
414
- code: Whether to wrap the result in a code tag.
415
-
416
- Returns:
417
- Markup text.
418
- """
419
- _warn_multi_crossref()
420
- group_number = 0
421
- variables = {}
422
-
423
- def repl(match: Match) -> str:
424
- nonlocal group_number
425
- group_number += 1
426
- path = match.group()
427
- path_var = f"path{group_number}"
428
- variables[path_var] = path
429
- return f"<autoref identifier={{{path_var}}} optional hover>{{{path_var}}}</autoref>"
430
-
431
- text = re.sub(r"([\w.]+)", repl, text)
432
- if code:
433
- text = f"<code>{text}</code>"
434
- return Markup(text).format(**variables) # noqa: S704
435
-
436
-
437
359
  _split_path_re = re.compile(r"([.(]?)([\w]+)(\))?")
438
360
  _splitable_re = re.compile(r"[().]")
439
361
 
@@ -648,39 +570,20 @@ def _get_black_formatter() -> Callable[[str, int], str] | None:
648
570
  return formatter
649
571
 
650
572
 
651
- # YORE: Bump 2: Remove line.
652
- @pass_environment
653
- # YORE: Bump 2: Replace `env: Environment, ` with `` within line.
654
- # YORE: Bump 2: Replace `str | ` with `` within line.
655
- def do_get_template(env: Environment, obj: str | Object) -> str:
573
+ def do_get_template(obj: Object | Alias) -> str:
656
574
  """Get the template name used to render an object.
657
575
 
658
576
  Parameters:
659
- env: The Jinja environment, passed automatically.
660
- obj: A Griffe object, or a template name.
577
+ obj: A Griffe object.
661
578
 
662
579
  Returns:
663
580
  A template name.
664
581
  """
665
- name = obj
666
- if isinstance(obj, (Alias, Object)):
667
- extra_data = getattr(obj, "extra", {}).get("mkdocstrings", {})
668
- if name := extra_data.get("template", ""):
669
- return name
670
- name = obj.kind.value.replace(" ", "_")
671
- # YORE: Bump 2: Replace block with `return f"{name}.html.jinja"`.
672
- try:
673
- template = env.get_template(f"{name}.html")
674
- except TemplateNotFound:
675
- return f"{name}.html.jinja"
676
- our_template = Path(template.filename).is_relative_to(Path(__file__).parent.parent) # type: ignore[arg-type]
677
- if our_template:
678
- return f"{name}.html.jinja"
679
- _logger.warning(
680
- f"DeprecationWarning: Overriding '{name}.html' is deprecated, override '{name}.html.jinja' instead. ",
681
- once=True,
682
- )
683
- return f"{name}.html"
582
+ extra_data = getattr(obj, "extra", {}).get("mkdocstrings", {})
583
+ if name := extra_data.get("template", ""):
584
+ return name
585
+ name = obj.kind.value.replace(" ", "_")
586
+ return f"{name}.html.jinja"
684
587
 
685
588
 
686
589
  @pass_context
@@ -67,8 +67,7 @@ Context:
67
67
  This block renders the labels for the attribute.
68
68
  -#}
69
69
  {% with labels = attribute.labels %}
70
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
71
- {% include "labels"|get_template with context %}
70
+ {% include "labels.html.jinja" with context %}
72
71
  {% endwith %}
73
72
  {% endblock labels %}
74
73
 
@@ -115,8 +114,7 @@ Context:
115
114
  This block renders the docstring for the attribute.
116
115
  -#}
117
116
  {% with docstring_sections = attribute.docstring.parsed %}
118
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
119
- {% include "docstring"|get_template with context %}
117
+ {% include "docstring.html.jinja" with context %}
120
118
  {% endwith %}
121
119
  {% endblock docstring %}
122
120
 
@@ -57,11 +57,9 @@ Context:
57
57
  {%+ filter highlight(language="python", inline=True) %}
58
58
  {{ class_name -}}
59
59
  {%- with obj = function -%}
60
- {#- YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. -#}
61
- {%- include "type_parameters"|get_template with context -%}
60
+ {%- include "type_parameters.html.jinja" with context -%}
62
61
  {%- endwith -%}
63
- {#- YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. -#}
64
- {%- include "signature"|get_template with context -%}
62
+ {%- include "signature.html.jinja" with context -%}
65
63
  {% endfilter %}
66
64
  {% endwith %}
67
65
  {% else %}
@@ -76,8 +74,7 @@ Context:
76
74
  This block renders the labels for the class.
77
75
  -#}
78
76
  {% with labels = class.labels %}
79
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
80
- {% include "labels"|get_template with context %}
77
+ {% include "labels.html.jinja" with context %}
81
78
  {% endwith %}
82
79
  {% endblock labels %}
83
80
 
@@ -148,8 +145,7 @@ Context:
148
145
  Bases: {% for expression in class.bases -%}
149
146
  <code>
150
147
  {%- with backlink_type = "subclassed-by" -%}
151
- {#- YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. -#}
152
- {%- include "expression"|get_template with context -%}
148
+ {%- include "expression.html.jinja" with context -%}
153
149
  {%- endwith -%}
154
150
  </code>{% if not loop.last %}, {% endif %}
155
151
  {% endfor -%}
@@ -211,8 +207,7 @@ Context:
211
207
  This block renders the docstring for the class.
212
208
  -#}
213
209
  {% with docstring_sections = class.docstring.parsed %}
214
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
215
- {% include "docstring"|get_template with context %}
210
+ {% include "docstring.html.jinja" with context %}
216
211
  {% endwith %}
217
212
  {% if config.merge_init_into_class %}
218
213
  {# We don't want to merge the inherited `__init__` method docstring into the class docstring #}
@@ -221,8 +216,7 @@ Context:
221
216
  {% if "__init__" in check_members and check_members["__init__"].has_docstring %}
222
217
  {% with function = check_members["__init__"] %}
223
218
  {% with obj = function, docstring_sections = function.docstring.parsed %}
224
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
225
- {% include "docstring"|get_template with context %}
219
+ {% include "docstring.html.jinja" with context %}
226
220
  {% endwith %}
227
221
  {% endwith %}
228
222
  {% endif %}
@@ -239,8 +233,7 @@ Context:
239
233
 
240
234
  This block renders auto-summaries for classes, methods, and attributes.
241
235
  -#}
242
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
243
- {% include "summary"|get_template with context %}
236
+ {% include "summary.html.jinja" with context %}
244
237
  {% endblock summary %}
245
238
 
246
239
  {% block source scoped %}
@@ -286,8 +279,7 @@ Context:
286
279
  -#}
287
280
  {% set root = False %}
288
281
  {% set heading_level = heading_level + 1 %}
289
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
290
- {% include "children"|get_template with context %}
282
+ {% include "children.html.jinja" with context %}
291
283
  {% endblock children %}
292
284
  {% endblock contents %}
293
285
  </div>
@@ -15,8 +15,7 @@ Context:
15
15
  {{ log.debug("Rendering attributes section") }}
16
16
  {% endblock logs %}
17
17
 
18
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
19
- {% import "language"|get_template as lang with context %}
18
+ {% import "language.html.jinja" as lang with context %}
20
19
  {#- Language module providing the `t` translation method. -#}
21
20
 
22
21
  {% if config.docstring_section_style == "table" %}
@@ -38,8 +37,7 @@ Context:
38
37
  <td>
39
38
  {% if attribute.annotation %}
40
39
  {% with expression = attribute.annotation %}
41
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
42
- <code>{% include "expression"|get_template with context %}</code>
40
+ <code>{% include "expression.html.jinja" with context %}</code>
43
41
  {% endwith %}
44
42
  {% endif %}
45
43
  </td>
@@ -63,8 +61,7 @@ Context:
63
61
  <b><code><autoref identifier="{{ obj.path }}.{{ attribute.name }}" optional hover>{{ attribute.name }}</autoref></code></b>
64
62
  {% if attribute.annotation %}
65
63
  {% with expression = attribute.annotation %}
66
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
67
- (<code>{% include "expression"|get_template with context %}</code>)
64
+ (<code>{% include "expression.html.jinja" with context %}</code>)
68
65
  {% endwith %}
69
66
  {% endif %}
70
67
 
@@ -98,8 +95,7 @@ Context:
98
95
  <span class="doc-attribute-annotation">
99
96
  <b>TYPE:</b>
100
97
  {% with expression = attribute.annotation %}
101
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
102
- <code>{% include "expression"|get_template with context %}</code>
98
+ <code>{% include "expression.html.jinja" with context %}</code>
103
99
  {% endwith %}
104
100
  </span>
105
101
  {% endif %}
@@ -15,8 +15,7 @@ Context:
15
15
  {{ log.debug("Rendering classes section") }}
16
16
  {% endblock logs %}
17
17
 
18
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
19
- {% import "language"|get_template as lang with context %}
18
+ {% import "language.html.jinja" as lang with context %}
20
19
  {#- Language module providing the `t` translation method. -#}
21
20
 
22
21
  {% if config.docstring_section_style == "table" %}
@@ -15,8 +15,7 @@ Context:
15
15
  {{ log.debug("Rendering examples section") }}
16
16
  {% endblock logs %}
17
17
 
18
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
19
- {% import "language"|get_template as lang with context %}
18
+ {% import "language.html.jinja" as lang with context %}
20
19
  {#- Language module providing the `t` translation method. -#}
21
20
 
22
21
  <p><span class="doc-section-title">{{ section.title or lang.t("Examples:") }}</span></p>
@@ -15,8 +15,7 @@ Context:
15
15
  {{ log.debug("Rendering functions section") }}
16
16
  {% endblock logs %}
17
17
 
18
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
19
- {% import "language"|get_template as lang with context %}
18
+ {% import "language.html.jinja" as lang with context %}
20
19
  {#- Language module providing the `t` translation method. -#}
21
20
 
22
21
  {% if config.docstring_section_style == "table" %}
@@ -15,8 +15,7 @@ Context:
15
15
  {{ log.debug("Rendering modules section") }}
16
16
  {% endblock logs %}
17
17
 
18
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
19
- {% import "language"|get_template as lang with context %}
18
+ {% import "language.html.jinja" as lang with context %}
20
19
  {#- Language module providing the `t` translation method. -#}
21
20
 
22
21
  {% if config.docstring_section_style == "table" %}
@@ -15,8 +15,7 @@ Context:
15
15
  {{ log.debug("Rendering other parameters section") }}
16
16
  {% endblock logs %}
17
17
 
18
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
19
- {% import "language"|get_template as lang with context %}
18
+ {% import "language.html.jinja" as lang with context %}
20
19
  {#- Language module providing the `t` translation method. -#}
21
20
 
22
21
  {% if config.docstring_section_style == "table" %}
@@ -38,8 +37,7 @@ Context:
38
37
  <td>
39
38
  {% if parameter.annotation %}
40
39
  {% with expression = parameter.annotation, backlink_type = "used-by" %}
41
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
42
- <code>{% include "expression"|get_template with context %}</code>
40
+ <code>{% include "expression.html.jinja" with context %}</code>
43
41
  {% endwith %}
44
42
  {% endif %}
45
43
  </td>
@@ -63,8 +61,7 @@ Context:
63
61
  <b><code>{{ parameter.name }}</code></b>
64
62
  {% if parameter.annotation %}
65
63
  {% with expression = parameter.annotation, backlink_type = "used-by" %}
66
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
67
- (<code>{% include "expression"|get_template with context %}</code>)
64
+ (<code>{% include "expression.html.jinja" with context %}</code>)
68
65
  {% endwith %}
69
66
  {% endif %}
70
67
 
@@ -98,8 +95,7 @@ Context:
98
95
  <span class="doc-param-annotation">
99
96
  <b>{{ lang.t("TYPE:") }}</b>
100
97
  {% with expression = parameter.annotation, backlink_type = "used-by" %}
101
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
102
- <code>{% include "expression"|get_template with context %}</code>
98
+ <code>{% include "expression.html.jinja" with context %}</code>
103
99
  {% endwith %}
104
100
  </span>
105
101
  {% endif %}
@@ -15,8 +15,7 @@ Context:
15
15
  {{ log.debug("Rendering parameters section") }}
16
16
  {% endblock logs %}
17
17
 
18
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
19
- {% import "language"|get_template as lang with context %}
18
+ {% import "language.html.jinja" as lang with context %}
20
19
  {#- Language module providing the `t` translation method. -#}
21
20
 
22
21
  {% if config.docstring_section_style == "table" %}
@@ -54,8 +53,7 @@ Context:
54
53
  <td>
55
54
  {% if parameter.annotation %}
56
55
  {% with expression = parameter.annotation, backlink_type = "used-by" %}
57
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
58
- <code>{% include "expression"|get_template with context %}</code>
56
+ <code>{% include "expression.html.jinja" with context %}</code>
59
57
  {% endwith %}
60
58
  {% endif %}
61
59
  </td>
@@ -67,8 +65,7 @@ Context:
67
65
  <td>
68
66
  {% if parameter.default %}
69
67
  {% with expression = parameter.default, backlink_type = "used-by" %}
70
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
71
- <code>{% include "expression"|get_template with context %}</code>
68
+ <code>{% include "expression.html.jinja" with context %}</code>
72
69
  {% endwith %}
73
70
  {% else %}
74
71
  <em>{{ lang.t("required") }}</em>
@@ -102,12 +99,10 @@ Context:
102
99
  {% endif %}
103
100
  {% if parameter.annotation %}
104
101
  {% with expression = parameter.annotation, backlink_type = "used-by" %}
105
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
106
- (<code>{% include "expression"|get_template with context %}</code>
102
+ (<code>{% include "expression.html.jinja" with context %}</code>
107
103
  {%- if parameter.default %}, {{ lang.t("default:") }}
108
104
  {% with expression = parameter.default, backlink_type = "used-by" %}
109
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
110
- <code>{% include "expression"|get_template with context %}</code>
105
+ <code>{% include "expression.html.jinja" with context %}</code>
111
106
  {% endwith %}
112
107
  {% endif %})
113
108
  {% endwith %}
@@ -158,8 +153,7 @@ Context:
158
153
  <span class="doc-param-annotation">
159
154
  <b>{{ lang.t("TYPE:") }}</b>
160
155
  {% with expression = parameter.annotation, backlink_type = "used-by" %}
161
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
162
- <code>{% include "expression"|get_template with context %}</code>
156
+ <code>{% include "expression.html.jinja" with context %}</code>
163
157
  {% endwith %}
164
158
  </span>
165
159
  {% endif %}
@@ -167,8 +161,7 @@ Context:
167
161
  <span class="doc-param-default">
168
162
  <b>{{ lang.t("DEFAULT:") }}</b>
169
163
  {% with expression = parameter.default, backlink_type = "used-by" %}
170
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
171
- <code>{% include "expression"|get_template with context %}</code>
164
+ <code>{% include "expression.html.jinja" with context %}</code>
172
165
  {% endwith %}
173
166
  </span>
174
167
  {% endif %}
@@ -15,8 +15,7 @@ Context:
15
15
  {{ log.debug("Rendering raises section") }}
16
16
  {% endblock logs %}
17
17
 
18
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
19
- {% import "language"|get_template as lang with context %}
18
+ {% import "language.html.jinja" as lang with context %}
20
19
  {#- Language module providing the `t` translation method. -#}
21
20
 
22
21
  {% if config.docstring_section_style == "table" %}
@@ -36,8 +35,7 @@ Context:
36
35
  <td>
37
36
  {% if raises.annotation %}
38
37
  {% with expression = raises.annotation, backlink_type = "raised-by" %}
39
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
40
- <code>{% include "expression"|get_template with context %}</code>
38
+ <code>{% include "expression.html.jinja" with context %}</code>
41
39
  {% endwith %}
42
40
  {% endif %}
43
41
  </td>
@@ -60,8 +58,7 @@ Context:
60
58
  <li class="doc-section-item field-body">
61
59
  {% if raises.annotation %}
62
60
  {% with expression = raises.annotation, backlink_type = "raised-by" %}
63
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
64
- <code>{% include "expression"|get_template with context %}</code>
61
+ <code>{% include "expression.html.jinja" with context %}</code>
65
62
  {% endwith %}
66
63
 
67
64
  {% endif %}
@@ -88,8 +85,7 @@ Context:
88
85
  <td>
89
86
  <span class="doc-raises-annotation">
90
87
  {% with expression = raises.annotation, backlink_type = "raised-by" %}
91
- {# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
92
- <code>{% include "expression"|get_template with context %}</code>
88
+ <code>{% include "expression.html.jinja" with context %}</code>
93
89
  {% endwith %}
94
90
  </span>
95
91
  </td>