sqlmesh.utils.conversions
1from __future__ import annotations 2 3import typing as t 4 5 6def ensure_bool(val: t.Any) -> bool: 7 if isinstance(val, bool): 8 return val 9 10 if isinstance(val, str): 11 val = try_str_to_bool(val) 12 13 return bool(val) 14 15 16def try_str_to_bool(val: str) -> t.Union[str, bool]: 17 maybe_bool = val.lower() 18 if maybe_bool in ["true", "false"]: 19 return maybe_bool == "true" 20 21 return val
def
ensure_bool(val: Any) -> bool:
def
try_str_to_bool(val: str) -> Union[str, bool]: