Coerce a config value (possibly an expression) to a boolean.
(cls, value: Any, context: StepContext)
| 235 | |
| 236 | @classmethod |
| 237 | def _resolve_bool(cls, value: Any, context: StepContext) -> bool: |
| 238 | """Coerce a config value (possibly an expression) to a boolean.""" |
| 239 | resolved = cls._resolve(value, context) |
| 240 | if isinstance(resolved, str): |
| 241 | return resolved.strip().lower() in ("true", "1", "yes") |
| 242 | return bool(resolved) |
| 243 | |
| 244 | @staticmethod |
| 245 | def _run_init( |