Load a workflow definition from a YAML file.
(cls, path: Path)
| 77 | |
| 78 | @classmethod |
| 79 | def from_yaml(cls, path: Path) -> WorkflowDefinition: |
| 80 | """Load a workflow definition from a YAML file.""" |
| 81 | with open(path, encoding="utf-8") as f: |
| 82 | data = yaml.safe_load(f) |
| 83 | if not isinstance(data, dict): |
| 84 | msg = f"Workflow YAML must be a mapping, got {type(data).__name__}." |
| 85 | raise ValueError(msg) |
| 86 | return cls(data, source_path=path) |
| 87 | |
| 88 | @classmethod |
| 89 | def from_string(cls, content: str) -> WorkflowDefinition: |
no outgoing calls