<commit_before>from array import array

class Variable(array):
    """
    This is the base class for all variables
    """        
    def reset(self):
        """
        Reset the value to the default 
        """
        self[0] = self.default

    def clear(self):
        """
        Supplied to match the interface of ROOT.vector
        """
        self.reset()
    
    def value(self):
        """
        The current value
        """
        return self[0]

    def set(self,value):
        """
        Set the value
        """
        self[0] = self.typename(value)
    
    def __str__(self):
        
        return self.__repr__()

    def __repr__(self):

        return "%s(%s) at %s"%(self.__class__.__name__,self[0],id(self).__hex__())

    def __getitem__(self,i):
        
        return array.__getitem__(self,0)

    def __setitem__(self,i,value):

        array.__setitem__(self,0,value)
    
    def __eq__(self,value):

        return self[0] == value

    def __ne__(self,value):

        return self[0] != value

#________________________________________________________________________

class Int(Variable):
    """
    This is a variable containing an integer
    """
    def __new__(cls, default=0):
        
        return Variable.__new__(cls,'i',[int(default)])

    def __init__(self, default=0):

        Variable.__init__(self)
        self.default = int(default)
        self.typename = int
    
    def type(self):
        """
        The character representation of the integer type
        """
        return 'I'

#________________________________________________________________________

class UInt(Variable):
    """
    This is a variable containing an unsigned integer
    """
    def __new__(cls, default=0):
        
        if default < 0:
            default = 0
        return Variable.__new__(cls,'I',[long(default)])

    def __init__(self, default=0):

        Variable.__init__(self)
        if default < 0:
            default = 0
        self.default = long(default)
        self.typename = long
    
    def type(self): return 'I'

#__________________________________________________________________________

class Float(Variable):
    """
    This is a variable containing a float
    """
    def __new__(cls, default=0.):
        
        return Variable.__new__(cls,'f',[float(default)])

    def __init__(self, default=0.):
        
        Variable.__init__(self)
        self.typename = float
        self.default = float(default)
    
    def type(self): return 'F'<commit_msg>updates<commit_after>from array import array

class Variable(array):
    """
    This is the base class for all variables
    """        
    def reset(self):
        """
        Reset the value to the default 
        """
        self[0] = self.default

    def clear(self):
        """
        Supplied to match the interface of ROOT.vector
        """
        self.reset()
    
    def value(self):
        """
        The current value
        """
        return self[0]

    def set(self,value):
        """
        Set the value
        """
        self[0] = self.typename(value)
    
    def __str__(self):
        
        return self.__repr__()

    def __repr__(self):

        return "%s(%s) at %s"%(self.__class__.__name__,self[0],id(self).__hex__())

    def __getitem__(self,i):
        
        return array.__getitem__(self,0)

    def __setitem__(self,i,value):

        array.__setitem__(self,0,value)
    
    def __eq__(self,value):

        return self[0] == value

    def __ne__(self,value):

        return self[0] != value

#________________________________________________________________________

class Int(Variable):
    """
    This is a variable containing an integer
    """
    def __new__(cls, default=0):
        
        return Variable.__new__(cls,'i',[int(default)])

    def __init__(self, default=0):

        Variable.__init__(self)
        self.default = int(default)
        self.typename = int
    
    def type(self):
        """
        The character representation of the integer type
        """
        return 'I'

#________________________________________________________________________

class UInt(Variable):
    """
    This is a variable containing an unsigned integer
    """
    def __new__(cls, default=0):
        
        if default < 0:
            default = 0
        return Variable.__new__(cls,'I',[long(default)])

    def __init__(self, default=0):

        Variable.__init__(self)
        if default < 0:
            default = 0
        self.default = long(default)
        self.typename = long
    
    def type(self):
        """
        The character representation of the unsigned integer type
        """
        return 'I'

#__________________________________________________________________________

class Float(Variable):
    """
    This is a variable containing a float
    """
    def __new__(cls, default=0.):
        
        return Variable.__new__(cls,'f',[float(default)])

    def __init__(self, default=0.):
        
        Variable.__init__(self)
        self.typename = float
        self.default = float(default)
    
    def type(self):
        """
        The character representation of the float type
        """
        return 'F'
{'fraction_non_alphanumeric': 0.10788224121557455, 'fraction_numerical': 0.006837606837606838, 'mean_word_length': 2.0831381733021077, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1015805', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1396, 'n_words': 356}