MCPcopy Create free account
hub / github.com/PowerGridModel/power-grid-model / render_template

Method render_template

code_generation/code_gen.py:36–44  ·  view source on GitHub ↗
(self, template_path: Path, output_path: Path, **data)

Source from the content-addressed store, hash-verified

34 self.base_output_path = base_output_path
35
36 def render_template(self, template_path: Path, output_path: Path, **data):
37 # jinja expects a string, representing a relative path with forward slashes
38 template_path_str = str(template_path.relative_to(TEMPLATE_DIR)).replace("\\", "/")
39 template = JINJA_ENV.get_template(template_path_str)
40
41 output = template.render(**data)
42
43 with output_path.open(mode="w", encoding="utf-8") as output_file:
44 output_file.write(output)
45
46 def render_attribute_classes(self, template_path: Path, data_path: Path, output_path: Path):
47 with data_path.open() as data_file:

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected