<commit_before># Types which the user should never directly see
ERROR        = "<!error>"
RETURN_VALUE = "<!return value>"

# Normal types
NUMBER  = "<number>"
BOOLEAN = "<boolean>"
STRING  = "<string>"
ARRAY   = "<array>"
NULL    = "<null>"
BLOCK   = "<block>"

class Object(object):
    def __eq__(self, other):
        return type(other) == type(self)
    
    def __ne__(self, other):
        return not self.__eq__(other)
    
    def __str__(self):
        return ""
    
    __repr__ = __str__
    
    
def compare(prop = "value"):
    return (lambda self, other: getattr(self, prop) == getattr(other, prop) if type(self) == type(other) else False)


class Error(Object):
    """represents an error thrown in execution"""
    def __init__(self, msg):
        self.type = ERROR
        self.msg = msg
    
    __eq__ = compare("msg")
    
    def __str__(self):
        return "ERROR: %s" % self.msg
        

class ReturnValue(Object):
    """represents a value to be returned from a function"""
    def __init__(self, value):
        self.type = RETURN_VALUE
        self.value = value
    
    __eq__ = compare()
            
    
    def __str__(self):
        return str(self.value)
        

class Number(Object):
    """represents a number object"""
    def __init__(self, value):
        self.type = NUMBER
        self.value = value
        
    __eq__ = compare()
            
    def __str__(self):
        return str(self.value)
        
    def is_integer(self):
        return float(int(self.value)) == self.value
        
    def is_positive(self):
        return self.value >= 0
        
        
class Boolean(Object):
    """a boolean object"""
    def __init__(self, value):
        self.type = BOOLEAN
        self.value = value
        
    __eq__ = compare()
    
    def __str__(self):
        return str(self.value).lower()
        
        
class String(Object):
    """a string object"""
    def __init__(self, value):
        self.type = STRING
        self.value = value
        
    __eq__ = compare()
    
    def __str__(self):
        return "%s" % self.value
        
        
class Null(Object):
    """the null object"""
    def __init__(self):
        self.type = NULL
        
    def __str__(self):
        return "null" 
        
        
class Array(Object):
    """an array object"""
    def __init__(self, elements):
        self.type = ARRAY
        self.elements = elements
        
    def __eq__(self, other):
        if type(other) != type(self):
            return False
        else:
            if len(self.elements) != len(other.elements):
                return False
                
            for i in range(len(self.elements)):
                if self.elements[i] != other.elements[i]:
                    return False
                    
            return True
            
    def __str__(self):
        return "[%s]" % "".join(str(e) + ", " for e in self.elements)[:-2]
        
        
class Function(Object):
    """a function object"""
    def __init__(self, pattern, body, context):
        self.pattern = pattern # [id|param]
        self.body = body
        self.context = context
    
    def __str__(self):
        return "<function instance>"
        
        
class Block(Object):
    """a block object"""
    def __init__(self, params, body):
        self.params = params
        self.body = body
        
    def __str__(self):
        return "<block instance>"
    <commit_msg>Add .type properties to Function and Block objects<commit_after># Types which the user should never directly see
ERROR        = "<!error>"
RETURN_VALUE = "<!return value>"
FUNCTION     = "<!function>"

# Normal types
NUMBER  = "<number>"
BOOLEAN = "<boolean>"
STRING  = "<string>"
ARRAY   = "<array>"
NULL    = "<null>"
BLOCK   = "<block>"

class Object(object):
    def __eq__(self, other):
        return type(other) == type(self)
    
    def __ne__(self, other):
        return not self.__eq__(other)
    
    def __str__(self):
        return ""
    
    __repr__ = __str__
    
    
def compare(prop = "value"):
    return (lambda self, other: getattr(self, prop) == getattr(other, prop) if type(self) == type(other) else False)


class Error(Object):
    """represents an error thrown in execution"""
    def __init__(self, msg):
        self.type = ERROR
        self.msg = msg
    
    __eq__ = compare("msg")
    
    def __str__(self):
        return "ERROR: %s" % self.msg
        

class ReturnValue(Object):
    """represents a value to be returned from a function"""
    def __init__(self, value):
        self.type = RETURN_VALUE
        self.value = value
    
    __eq__ = compare()
            
    
    def __str__(self):
        return str(self.value)
        

class Number(Object):
    """represents a number object"""
    def __init__(self, value):
        self.type = NUMBER
        self.value = value
        
    __eq__ = compare()
            
    def __str__(self):
        return str(self.value)
        
    def is_integer(self):
        return float(int(self.value)) == self.value
        
    def is_positive(self):
        return self.value >= 0
        
        
class Boolean(Object):
    """a boolean object"""
    def __init__(self, value):
        self.type = BOOLEAN
        self.value = value
        
    __eq__ = compare()
    
    def __str__(self):
        return str(self.value).lower()
        
        
class String(Object):
    """a string object"""
    def __init__(self, value):
        self.type = STRING
        self.value = value
        
    __eq__ = compare()
    
    def __str__(self):
        return "%s" % self.value
        
        
class Null(Object):
    """the null object"""
    def __init__(self):
        self.type = NULL
        
    def __str__(self):
        return "null" 
        
        
class Array(Object):
    """an array object"""
    def __init__(self, elements):
        self.type = ARRAY
        self.elements = elements
        
    def __eq__(self, other):
        if type(other) != type(self):
            return False
        else:
            if len(self.elements) != len(other.elements):
                return False
                
            for i in range(len(self.elements)):
                if self.elements[i] != other.elements[i]:
                    return False
                    
            return True
            
    def __str__(self):
        return "[%s]" % "".join(str(e) + ", " for e in self.elements)[:-2]
        
        
class Function(Object):
    """a function object"""
    def __init__(self, pattern, body, context):
        self.type = FUNCTION
        self.pattern = pattern # [id|param]
        self.body = body
        self.context = context
    
    def __str__(self):
        return "<function instance>"
        
        
class Block(Object):
    """a block object"""
    def __init__(self, params, body):
        self.type = BLOCK
        self.params = params
        self.body = body
        
    def __str__(self):
        return "<block instance>"
    
{'fraction_non_alphanumeric': 0.11745490697344127, 'fraction_numerical': 0.000568101121999716, 'mean_word_length': 1.7615686274509803, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 26, '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': '2386102', 'n_tokens_mistral': 2037, 'n_tokens_neox': 2019, 'n_words': 563}