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

Method _check_switch

src/harness/agentic_loop/verifier.py:288–316  ·  view source on GitHub ↗

Check 'switch' type — requires variable, cases.

(self, body, errors, warnings, defined_vars, path)

Source from the content-addressed store, hash-verified

286 )
287
288 def _check_switch(self, body, errors, warnings, defined_vars, path):
289 """Check 'switch' type — requires variable, cases."""
290 if not isinstance(body, dict):
291 errors.append(f"{path}.switch: body must be a dict")
292 return
293 if "variable" not in body:
294 errors.append(f"{path}.switch: missing required field 'variable'")
295 if "cases" not in body:
296 errors.append(f"{path}.switch: missing required field 'cases'")
297 else:
298 cases = body["cases"]
299 if isinstance(cases, dict):
300 for case_key, case_steps in cases.items():
301 if isinstance(case_steps, list):
302 self._check_steps(
303 case_steps,
304 errors,
305 warnings,
306 defined_vars.copy(),
307 f"{path}.switch.cases.{case_key}",
308 )
309 if "default" in body and isinstance(body["default"], list):
310 self._check_steps(
311 body["default"],
312 errors,
313 warnings,
314 defined_vars.copy(),
315 f"{path}.switch.default",
316 )
317
318 def _check_call(self, body, errors, warnings, defined_vars, path):
319 """Check 'call' type — requires module."""

Callers

nothing calls this directly

Calls 1

_check_stepsMethod · 0.95

Tested by

no test coverage detected