<commit_before>class pyArangoException(Exception):
    """The calss from witch all Exceptions inherit"""
    def __init__(self, message, errors=None):
        Exception.__init__(self, message)
        if not errors:
            errors = {}
        self.message = message
        self.errors = errors

    def __str__(self):
        return self.message + ". Errors: " + str(self.errors)

class ConnectionError(pyArangoException):
    """Something went wrong with the connection"""
    def __init__(self, message, URL, statusCode="", errors=None):
        if not errors:
            errors = {}
        mes = "%s. URL: %s, status: %s" % (message, URL, statusCode)
        pyArangoException.__init__(self, mes, errors)

class CreationError(pyArangoException):
    """Something went wrong when creating something"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class UpdateError(pyArangoException):
    """Something went wrong when updating something"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class DeletionError(pyArangoException):
    """Something went wrong when deleting something"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class TraversalError(pyArangoException):
    """Something went wrong when doing a graph traversal"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class ValidationError(pyArangoException):
    """Something went wrong when validating something"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class SchemaViolation(pyArangoException):
    """Raised when someone tries to add a new field to an object belonging a to a Collection with enforced schema"""
    def __init__(self, collection, field, errors=None):
        if not errors:
            errors = {}
        message = "Collection '%s' does not have a field '%s' in it's schema" % (collection.__name__, field)
        pyArangoException.__init__(self, message, errors)

class InvalidDocument(pyArangoException):
    """Raised when a Document does not respect schema/validation defined in its collection"""
    def __init__(self, errors):
        message = "Unsuccesful validation"
        self.strErrors = []
        for k, v in errors.items():
            self.strErrors.append("%s -> %s" % (k, v))
        self.strErrors = '\n\t'.join(self.strErrors)

        pyArangoException.__init__(self, message, errors)

    def __str__(self) :
        self.strErrors = []
        for k, v in self.errors.items() :
            strErrors.append("%s -> %s" % (k, v))
        strErrors = '\n\t'.join(strErrors)
        return self.message + ":\n\t" + strErrors

class SimpleQueryError(pyArangoException):
    """Something went wrong with a simple query"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class QueryError(pyArangoException):
    """Something went wrong with an aql query"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class AQLQueryError(pyArangoException):
    """Something went wrong with an aql query"""
    def __init__(self, message, query, errors=None):
        if not errors:
            errors = {}
        message = "Error in: %s.\n->%s" % (query, message)
        pyArangoException.__init__(self, message, errors)

class CursorError(pyArangoException):
    """Something went wrong when trying to fetch data with a cursor"""
    def __init__(self, message, cursorId, errors=None):
        if not errors:
            errors = {}
        message = "Unable to retreive data for cursor %s: %s" % (cursorId, message)
        pyArangoException.__init__(self, message, errors)

class TransactionError(pyArangoException):
    """Something went wrong with a transaction"""
    def __init__(self, message, action, errors=None):
        if not errors:
            errors = {}
        message = "Error in: %s.\n->%s" % (action, message)
        pyArangoException.__init__(self, message, errors)

class AbstractInstanciationError(Exception):
    """Raised when someone tries to instanciate an abstract class"""
    def __init__(self, cls):
        self.cls = cls
        self.message = "%s is abstract and is not supposed to be instanciated. Collections my inherit from it" % self.cls.__name__
        Exception.__init__(self, self.message)

    def __str__(self):
        return self.message

class DocumentNotFoundError(Exception):
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)<commit_msg>DocumentNotFoundError inherit from pyarangoException as opposed to Exception<commit_after>class pyArangoException(Exception):
    """The calss from witch all Exceptions inherit"""
    def __init__(self, message, errors=None):
        Exception.__init__(self, message)
        if not errors:
            errors = {}
        self.message = message
        self.errors = errors

    def __str__(self):
        return self.message + ". Errors: " + str(self.errors)

class ConnectionError(pyArangoException):
    """Something went wrong with the connection"""
    def __init__(self, message, URL, statusCode="", errors=None):
        if not errors:
            errors = {}
        mes = "%s. URL: %s, status: %s" % (message, URL, statusCode)
        pyArangoException.__init__(self, mes, errors)

class CreationError(pyArangoException):
    """Something went wrong when creating something"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class UpdateError(pyArangoException):
    """Something went wrong when updating something"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class DeletionError(pyArangoException):
    """Something went wrong when deleting something"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class TraversalError(pyArangoException):
    """Something went wrong when doing a graph traversal"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class ValidationError(pyArangoException):
    """Something went wrong when validating something"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class SchemaViolation(pyArangoException):
    """Raised when someone tries to add a new field to an object belonging a to a Collection with enforced schema"""
    def __init__(self, collection, field, errors=None):
        if not errors:
            errors = {}
        message = "Collection '%s' does not have a field '%s' in it's schema" % (collection.__name__, field)
        pyArangoException.__init__(self, message, errors)

class InvalidDocument(pyArangoException):
    """Raised when a Document does not respect schema/validation defined in its collection"""
    def __init__(self, errors):
        message = "Unsuccesful validation"
        self.strErrors = []
        for k, v in errors.items():
            self.strErrors.append("%s -> %s" % (k, v))
        self.strErrors = '\n\t'.join(self.strErrors)

        pyArangoException.__init__(self, message, errors)

    def __str__(self) :
        self.strErrors = []
        for k, v in self.errors.items() :
            strErrors.append("%s -> %s" % (k, v))
        strErrors = '\n\t'.join(strErrors)
        return self.message + ":\n\t" + strErrors

class SimpleQueryError(pyArangoException):
    """Something went wrong with a simple query"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class QueryError(pyArangoException):
    """Something went wrong with an aql query"""
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)

class AQLQueryError(pyArangoException):
    """Something went wrong with an aql query"""
    def __init__(self, message, query, errors=None):
        if not errors:
            errors = {}
        message = "Error in: %s.\n->%s" % (query, message)
        pyArangoException.__init__(self, message, errors)

class CursorError(pyArangoException):
    """Something went wrong when trying to fetch data with a cursor"""
    def __init__(self, message, cursorId, errors=None):
        if not errors:
            errors = {}
        message = "Unable to retreive data for cursor %s: %s" % (cursorId, message)
        pyArangoException.__init__(self, message, errors)

class TransactionError(pyArangoException):
    """Something went wrong with a transaction"""
    def __init__(self, message, action, errors=None):
        if not errors:
            errors = {}
        message = "Error in: %s.\n->%s" % (action, message)
        pyArangoException.__init__(self, message, errors)

class AbstractInstanciationError(Exception):
    """Raised when someone tries to instanciate an abstract class"""
    def __init__(self, cls):
        self.cls = cls
        self.message = "%s is abstract and is not supposed to be instanciated. Collections my inherit from it" % self.cls.__name__
        Exception.__init__(self, self.message)

    def __str__(self):
        return self.message

class DocumentNotFoundError(pyArangoException):
    def __init__(self, message, errors=None):
        if not errors:
            errors = {}
        pyArangoException.__init__(self, message, errors)
{'fraction_non_alphanumeric': 0.10765805015006293, 'fraction_numerical': 0.0, 'mean_word_length': 2.973076923076923, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 11, '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': '4119043', 'n_tokens_mistral': 2786, 'n_tokens_neox': 2760, 'n_words': 882}