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

Function _extract_condition_vars

verifier/AgentVerifier/WorkflowToLean.py:378–385  ·  view source on GitHub ↗

Extract variable names from a condition string.

(condition: str)

Source from the content-addressed store, hash-verified

376
377
378def _extract_condition_vars(condition: str) -> list[str]:
379 """Extract variable names from a condition string."""
380 tmpl_vars = extract_template_vars(condition)
381 ident = r'([A-Za-z_]\w*)'
382 expr_vars = re.findall(rf'{ident}\s*(?:<=|>=|<|>|==|!=)', condition)
383 expr_vars += re.findall(rf'(?:<=|>=|<|>|==|!=)\s*{ident}', condition)
384 keywords = {'and', 'or', 'true', 'false', 'True', 'False', 'None', 'not'}
385 return sorted(set(v for v in (tmpl_vars + expr_vars) if v not in keywords))
386
387
388def parse_task_json(json_path: str) -> WorkflowIR:

Callers 2

parse_body_stepsFunction · 0.85
parse_task_jsonFunction · 0.85

Calls 1

extract_template_varsFunction · 0.85

Tested by

no test coverage detected