MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / _try_parse

Method _try_parse

src/harness/agentic_loop/plan_generator.py:190–204  ·  view source on GitHub ↗

Attempt to parse YAML. Returns error message on failure, None on success.

(yaml_str: str)

Source from the content-addressed store, hash-verified

188
189 @staticmethod
190 def _try_parse(yaml_str: str) -> Optional[str]:
191 """Attempt to parse YAML. Returns error message on failure, None on success."""
192 try:
193 data = yaml.safe_load(yaml_str)
194 if not isinstance(data, dict):
195 return "YAML did not parse to a dictionary (got {})".format(
196 type(data).__name__
197 )
198 if "workflow" not in data:
199 return "Missing required top-level key: 'workflow'"
200 if "name" not in data:
201 return "Missing required top-level key: 'name'"
202 return None
203 except yaml.YAMLError as e:
204 return str(e)

Callers 1

generateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected