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

Method code_gen

code_generation/code_gen.py:119–134  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

117 )
118
119 def code_gen(self):
120 render_funcs = {
121 "attribute_classes": self.render_attribute_classes,
122 "dataset_class_maps": self.render_dataset_class_maps,
123 }
124
125 # render attribute classes
126 for template_name, render_func in render_funcs.items():
127 for template_path in TEMPLATE_DIR.rglob(f"{template_name}.*.jinja"):
128 output_suffix = template_path.with_suffix("").suffix
129 output_dir = template_path.parent.relative_to(TEMPLATE_DIR)
130 for data_path in DATA_DIR.glob(f"{template_name}/*.json"):
131 output_path = self.base_output_path / output_dir / data_path.with_suffix(output_suffix).name
132 output_path.parent.mkdir(parents=True, exist_ok=True)
133 print(f"Generating file: {output_path}")
134 render_func(template_path=template_path, data_path=data_path, output_path=output_path)
135
136
137if __name__ == "__main__":

Callers 1

code_gen.pyFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected