INNER CODE UNIT · Python
_check_step
llm-d/llm-d · scripts/guide.py:306
def _check_step(step: Any, path: str, declared: set[str], f: Findings) -> None:
if not isinstance(step, dict):
f.error(f"{path}: step must be a map with 'run:' key, got {type(step).__name__}")
return
if "run" not in step:
f.error(f"{path}: step missing required 'run:' key")
if not isinstance(step.get("run", ""), str):
f.error(f"{path}: 'run:' must be a string")
when = step.get("when")
if when is not None:
if not isinstance(when, dict):
f.error(f"{path}: 'when:' must be a map, got {type(when).__name__}")
else:
for var, allowed in when.items():
if var not in declared:
f.error(f"{path}: 'when:' references undeclared variable {var!r}")
if not isinstance(allowed, list):