| 207 | submodule_map: Optional[dict[str, SubmoduleRef]] = None |
| 208 | |
| 209 | def to_dict(self) -> dict: |
| 210 | d: dict = { |
| 211 | "name": self.name, "goal": self.goal, |
| 212 | "parameters": [p.to_dict() for p in self.parameters], |
| 213 | "nodes": [n.to_dict() for n in self.nodes], |
| 214 | "edges": [e.to_dict() for e in self.edges], |
| 215 | "entry": self.entry, "exits": self.exits, |
| 216 | } |
| 217 | if self.submodule_map: |
| 218 | d["submodule_map"] = {k: v.to_dict() for k, v in self.submodule_map.items()} |
| 219 | return d |
| 220 | |
| 221 | @staticmethod |
| 222 | def from_dict(d: dict) -> "WorkflowIR": |