# Path: hq/hquery/object_type.py
# def is_node_set(obj):
#     return isinstance(obj, list) and all(is_any_node(x) for x in obj)
# 
# def is_number(obj):
#     return obj.__class__.__name__ == 'number'
# 
# def is_boolean(obj):
#     return obj.__class__.__name__ == 'boolean'


from math import isnan
from hq.hquery.object_type import is_node_set, is_number, is_boolean



exports = ('boolean', 'false', 'not_', 'true')


class boolean:

    def __init__(self, obj):
        if is_node_set(obj):
            self.value = len(obj) > 0
        elif is_number(obj):
            f = float(obj)
            self.value = bool(f) and not isnan(f)
        else:
            self.value = bool(obj)

    def __bool__(self):
        return self.value

    def __nonzero__(self):
        return self.__bool__()

    def __str__(self):
        return str(self.value).lower()

    def __eq__(self, other):

# Path: hq/hquery/object_type.py
# def is_node_set(obj):
#     return isinstance(obj, list) and all(is_any_node(x) for x in obj)
# 
# def is_number(obj):
#     return obj.__class__.__name__ == 'number'
# 
# def is_boolean(obj):
#     return obj.__class__.__name__ == 'boolean'


# Path: hq/hquery/functions/core_boolean.py
from math import isnan
from hq.hquery.object_type import is_node_set, is_number, is_boolean




exports = ('boolean', 'false', 'not_', 'true')


class boolean:

    def __init__(self, obj):
        if is_node_set(obj):
            self.value = len(obj) > 0
        elif is_number(obj):
            f = float(obj)
            self.value = bool(f) and not isnan(f)
        else:
            self.value = bool(obj)

    def __bool__(self):
        return self.value

    def __nonzero__(self):
        return self.__bool__()

    def __str__(self):
        return str(self.value).lower()

    def __eq__(self, other):

        return is_boolean(other) and self.value == other.value