''' Bool - A mutable bool class

##################################################
###### AUTOGENERATED - DO NOT EDIT DIRECTLY ######
##################################################
'''

from mutable_primitives.base import Mutable


class Bool(Mutable):
    ''' Bool - A mutable bool class '''
    base = bool

    def __init__(self, val):
        super(Bool, self).__init__(val, self.base) #pylint: disable=super-with-arguments
        self.val = val

    def get(self):
        ''' get raw (primitive) value '''
        return self.val

    def set(self, val):
        ''' set raw (primitive) value '''
        assert isinstance(val, self.base)
        self.val = val

    def __eq__(self, other):
        return self.val == other

    def __ne__(self, other):
        return self.val != other

    def __str__(self):
        return '{}({})'.format(self.__class__.__name__, self.val)

    def __repr__(self):
        return '{}({})'.format(self.__class__.__name__, self.val)

    def __bool__(self):
        ''' boolean test for python3 '''
        if self.val:
            return True
        return False

    def __nonzero__(self):
        ''' boolean test for python2 '''
        if self.val:
            return True
        return False
