Coverage for src/container_collection/template/generate_input_contents.py: 100%
4 statements
« prev ^ index » next coverage.py v7.1.0, created at 2024-09-25 18:23 +0000
« prev ^ index » next coverage.py v7.1.0, created at 2024-09-25 18:23 +0000
1from jinja2 import StrictUndefined, Template
4def generate_input_contents(template: str, conditions: list[dict]) -> list[str]:
5 """
6 Generate input contents from template and conditions.
8 Parameters
9 ----------
10 template
11 Template string.
12 conditions
13 List of conditions.
15 Returns
16 -------
17 :
18 List of rendered templates.
19 """
21 compiled_template = Template(template, undefined=StrictUndefined)
22 return [compiled_template.render(condition) for condition in conditions]