Skip to content

Commit 80e2fdb

Browse files
committed
chore: Mark legacy code with YORE comments
1 parent 2d83900 commit 80e2fdb

File tree

125 files changed

+222
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+222
-16
lines changed

src/mkdocstrings_handlers/python/_internal/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
if getattr(pydantic, "__version__", "1.").startswith("1."):
3838
raise ImportError # noqa: TRY301
3939

40+
# YORE: EOL 3.9: Remove block.
4041
if sys.version_info < (3, 10):
4142
try:
4243
import eval_type_backport # noqa: F401

src/mkdocstrings_handlers/python/_internal/handler.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
from mkdocs.config.defaults import MkDocsConfig
3434

3535

36+
# YORE: EOL 3.10: Replace block with line 2.
3637
if sys.version_info >= (3, 11):
3738
from contextlib import chdir
3839
else:
39-
# TODO: remove once support for Python 3.10 is dropped
4040
from contextlib import contextmanager
4141

4242
@contextmanager
@@ -54,6 +54,7 @@ def chdir(path: str) -> Iterator[None]:
5454
patch_loggers(get_logger)
5555

5656

57+
# YORE: Bump 2: Remove block.
5758
def _warn_extra_options(names: Sequence[str]) -> None:
5859
warn(
5960
"Passing extra options directly under `options` is deprecated. "
@@ -94,14 +95,18 @@ def __init__(self, config: PythonConfig, base_dir: Path, **kwargs: Any) -> None:
9495
self.base_dir = base_dir
9596
"""The base directory of the project."""
9697

97-
# YORE: Bump 2: Replace block with `self.global_options = config.options`.
98+
# YORE: Bump 2: Remove block.
9899
global_extra, global_options = PythonOptions._extract_extra(config.options)
99100
if global_extra:
100101
_warn_extra_options(global_extra.keys()) # type: ignore[arg-type]
101102
self._global_extra = global_extra
102103
self.global_options = global_options
103104
"""The global configuration options (in `mkdocs.yml`)."""
104105

106+
# YORE: Bump 2: Replace `# ` with `` within block.
107+
# self.global_options = config.options
108+
# """The global configuration options (in `mkdocs.yml`)."""
109+
105110
# Warn if user overrides base templates.
106111
if self.custom_templates:
107112
for theme_dir in base_dir.joinpath(self.custom_templates, "python").iterdir():

src/mkdocstrings_handlers/python/_internal/rendering.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def do_format_signature(
148148
The same code, formatted.
149149
"""
150150
env = context.environment
151-
# TODO: Stop using `do_get_template` when `*.html` templates are removed.
151+
# YORE: Bump 2: Replace `do_get_template(env, "signature")` with `"signature.html.jinja"`.
152152
template = env.get_template(do_get_template(env, "signature"))
153153

154154
if annotations is None:
@@ -208,7 +208,7 @@ def do_format_attribute(
208208
The same code, formatted.
209209
"""
210210
env = context.environment
211-
# TODO: Stop using `do_get_template` when `*.html` templates are removed.
211+
# YORE: Bump 2: Replace `do_get_template(env, "expression")` with `"expression.html.jinja"`.
212212
template = env.get_template(do_get_template(env, "expression"))
213213
annotations = context.parent["config"].show_signature_annotations
214214

@@ -269,6 +269,7 @@ def do_order_members(
269269
return sorted(members, key=_order_map[order])
270270

271271

272+
# YORE: Bump 2: Remove block.
272273
@lru_cache
273274
def _warn_crossref() -> None:
274275
warnings.warn(
@@ -278,6 +279,7 @@ def _warn_crossref() -> None:
278279
)
279280

280281

282+
# YORE: Bump 2: Remove block.
281283
def do_crossref(path: str, *, brief: bool = True) -> Markup:
282284
"""Deprecated. Filter to create cross-references.
283285
@@ -298,6 +300,7 @@ def do_crossref(path: str, *, brief: bool = True) -> Markup:
298300
)
299301

300302

303+
# YORE: Bump 2: Remove block.
301304
@lru_cache
302305
def _warn_multi_crossref() -> None:
303306
warnings.warn(
@@ -307,6 +310,7 @@ def _warn_multi_crossref() -> None:
307310
)
308311

309312

313+
# YORE: Bump 2: Remove block.
310314
def do_multi_crossref(text: str, *, code: bool = True) -> Markup:
311315
"""Deprecated. Filter to create cross-references.
312316
@@ -520,7 +524,10 @@ def formatter(code: str, line_length: int) -> str:
520524
return formatter
521525

522526

527+
# YORE: Bump 2: Remove line.
523528
@pass_environment
529+
# YORE: Bump 2: Replace `env: Environment, ` with `` within line.
530+
# YORE: Bump 2: Replace `str | ` with `` within line.
524531
def do_get_template(env: Environment, obj: str | Object) -> str | Template:
525532
"""Get the template name used to render an object.
526533
@@ -537,6 +544,7 @@ def do_get_template(env: Environment, obj: str | Object) -> str | Template:
537544
if name := extra_data.get("template", ""):
538545
return name
539546
name = obj.kind.value
547+
# YORE: Bump 2: Replace block with `return f"{name}.html.jinja"`.
540548
try:
541549
template = env.get_template(f"{name}.html")
542550
except TemplateNotFound:

src/mkdocstrings_handlers/python/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Deprecated. Import from `mkdocstrings_handlers.python` directly."""
22

3-
# YORE: Bump 1: Remove file.
3+
# YORE: Bump 2: Remove file.
44

55
import warnings
66
from typing import Any

src/mkdocstrings_handlers/python/handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Deprecated. Import from `mkdocstrings_handlers.python` directly."""
22

3-
# YORE: Bump 1: Remove file.
3+
# YORE: Bump 2: Remove file.
44

55
import warnings
66
from typing import Any

src/mkdocstrings_handlers/python/rendering.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Deprecated. Import from `mkdocstrings_handlers.python` directly."""
22

3-
# YORE: Bump 1: Remove file.
3+
# YORE: Bump 2: Remove file.
44

55
import warnings
66
from typing import Any

src/mkdocstrings_handlers/python/templates/material/_base/attribute.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# YORE: Bump 2: Remove file. #}
12
{% extends "_base/attribute.html.jinja" %}
23

34
{% block logs scoped %}

src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Context:
6464
This block renders the labels for the attribute.
6565
-#}
6666
{% with labels = attribute.labels %}
67+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
6768
{% include "labels"|get_template with context %}
6869
{% endwith %}
6970
{% endblock labels %}
@@ -110,6 +111,7 @@ Context:
110111
This block renders the docstring for the attribute.
111112
-#}
112113
{% with docstring_sections = attribute.docstring.parsed %}
114+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
113115
{% include "docstring"|get_template with context %}
114116
{% endwith %}
115117
{% endblock docstring %}

src/mkdocstrings_handlers/python/templates/material/_base/children.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# YORE: Bump 2: Remove file. #}
12
{% extends "_base/children.html.jinja" %}
23

34
{% block logs scoped %}

src/mkdocstrings_handlers/python/templates/material/_base/class.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# YORE: Bump 2: Remove file. #}
12
{% extends "_base/class.html.jinja" %}
23

34
{% block logs scoped %}

src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja

+9-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ Context:
5151
<span class="doc doc-object-name doc-class-name">{{ config.heading if config.heading and root else class_name }}</span>
5252
{% elif config.merge_init_into_class and "__init__" in all_members %}
5353
{% with function = all_members["__init__"] %}
54-
{%+ filter highlight(language="python", inline=True) %}
54+
{%+ filter highlight(language="python", inline=True) -%}
55+
{#- YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. -#}
5556
{{ class_name }}{% include "signature"|get_template with context %}
56-
{% endfilter %}
57+
{%- endfilter %}
5758
{% endwith %}
5859
{% else %}
5960
<code>{{ class_name }}</code>
@@ -66,6 +67,7 @@ Context:
6667
This block renders the labels for the class.
6768
-#}
6869
{% with labels = class.labels %}
70+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
6971
{% include "labels"|get_template with context %}
7072
{% endwith %}
7173
{% endblock labels %}
@@ -132,6 +134,7 @@ Context:
132134
Bases: {% for expression in class.bases -%}
133135
<code>
134136
{%- with backlink_type = "subclassed-by" -%}
137+
{#- YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. -#}
135138
{%- include "expression"|get_template with context -%}
136139
{%- endwith -%}
137140
</code>{% if not loop.last %}, {% endif %}
@@ -146,6 +149,7 @@ Context:
146149
This block renders the docstring for the class.
147150
-#}
148151
{% with docstring_sections = class.docstring.parsed %}
152+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
149153
{% include "docstring"|get_template with context %}
150154
{% endwith %}
151155
{% if config.merge_init_into_class %}
@@ -155,6 +159,7 @@ Context:
155159
{% if "__init__" in check_members and check_members["__init__"].has_docstring %}
156160
{% with function = check_members["__init__"] %}
157161
{% with obj = function, docstring_sections = function.docstring.parsed %}
162+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
158163
{% include "docstring"|get_template with context %}
159164
{% endwith %}
160165
{% endwith %}
@@ -172,6 +177,7 @@ Context:
172177
173178
This block renders auto-summaries for classes, methods, and attributes.
174179
-#}
180+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
175181
{% include "summary"|get_template with context %}
176182
{% endblock summary %}
177183

@@ -218,6 +224,7 @@ Context:
218224
-#}
219225
{% set root = False %}
220226
{% set heading_level = heading_level + 1 %}
227+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
221228
{% include "children"|get_template with context %}
222229
{% endblock children %}
223230
{% endblock contents %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# YORE: Bump 2: Remove file. #}
12
{% extends "_base/docstring.html.jinja" %}
23

34
{% block logs scoped %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja

+13
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,43 @@ Context:
2424
{% if config.show_docstring_description and section.kind.value == "text" %}
2525
{{ section.value|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
2626
{% elif config.show_docstring_attributes and section.kind.value == "attributes" %}
27+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
2728
{% include "docstring/attributes"|get_template with context %}
2829
{% elif config.show_docstring_functions and section.kind.value == "functions" %}
30+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
2931
{% include "docstring/functions"|get_template with context %}
3032
{% elif config.show_docstring_classes and section.kind.value == "classes" %}
33+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
3134
{% include "docstring/classes"|get_template with context %}
3235
{% elif config.show_docstring_modules and section.kind.value == "modules" %}
36+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
3337
{% include "docstring/modules"|get_template with context %}
3438
{% elif config.show_docstring_parameters and section.kind.value == "parameters" %}
39+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
3540
{% include "docstring/parameters"|get_template with context %}
3641
{% elif config.show_docstring_other_parameters and section.kind.value == "other parameters" %}
42+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
3743
{% include "docstring/other_parameters"|get_template with context %}
3844
{% elif config.show_docstring_raises and section.kind.value == "raises" %}
45+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
3946
{% include "docstring/raises"|get_template with context %}
4047
{% elif config.show_docstring_warns and section.kind.value == "warns" %}
48+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
4149
{% include "docstring/warns"|get_template with context %}
4250
{% elif config.show_docstring_yields and section.kind.value == "yields" %}
51+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
4352
{% include "docstring/yields"|get_template with context %}
4453
{% elif config.show_docstring_receives and section.kind.value == "receives" %}
54+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
4555
{% include "docstring/receives"|get_template with context %}
4656
{% elif config.show_docstring_returns and section.kind.value == "returns" %}
57+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
4758
{% include "docstring/returns"|get_template with context %}
4859
{% elif config.show_docstring_examples and section.kind.value == "examples" %}
60+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
4961
{% include "docstring/examples"|get_template with context %}
5062
{% elif config.show_docstring_description and section.kind.value == "admonition" %}
63+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
5164
{% include "docstring/admonition"|get_template with context %}
5265
{% endif %}
5366
{% endfor %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# YORE: Bump 2: Remove file. #}
12
{% extends "_base/docstring/admonition.html.jinja" %}
23

34
{% block logs scoped %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# YORE: Bump 2: Remove file. #}
12
{% extends "_base/docstring/attributes.html.jinja" %}
23

34
{% block logs scoped %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Context:
1515
{{ log.debug("Rendering attributes section") }}
1616
{% endblock logs %}
1717

18+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
1819
{% import "language"|get_template as lang with context %}
1920
{#- Language module providing the `t` translation method. -#}
2021

@@ -37,6 +38,7 @@ Context:
3738
<td>
3839
{% if attribute.annotation %}
3940
{% with expression = attribute.annotation %}
41+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
4042
<code>{% include "expression"|get_template with context %}</code>
4143
{% endwith %}
4244
{% endif %}
@@ -61,6 +63,7 @@ Context:
6163
<b><code><autoref identifier="{{ obj.path }}.{{ attribute.name }}" optional hover>{{ attribute.name }}</autoref></code></b>
6264
{% if attribute.annotation %}
6365
{% with expression = attribute.annotation %}
66+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
6467
(<code>{% include "expression"|get_template with context %}</code>)
6568
{% endwith %}
6669
{% endif %}
@@ -95,6 +98,7 @@ Context:
9598
<span class="doc-attribute-annotation">
9699
<b>TYPE:</b>
97100
{% with expression = attribute.annotation %}
101+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
98102
<code>{% include "expression"|get_template with context %}</code>
99103
{% endwith %}
100104
</span>

src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# YORE: Bump 2: Remove file. #}
12
{% extends "_base/docstring/classes.html.jinja" %}
23

34
{% block logs scoped %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Context:
1515
{{ log.debug("Rendering classes section") }}
1616
{% endblock logs %}
1717

18+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
1819
{% import "language"|get_template as lang with context %}
1920
{#- Language module providing the `t` translation method. -#}
2021

src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# YORE: Bump 2: Remove file. #}
12
{% extends "_base/docstring/examples.html.jinja" %}
23

34
{% block logs scoped %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Context:
1515
{{ log.debug("Rendering examples section") }}
1616
{% endblock logs %}
1717

18+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
1819
{% import "language"|get_template as lang with context %}
1920
{#- Language module providing the `t` translation method. -#}
2021

src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# YORE: Bump 2: Remove file. #}
12
{% extends "_base/docstring/functions.html.jinja" %}
23

34
{% block logs scoped %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Context:
1515
{{ log.debug("Rendering functions section") }}
1616
{% endblock logs %}
1717

18+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
1819
{% import "language"|get_template as lang with context %}
1920
{#- Language module providing the `t` translation method. -#}
2021

src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# YORE: Bump 2: Remove file. #}
12
{% extends "_base/docstring/modules.html.jinja" %}
23

34
{% block logs scoped %}

src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Context:
1515
{{ log.debug("Rendering modules section") }}
1616
{% endblock logs %}
1717

18+
{# YORE: Bump 2: Replace `"|get_template` with `.html.jinja"` within line. #}
1819
{% import "language"|get_template as lang with context %}
1920
{#- Language module providing the `t` translation method. -#}
2021

src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{# YORE: Bump 2: Remove file. #}
12
{% extends "_base/docstring/other_parameters.html.jinja" %}
23

34
{% block logs scoped %}

0 commit comments

Comments
 (0)