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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 7 additions & 2 deletions
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

Lines changed: 10 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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 %}

0 commit comments

Comments
 (0)