Example #1
0
def strtobool(val):
    if isinstance(val, bool):
        return val
    try:
        return _stb(str(val))
    except ValueError:
        val = val.lower()
        if val == "enable":
            return 1
        if val == "disable":
            return 0
        raise
Example #2
0
def strtobool(val):
    if isinstance(val, bool):
        return val
    return _stb(str(val))