mkdocstrings-python 1.17.0__py3-none-any.whl → 1.18.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. mkdocstrings_handlers/python/__init__.py +4 -0
  2. mkdocstrings_handlers/python/_internal/config.py +50 -3
  3. mkdocstrings_handlers/python/_internal/handler.py +6 -0
  4. mkdocstrings_handlers/python/_internal/rendering.py +99 -3
  5. mkdocstrings_handlers/python/templates/material/_base/children.html.jinja +25 -0
  6. mkdocstrings_handlers/python/templates/material/_base/class.html.jinja +32 -22
  7. mkdocstrings_handlers/python/templates/material/_base/docstring/type_aliases.html +10 -0
  8. mkdocstrings_handlers/python/templates/material/_base/docstring/type_aliases.html.jinja +86 -0
  9. mkdocstrings_handlers/python/templates/material/_base/docstring/type_parameters.html +10 -0
  10. mkdocstrings_handlers/python/templates/material/_base/docstring/type_parameters.html.jinja +208 -0
  11. mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja +6 -0
  12. mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja +51 -1
  13. mkdocstrings_handlers/python/templates/material/_base/function.html.jinja +4 -2
  14. mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja +11 -0
  15. mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja +12 -1
  16. mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja +12 -1
  17. mkdocstrings_handlers/python/templates/material/_base/summary/type_aliases.html +10 -0
  18. mkdocstrings_handlers/python/templates/material/_base/summary/type_aliases.html.jinja +24 -0
  19. mkdocstrings_handlers/python/templates/material/_base/summary.html.jinja +5 -0
  20. mkdocstrings_handlers/python/templates/material/_base/type_alias.html +10 -0
  21. mkdocstrings_handlers/python/templates/material/_base/type_alias.html.jinja +120 -0
  22. mkdocstrings_handlers/python/templates/material/_base/type_parameters.html +10 -0
  23. mkdocstrings_handlers/python/templates/material/_base/type_parameters.html.jinja +89 -0
  24. mkdocstrings_handlers/python/templates/material/docstring/type_aliases.html +1 -0
  25. mkdocstrings_handlers/python/templates/material/docstring/type_aliases.html.jinja +1 -0
  26. mkdocstrings_handlers/python/templates/material/docstring/type_parameters.html +1 -0
  27. mkdocstrings_handlers/python/templates/material/docstring/type_parameters.html.jinja +1 -0
  28. mkdocstrings_handlers/python/templates/material/style.css +35 -3
  29. mkdocstrings_handlers/python/templates/material/summary/type_aliases.html +1 -0
  30. mkdocstrings_handlers/python/templates/material/summary/type_aliases.html.jinja +1 -0
  31. mkdocstrings_handlers/python/templates/material/type_alias.html +1 -0
  32. mkdocstrings_handlers/python/templates/material/type_alias.html.jinja +1 -0
  33. mkdocstrings_handlers/python/templates/material/type_parameters.html +1 -0
  34. mkdocstrings_handlers/python/templates/material/type_parameters.html.jinja +1 -0
  35. {mkdocstrings_python-1.17.0.dist-info → mkdocstrings_python-1.18.1.dist-info}/METADATA +2 -2
  36. {mkdocstrings_python-1.17.0.dist-info → mkdocstrings_python-1.18.1.dist-info}/RECORD +39 -19
  37. {mkdocstrings_python-1.17.0.dist-info → mkdocstrings_python-1.18.1.dist-info}/WHEEL +0 -0
  38. {mkdocstrings_python-1.17.0.dist-info → mkdocstrings_python-1.18.1.dist-info}/entry_points.txt +0 -0
  39. {mkdocstrings_python-1.17.0.dist-info → mkdocstrings_python-1.18.1.dist-info}/licenses/LICENSE +0 -0
@@ -22,12 +22,14 @@ from mkdocstrings_handlers.python._internal.rendering import (
22
22
  do_as_classes_section,
23
23
  do_as_functions_section,
24
24
  do_as_modules_section,
25
+ do_as_type_aliases_section,
25
26
  do_backlink_tree,
26
27
  do_crossref,
27
28
  do_filter_objects,
28
29
  do_format_attribute,
29
30
  do_format_code,
30
31
  do_format_signature,
32
+ do_format_type_alias,
31
33
  do_get_template,
32
34
  do_multi_crossref,
33
35
  do_order_members,
@@ -55,12 +57,14 @@ __all__ = [
55
57
  "do_as_classes_section",
56
58
  "do_as_functions_section",
57
59
  "do_as_modules_section",
60
+ "do_as_type_aliases_section",
58
61
  "do_backlink_tree",
59
62
  "do_crossref",
60
63
  "do_filter_objects",
61
64
  "do_format_attribute",
62
65
  "do_format_code",
63
66
  "do_format_signature",
67
+ "do_format_type_alias",
64
68
  "do_get_template",
65
69
  "do_multi_crossref",
66
70
  "do_order_members",
@@ -423,6 +423,15 @@ class SummaryOption:
423
423
  ),
424
424
  ] = False
425
425
 
426
+ type_aliases: Annotated[
427
+ bool,
428
+ _Field(
429
+ group="members",
430
+ parent="summary",
431
+ description="Whether to render summaries of type aliases.",
432
+ ),
433
+ ] = False
434
+
426
435
 
427
436
  # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
428
437
  @dataclass(**_dataclass_options) # type: ignore[call-overload]
@@ -797,6 +806,22 @@ class PythonInputOptions:
797
806
  ),
798
807
  ] = True
799
808
 
809
+ show_docstring_type_aliases: Annotated[
810
+ bool,
811
+ _Field(
812
+ group="docstrings",
813
+ description="Whether to display the 'Type Aliases' section in the object's docstring.",
814
+ ),
815
+ ] = True
816
+
817
+ show_docstring_type_parameters: Annotated[
818
+ bool,
819
+ _Field(
820
+ group="docstrings",
821
+ description="Whether to display the 'Type Parameters' section in the object's docstring.",
822
+ ),
823
+ ] = True
824
+
800
825
  show_docstring_warns: Annotated[
801
826
  bool,
802
827
  _Field(
@@ -888,6 +913,14 @@ class PythonInputOptions:
888
913
  ),
889
914
  ] = False
890
915
 
916
+ show_signature_type_parameters: Annotated[
917
+ bool,
918
+ _Field(
919
+ group="signatures",
920
+ description="Show the type parameters in generic classes, methods, functions and type aliases signatures.",
921
+ ),
922
+ ] = False
923
+
891
924
  show_signature: Annotated[
892
925
  bool,
893
926
  _Field(
@@ -960,6 +993,14 @@ class PythonInputOptions:
960
993
  ),
961
994
  ] = ""
962
995
 
996
+ type_parameter_headings: Annotated[
997
+ bool,
998
+ _Field(
999
+ group="headings",
1000
+ description="Whether to render headings for type parameters (therefore showing type parameters in the ToC).",
1001
+ ),
1002
+ ] = False
1003
+
963
1004
  unwrap_annotated: Annotated[
964
1005
  bool,
965
1006
  _Field(
@@ -1001,9 +1042,15 @@ class PythonInputOptions:
1001
1042
  if "summary" in data:
1002
1043
  summary = data["summary"]
1003
1044
  if summary is True:
1004
- summary = SummaryOption(attributes=True, functions=True, classes=True, modules=True)
1045
+ summary = SummaryOption(attributes=True, functions=True, classes=True, modules=True, type_aliases=True)
1005
1046
  elif summary is False:
1006
- summary = SummaryOption(attributes=False, functions=False, classes=False, modules=False)
1047
+ summary = SummaryOption(
1048
+ attributes=False,
1049
+ functions=False,
1050
+ classes=False,
1051
+ modules=False,
1052
+ type_aliases=False,
1053
+ )
1007
1054
  else:
1008
1055
  summary = SummaryOption(**summary)
1009
1056
  data["summary"] = summary
@@ -1028,7 +1075,7 @@ class PythonOptions(PythonInputOptions): # type: ignore[override,unused-ignore]
1028
1075
  """A list of filters, or `"public"`."""
1029
1076
 
1030
1077
  summary: SummaryOption = field(default_factory=SummaryOption)
1031
- """Whether to render summaries of modules, classes, functions (methods) and attributes."""
1078
+ """Whether to render summaries of modules, classes, functions (methods), attributes and type aliases."""
1032
1079
 
1033
1080
  @classmethod
1034
1081
  def coerce(cls, **data: Any) -> MutableMapping[str, Any]:
@@ -322,12 +322,14 @@ class PythonHandler(BaseHandler):
322
322
  self.env.filters["format_code"] = rendering.do_format_code
323
323
  self.env.filters["format_signature"] = rendering.do_format_signature
324
324
  self.env.filters["format_attribute"] = rendering.do_format_attribute
325
+ self.env.filters["format_type_alias"] = rendering.do_format_type_alias
325
326
  self.env.filters["filter_objects"] = rendering.do_filter_objects
326
327
  self.env.filters["stash_crossref"] = rendering.do_stash_crossref
327
328
  self.env.filters["get_template"] = rendering.do_get_template
328
329
  self.env.filters["as_attributes_section"] = rendering.do_as_attributes_section
329
330
  self.env.filters["as_functions_section"] = rendering.do_as_functions_section
330
331
  self.env.filters["as_classes_section"] = rendering.do_as_classes_section
332
+ self.env.filters["as_type_aliases_section"] = rendering.do_as_type_aliases_section
331
333
  self.env.filters["as_modules_section"] = rendering.do_as_modules_section
332
334
  self.env.filters["backlink_tree"] = rendering.do_backlink_tree
333
335
  self.env.globals["AutorefsHook"] = rendering.AutorefsHook
@@ -408,6 +410,10 @@ def get_handler(
408
410
  Returns:
409
411
  An instance of `PythonHandler`.
410
412
  """
413
+ # In rare cases, Griffe hits the recursion limit because of deeply-nested ASTs.
414
+ # We therefore increase the limit here, once, before Griffe is used to collect or render stuff.
415
+ sys.setrecursionlimit(max(sys.getrecursionlimit(), 2000))
416
+
411
417
  base_dir = Path(tool_config.config_file_path or "./mkdocs.yml").parent
412
418
  if "inventories" not in handler_config and "import" in handler_config:
413
419
  warn("The 'import' key is renamed 'inventories' for the Python handler", FutureWarning, stacklevel=1)
@@ -28,7 +28,10 @@ from griffe import (
28
28
  DocstringSectionClasses,
29
29
  DocstringSectionFunctions,
30
30
  DocstringSectionModules,
31
+ DocstringSectionTypeAliases,
32
+ DocstringTypeAlias,
31
33
  Object,
34
+ TypeAlias,
32
35
  )
33
36
  from jinja2 import TemplateNotFound, pass_context, pass_environment
34
37
  from markupsafe import Markup
@@ -160,8 +163,10 @@ def do_format_signature(
160
163
  The same code, formatted.
161
164
  """
162
165
  env = context.environment
166
+ # YORE: Bump 2: Replace `do_get_template(env, "type_parameters")` with `"type_parameters.html.jinja"` within line.
167
+ type_params_template = env.get_template(do_get_template(env, "type_parameters"))
163
168
  # YORE: Bump 2: Replace `do_get_template(env, "signature")` with `"signature.html.jinja"` within line.
164
- template = env.get_template(do_get_template(env, "signature"))
169
+ signature_template = env.get_template(do_get_template(env, "signature"))
165
170
 
166
171
  if annotations is None:
167
172
  new_context = context.parent
@@ -169,7 +174,9 @@ def do_format_signature(
169
174
  new_context = dict(context.parent)
170
175
  new_context["config"] = replace(new_context["config"], show_signature_annotations=annotations)
171
176
 
172
- signature = template.render(new_context, function=function, signature=True)
177
+ signature = type_params_template.render(context.parent, obj=function, signature=True)
178
+ signature += signature_template.render(new_context, function=function, signature=True)
179
+
173
180
  signature = _format_signature(callable_path, signature, line_length)
174
181
  signature = str(
175
182
  env.filters["highlight"](
@@ -259,6 +266,67 @@ def do_format_attribute(
259
266
  return signature
260
267
 
261
268
 
269
+ @pass_context
270
+ def do_format_type_alias(
271
+ context: Context,
272
+ type_alias_path: Markup,
273
+ type_alias: TypeAlias,
274
+ line_length: int,
275
+ *,
276
+ crossrefs: bool = False, # noqa: ARG001
277
+ ) -> str:
278
+ """Format a type alias.
279
+
280
+ Parameters:
281
+ context: Jinja context, passed automatically.
282
+ type_alias_path: The path of the type alias we render the signature of.
283
+ type_alias: The type alias we render the signature of.
284
+ line_length: The line length.
285
+ crossrefs: Whether to cross-reference types in the signature.
286
+
287
+ Returns:
288
+ The same code, formatted.
289
+ """
290
+ env = context.environment
291
+ # YORE: Bump 2: Replace `do_get_template(env, "type_parameters")` with `"type_parameters.html.jinja"` within line.
292
+ type_params_template = env.get_template(do_get_template(env, "type_parameters"))
293
+ # YORE: Bump 2: Replace `do_get_template(env, "expression")` with `"expression.html.jinja"` within line.
294
+ expr_template = env.get_template(do_get_template(env, "expression"))
295
+
296
+ signature = str(type_alias_path).strip()
297
+ signature += type_params_template.render(context.parent, obj=type_alias, signature=True)
298
+ value = expr_template.render(context.parent, expression=type_alias.value, signature=True)
299
+ signature += f" = {value}"
300
+
301
+ signature = do_format_code(signature, line_length)
302
+ signature = str(
303
+ env.filters["highlight"](
304
+ Markup.escape(signature),
305
+ language="python",
306
+ inline=False,
307
+ classes=["doc-signature"],
308
+ linenums=False,
309
+ ),
310
+ )
311
+
312
+ # Since we highlight the signature without `type`,
313
+ # Pygments sees only an assignment, not a type alias definition
314
+ # (at the moment it does not understand type alias definitions anyway).
315
+ # The result is that the type alias name is not parsed as such,
316
+ # but instead as a regular name: `n` CSS class instead of `nc`.
317
+ # To fix it, we replace the first occurrence of an `n` CSS class
318
+ # with an `nc` one, unless we found `nc` already.
319
+ if not re.search(r'<span class="nc">', signature):
320
+ signature = re.sub(r'<span class="[a-z]{1,2}">', '<span class="nc">', signature, count=1)
321
+
322
+ if stash := env.filters["stash_crossref"].stash:
323
+ for key, value in stash.items():
324
+ signature = re.sub(rf"\b{key}\b", value, signature)
325
+ stash.clear()
326
+
327
+ return signature
328
+
329
+
262
330
  def do_order_members(
263
331
  members: Sequence[Object | Alias],
264
332
  order: Order | list[Order],
@@ -592,7 +660,7 @@ def do_get_template(env: Environment, obj: str | Object) -> str:
592
660
  extra_data = getattr(obj, "extra", {}).get("mkdocstrings", {})
593
661
  if name := extra_data.get("template", ""):
594
662
  return name
595
- name = obj.kind.value
663
+ name = obj.kind.value.replace(" ", "_")
596
664
  # YORE: Bump 2: Replace block with `return f"{name}.html.jinja"`.
597
665
  try:
598
666
  template = env.get_template(f"{name}.html")
@@ -732,6 +800,34 @@ def do_as_modules_section(
732
800
  )
733
801
 
734
802
 
803
+ @pass_context
804
+ def do_as_type_aliases_section(
805
+ context: Context, # noqa: ARG001
806
+ type_aliases: Sequence[TypeAlias],
807
+ *,
808
+ check_public: bool = True,
809
+ ) -> DocstringSectionTypeAliases:
810
+ """Build a type aliases section from a list of type aliases.
811
+
812
+ Parameters:
813
+ type_aliases: The type aliases to build the section from.
814
+ check_public: Whether to check if the type_alias is public.
815
+
816
+ Returns:
817
+ A type aliases docstring section.
818
+ """
819
+ return DocstringSectionTypeAliases(
820
+ [
821
+ DocstringTypeAlias(
822
+ name=type_alias.name,
823
+ description=type_alias.docstring.value.split("\n", 1)[0] if type_alias.docstring else "",
824
+ )
825
+ for type_alias in type_aliases
826
+ if not check_public or type_alias.is_public
827
+ ],
828
+ )
829
+
830
+
735
831
  class AutorefsHook(AutorefsHookInterface):
736
832
  """Autorefs hook.
737
833
 
@@ -57,6 +57,26 @@ Context:
57
57
  {% endif %}
58
58
  {% endwith %}
59
59
 
60
+ {% with type_aliases = obj.type_aliases|filter_objects(
61
+ filters=config.filters,
62
+ members_list=members_list,
63
+ inherited_members=config.inherited_members,
64
+ keep_no_docstrings=config.show_if_no_docstring,
65
+ ) %}
66
+ {% if type_aliases %}
67
+ {% if config.show_category_heading %}
68
+ {% filter heading(heading_level, id=html_id ~ "-type_aliases") %}Type Aliases{% endfilter %}
69
+ {% endif %}
70
+ {% with heading_level = heading_level + extra_level %}
71
+ {% for type_alias in type_aliases|order_members(config.members_order, members_list) %}
72
+ {% if config.filters == "public" or members_list is not none or (not type_alias.is_imported or type_alias.is_public) %}
73
+ {% include type_alias|get_template with context %}
74
+ {% endif %}
75
+ {% endfor %}
76
+ {% endwith %}
77
+ {% endif %}
78
+ {% endwith %}
79
+
60
80
  {% with classes = obj.classes|filter_objects(
61
81
  filters=config.filters,
62
82
  members_list=members_list,
@@ -143,6 +163,11 @@ Context:
143
163
  {% include attribute|get_template with context %}
144
164
  {% endwith %}
145
165
 
166
+ {% elif child.is_type_alias %}
167
+ {% with type_alias = child %}
168
+ {% include type_alias|get_template with context %}
169
+ {% endwith %}
170
+
146
171
  {% elif child.is_class %}
147
172
  {% with class = child %}
148
173
  {% include class|get_template with context %}
@@ -54,12 +54,18 @@ Context:
54
54
  <span class="doc doc-object-name doc-class-name">{{ class_name }}</span>
55
55
  {% elif config.merge_init_into_class and "__init__" in all_members %}
56
56
  {% with function = all_members["__init__"] %}
57
- {%+ filter highlight(language="python", inline=True) -%}
57
+ {%+ filter highlight(language="python", inline=True) %}
58
+ {{ class_name -}}
59
+ {%- with obj = function -%}
60
+ {#- YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. -#}
61
+ {%- include "type_parameters"|get_template with context -%}
62
+ {%- endwith -%}
58
63
  {#- YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. -#}
59
- {{ class_name }}{% include "signature"|get_template with context %}
60
- {%- endfilter %}
64
+ {%- include "signature"|get_template with context -%}
65
+ {% endfilter %}
61
66
  {% endwith %}
62
67
  {% else %}
68
+ {# TODO: Maybe render type parameters here. #}
63
69
  <code>{{ class_name }}</code>
64
70
  {% endif %}
65
71
  {% endblock heading %}
@@ -83,26 +89,30 @@ Context:
83
89
  This block renders the signature for the class.
84
90
  Overloads of the `__init__` method are rendered if `merge_init_into_class` is enabled.
85
91
  The actual `__init__` method signature is only rendered if `separate_signature` is also enabled.
92
+
93
+ If the class is generic, but the `__init__` method isn't or `merge_init_into_class` is disabled,
94
+ the class signature is rendered if `separate_signature` and `show_signature_type_parameters` are enabled.
95
+
96
+ If the `__init__` method or any overloads are generic, they are rendered as methods if
97
+ `merge_init_into_class`, `separate_signature` and `show_signature_type_parameters` are enabled.
86
98
  -#}
87
- {% if config.merge_init_into_class %}
88
- {% if "__init__" in all_members %}
89
- {% with function = all_members["__init__"] %}
90
- {% if function.overloads and config.show_overloads %}
91
- <div class="doc-overloads">
92
- {% for overload in function.overloads %}
93
- {% filter format_signature(overload, config.line_length, annotations=True, crossrefs=config.signature_crossrefs) %}
94
- {{ class.name }}
95
- {% endfilter %}
96
- {% endfor %}
97
- </div>
98
- {% endif %}
99
- {% if config.separate_signature %}
100
- {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
101
- {{ class.name }}
102
- {% endfilter %}
103
- {% endif %}
104
- {% endwith %}
105
- {% endif %}
99
+ {% if config.merge_init_into_class and "__init__" in all_members %}
100
+ {% with function = all_members["__init__"] %}
101
+ {% if function.overloads and config.show_overloads %}
102
+ <div class="doc-overloads">
103
+ {% for overload in function.overloads %}
104
+ {% filter format_signature(overload, config.line_length, annotations=True, crossrefs=config.signature_crossrefs) %}
105
+ {{ class.name }}
106
+ {% endfilter %}
107
+ {% endfor %}
108
+ </div>
109
+ {% endif %}
110
+ {% if config.separate_signature and not (config.show_overloads and function.overloads and config.overloads_only) %}
111
+ {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
112
+ {{ class.name }}
113
+ {% endfilter %}
114
+ {% endif %}
115
+ {% endwith %}
106
116
  {% endif %}
107
117
  {% endblock signature %}
108
118
 
@@ -0,0 +1,10 @@
1
+ {# YORE: Bump 2: Remove file. #}
2
+ {% extends "_base/docstring/type_aliases.html.jinja" %}
3
+
4
+ {% block logs scoped %}
5
+ {{ super() }}
6
+ {{ log.warning(
7
+ "DeprecationWarning: Extending '_base/docstring/type_aliases.html' is deprecated, extend '_base/docstring/type_aliases.html.jinja' instead. ",
8
+ once=True,
9
+ ) }}
10
+ {% endblock logs %}
@@ -0,0 +1,86 @@
1
+ {#- Template for "Type Aliases" sections in docstrings.
2
+
3
+ This template renders a list of documented type aliases in the format
4
+ specified with the [`docstring_section_style`][] configuration option.
5
+
6
+ Context:
7
+ section (griffe.DocstringSectionTypeAliases): The section to render.
8
+ -#}
9
+
10
+ {% block logs scoped %}
11
+ {#- Logging block.
12
+
13
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
14
+ -#}
15
+ {{ log.debug("Rendering type aliases section") }}
16
+ {% endblock logs %}
17
+
18
+ {% import "language"|get_template as lang with context %}
19
+ {#- Language module providing the `t` translation method. -#}
20
+
21
+ {% if config.docstring_section_style == "table" %}
22
+ {% block table_style scoped %}
23
+ {#- Block for the `table` section style. -#}
24
+ <p><span class="doc-section-title">{{ section.title or lang.t("Type Aliases:") }}</span></p>
25
+ <table>
26
+ <thead>
27
+ <tr>
28
+ <th>{{ lang.t("Name") }}</th>
29
+ <th>{{ lang.t("Description") }}</th>
30
+ </tr>
31
+ </thead>
32
+ <tbody>
33
+ {% for type_alias in section.value %}
34
+ <tr class="doc-section-item">
35
+ <td><code><autoref identifier="{{ obj.path }}.{{ type_alias.name }}" optional hover>{{ type_alias.name }}</autoref></code></td>
36
+ <td>
37
+ <div class="doc-md-description">
38
+ {{ type_alias.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
39
+ </div>
40
+ </td>
41
+ </tr>
42
+ {% endfor %}
43
+ </tbody>
44
+ </table>
45
+ {% endblock table_style %}
46
+ {% elif config.docstring_section_style == "list" %}
47
+ {% block list_style scoped %}
48
+ {#- Block for the `list` section style. -#}
49
+ <p><span class="doc-section-title">{{ section.title or lang.t("Type Aliases:") }}</span></p>
50
+ <ul>
51
+ {% for type_alias in section.value %}
52
+ <li class="doc-section-item field-body">
53
+ <b><code><autoref identifier="{{ obj.path }}.{{ type_alias.name }}" optional hover>{{ type_alias.name }}</autoref></code></b>
54
+
55
+ <div class="doc-md-description">
56
+ {{ type_alias.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
57
+ </div>
58
+ </li>
59
+ {% endfor %}
60
+ </ul>
61
+ {% endblock list_style %}
62
+ {% elif config.docstring_section_style == "spacy" %}
63
+ {% block spacy_style scoped %}
64
+ {#- Block for the `spacy` section style. -#}
65
+ <table>
66
+ <thead>
67
+ <tr>
68
+ <th><span class="doc-section-title">{{ (section.title or lang.t("TYPE ALIAS")).rstrip(":").upper() }}</span></th>
69
+ <th><span>{{ lang.t("DESCRIPTION") }}</span></th>
70
+ </tr>
71
+ </thead>
72
+ <tbody>
73
+ {% for type_alias in section.value %}
74
+ <tr class="doc-section-item">
75
+ <td><code><autoref identifier="{{ obj.path }}.{{ type_alias.name }}" optional hover>{{ type_alias.name }}</autoref></code></td>
76
+ <td class="doc-type_alias-details">
77
+ <div class="doc-md-description">
78
+ {{ type_alias.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
79
+ </div>
80
+ </td>
81
+ </tr>
82
+ {% endfor %}
83
+ </tbody>
84
+ </table>
85
+ {% endblock spacy_style %}
86
+ {% endif %}
@@ -0,0 +1,10 @@
1
+ {# YORE: Bump 2: Remove file. #}
2
+ {% extends "_base/docstring/type_parameters.html.jinja" %}
3
+
4
+ {% block logs scoped %}
5
+ {{ super() }}
6
+ {{ log.warning(
7
+ "DeprecationWarning: Extending '_base/docstring/type_parameters.html' is deprecated, extend '_base/docstring/type_parameters.html.jinja' instead. ",
8
+ once=True,
9
+ ) }}
10
+ {% endblock logs %}