Compare commits
1 commit
bc4af135b4
...
87ee83d3ee
| Author | SHA1 | Date | |
|---|---|---|---|
| 87ee83d3ee |
4 changed files with 1 additions and 23 deletions
|
|
@ -448,18 +448,6 @@ def generate_jinja2_template(
|
||||||
return template
|
return template
|
||||||
|
|
||||||
|
|
||||||
def _template_variable_names(
|
|
||||||
role_prefix: str,
|
|
||||||
flat_items: list[tuple[tuple[str, ...], Any]],
|
|
||||||
loop_candidates: list[LoopCandidate] | None = None,
|
|
||||||
) -> set[str]:
|
|
||||||
names = {make_var_name(role_prefix, path) for path, _value in flat_items}
|
|
||||||
if loop_candidates:
|
|
||||||
for candidate in loop_candidates:
|
|
||||||
names.add(make_var_name(role_prefix, candidate.path))
|
|
||||||
return names
|
|
||||||
|
|
||||||
|
|
||||||
def _stringify_timestamps(obj: Any) -> Any:
|
def _stringify_timestamps(obj: Any) -> Any:
|
||||||
"""
|
"""
|
||||||
Recursively walk a parsed config and turn any datetime/date/time objects
|
Recursively walk a parsed config and turn any datetime/date/time objects
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
NAME = "jinja2"
|
|
||||||
TEMPLATE_EXTENSION = "j2"
|
TEMPLATE_EXTENSION = "j2"
|
||||||
JSON_VALUE_FILTER = "to_json(ensure_ascii=False)"
|
JSON_VALUE_FILTER = "to_json(ensure_ascii=False)"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,6 @@ def _absolute(path: Path) -> Path:
|
||||||
return path if path.is_absolute() else Path.cwd() / path
|
return path if path.is_absolute() else Path.cwd() / path
|
||||||
|
|
||||||
|
|
||||||
def _check_existing_path_not_symlink(path: Path) -> None:
|
|
||||||
try:
|
|
||||||
st = path.lstat()
|
|
||||||
except FileNotFoundError:
|
|
||||||
return
|
|
||||||
if stat.S_ISLNK(st.st_mode):
|
|
||||||
raise OutputPathError(f"refusing to use symlink path: {path}")
|
|
||||||
|
|
||||||
|
|
||||||
def _check_existing_output_file(path: Path) -> None:
|
def _check_existing_output_file(path: Path) -> None:
|
||||||
try:
|
try:
|
||||||
st = path.lstat()
|
st = path.lstat()
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ def test_yaml_loop_preserves_blank_separator_after_list(tmp_path: Path):
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
for label, text, rendered_expected, erb_expected in cases:
|
for label, text, rendered_expected in cases:
|
||||||
path = tmp_path / f"{label}.yml"
|
path = tmp_path / f"{label}.yml"
|
||||||
path.write_text(text, encoding="utf-8")
|
path.write_text(text, encoding="utf-8")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue