MCPcopy Index your code
hub / github.com/github/spec-kit / evaluate_condition

Function evaluate_condition

src/specify_cli/workflows/expressions.py:483–498  ·  view source on GitHub ↗

Evaluate a condition expression and return a boolean. Convenience wrapper around ``evaluate_expression`` that coerces the result to bool.

(condition: str, context: Any)

Source from the content-addressed store, hash-verified

481
482
483def evaluate_condition(condition: str, context: Any) -> bool:
484 """Evaluate a condition expression and return a boolean.
485
486 Convenience wrapper around ``evaluate_expression`` that coerces
487 the result to bool.
488 """
489 result = evaluate_expression(condition, context)
490 # Treat plain "false"/"true" strings as booleans so that
491 # condition: "false" (without {{ }}) behaves as expected.
492 if isinstance(result, str):
493 lower = result.lower()
494 if lower == "false":
495 return False
496 if lower == "true":
497 return True
498 return bool(result)

Callers 5

executeMethod · 0.90
executeMethod · 0.90
_execute_stepsMethod · 0.85

Calls 1

evaluate_expressionFunction · 0.85