<commit_before>"""
.. autoclass:: DependencyError

.. autoclass:: CaughtDependencyError

.. autoclass:: DependencyLoop

.. autoclass:: MissingResource

.. autoclass:: RevisionNotFound

.. autoclass:: PageNotFound

.. autoclass:: UserNotFound

.. autoclass:: UserDeleted

.. autoclass:: CommentDeleted

.. autoclass:: TextDeleted
"""


class DependencyError(RuntimeError):
    def __init__(self, message):
        super().__init__(message)
        self.message = message

    def __str__(self):
        return "{0}: {1}".format(self.__class__.__name__, self.message)


class CaughtDependencyError(DependencyError):

    def __init__(self, message, exception=None, tb=None,
                 formatted_exception=None):
        super().__init__(message)
        self.exception = exception
        self.tb = tb
        self.formatted_exception = formatted_exception

    def __str__(self):
        class_name = self.exception.__class__.__name__
        return "{0}: {1}".format(class_name, self.message)


class DependencyLoop(DependencyError):
    pass


class MissingResource(DependencyError):
    pass


class RevisionNotFound(MissingResource):
    def __init__(self, datasources, rev_id=None, arg=None):
        super().__init__("Could not find revision ({0}:{1})"
                         .format(datasources, repr(rev_id)))


class UserNotFound(MissingResource):
     def __init__(self, datasources, user_text=None, arg=None):
         super().__init__("Could not find user account ({0}:{1})"
                          .format(datasources, repr(user_text)))


class PageNotFound(MissingResource):
     def __init__(self, datasources, page_id=None, arg=None):
         super().__init__("Could not find page ({0}:{1})"
                          .format(datasources, repr(page_id)))

<commit_msg>Adds formatted error message to the CaughtDependencyError error.<commit_after>"""
.. autoclass:: DependencyError

.. autoclass:: CaughtDependencyError

.. autoclass:: DependencyLoop

.. autoclass:: MissingResource

.. autoclass:: RevisionNotFound

.. autoclass:: PageNotFound

.. autoclass:: UserNotFound

.. autoclass:: UserDeleted

.. autoclass:: CommentDeleted

.. autoclass:: TextDeleted
"""


class DependencyError(RuntimeError):
    def __init__(self, message):
        super().__init__(message)
        self.message = message

    def __str__(self):
        return "{0}: {1}".format(self.__class__.__name__, self.message)


class CaughtDependencyError(DependencyError):

    def __init__(self, message, exception=None, tb=None,
                 formatted_exception=None):
        super().__init__(message)
        self.exception = exception
        self.tb = tb
        self.formatted_exception = formatted_exception

    def __str__(self):
        class_name = self.exception.__class__.__name__
        return "{0}: {1}\n{2}".format(class_name, self.message,
                                      self.formatted_exception)


class DependencyLoop(DependencyError):
    pass


class MissingResource(DependencyError):
    pass


class RevisionNotFound(MissingResource):
    def __init__(self, datasources, rev_id=None, arg=None):
        super().__init__("Could not find revision ({0}:{1})"
                         .format(datasources, repr(rev_id)))


class UserNotFound(MissingResource):
     def __init__(self, datasources, user_text=None, arg=None):
         super().__init__("Could not find user account ({0}:{1})"
                          .format(datasources, repr(user_text)))


class PageNotFound(MissingResource):
     def __init__(self, datasources, page_id=None, arg=None):
         super().__init__("Could not find page ({0}:{1})"
                          .format(datasources, repr(page_id)))


{'fraction_non_alphanumeric': 0.12135922330097088, 'fraction_numerical': 0.0056634304207119745, 'mean_word_length': 3.158071748878924, 'pattern_counts': {'":': 0, '<': 3, '<?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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7350874', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1026, 'n_words': 222}