parse_bool

snpit_utils.utils.parse_bool(text)[source]

Check if a value represents a boolean value, and return that boolean value if it does.

Parameters:

text (bool, int, or str) – If bool, return as is. If int, return bool(text). If str, return True if text.lower() is any of “true”, “yes”, or “1”; return False if text.lower() is any of “false”, “no”, or “0”. Otherwise, raise an exception.

Return type:

bool