<commit_before>import logging
import traceback


class ErrorMixin(object):
    def get_startup_errors(self):
        if hasattr(self, "_startup_errors"):
            return self._startup_errors
        return []

    def add_startup_error(self, error_message):
        if not hasattr(self, "_startup_errors"):
            self._startup_errors = []
        self._startup_errors.append(error_message)

    def startup_error(self, error_message, exception_instance):
        traceback.print_exc()
        error_message = "%s%s" % (
            error_message,
            ":\n\n%s\nContinuing...\n" % traceback.format_exc(exception_instance)
        )
        self.add_startup_error(error_message)
        logging.critical(error_message)

    def runtime_error(self, error_message):
        logging.critical(error_message)
<commit_msg>unnecessary to pass exception instance into format_exc, and it causes problems in python3<commit_after>import logging
import traceback


class ErrorMixin(object):
    def get_startup_errors(self):
        if hasattr(self, "_startup_errors"):
            return self._startup_errors
        return []

    def add_startup_error(self, error_message):
        if not hasattr(self, "_startup_errors"):
            self._startup_errors = []
        self._startup_errors.append(error_message)

    def startup_error(self, error_message, exception_instance):
        traceback.print_exc()
        error_message = "%s%s" % (
            error_message,
            ":\n\n%s\nContinuing...\n" % traceback.format_exc()
        )
        self.add_startup_error(error_message)
        logging.critical(error_message)

    def runtime_error(self, error_message):
        logging.critical(error_message)

{'fraction_non_alphanumeric': 0.09476744186046511, 'fraction_numerical': 0.0005813953488372093, 'mean_word_length': 2.9382151029748282, 'pattern_counts': {'":': 2, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3587098', 'n_tokens_mistral': 514, 'n_tokens_neox': 503, 'n_words': 90}