Constants
zenml.constants
handle_bool_env_var(var, default=False)
Converts normal env var to boolean
Source code in zenml/constants.py
def handle_bool_env_var(var: str, default: bool = False) -> bool:
"""Converts normal env var to boolean"""
value = os.getenv(var)
if value in ["1", "y", "yes", "True", "true"]:
return True
return default
handle_int_env_var(var, default=0)
Converts normal env var to int
Source code in zenml/constants.py
def handle_int_env_var(var: str, default: int = 0) -> int:
"""Converts normal env var to int"""
value = os.getenv(var, "")
try:
return int(value)
except (ValueError, TypeError):
return default