Extract variable names from a condition string.
(condition: str)
| 376 | |
| 377 | |
| 378 | def _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 | |
| 388 | def parse_task_json(json_path: str) -> WorkflowIR: |
no test coverage detected