def map_bool()

in torchbiggraph/schema.py [0:0]


    def map_bool(data: Any) -> bool:
        if not isinstance(data, bool):
            # Be lenient.
            if isinstance(data, int):
                if data == 0:
                    return False
                if data == 1:
                    return True
            if isinstance(data, str):
                if data.lower() in TRUE_STRINGS:
                    return True
                if data.lower() in FALSE_STRINGS:
                    return False
            raise DeepTypeError("Not a bool")
        return data