<commit_before>from django.utils.module_loading import module_has_submodule
from django.utils.importlib import import_module
from celery.contrib.methods import task
from django.core.cache import cache
from django.conf import settings
from .loaders import ExcelLoader


default_queue = getattr(
    settings,
    'DRIFT_DEFAULT_QUEUE',
    'drift'
)


use_cache = getattr(
    settings,
    'DRIFT_IMPORTER_CACHE',
    True
)


not_implemented_error = 'Importer of type {type} does not implement {name}().'


importer_cache_key_format = 'django:importer:from_string:{0}'


class ImportFailure(Exception):
    """ Should be raised in order to indicate a failed import. """

    pass


class Importer(object):
    model = None

    app_label = None
    module_name = None

    queue = default_queue

    def match(self, instance):
        raise NotImplementedError(
            type=not_implemented_error.format(self.__class__.__name__),
            name='match')

    def process(self, instance, logger):
        raise NotImplementedError(
            type=not_implemented_error.format(self.__class__.__name__),
            name='process')<commit_msg>Fixed bugs in error reporting.<commit_after>from django.utils.module_loading import module_has_submodule
from django.utils.importlib import import_module
from celery.contrib.methods import task
from django.core.cache import cache
from django.conf import settings
from .loaders import ExcelLoader, CSVLoader


default_queue = getattr(
    settings,
    'DRIFT_DEFAULT_QUEUE',
    'drift'
)


use_cache = getattr(
    settings,
    'DRIFT_IMPORTER_CACHE',
    True
)


not_implemented_error = 'Importer of type {type} does not implement {name}().'


importer_cache_key_format = 'django:importer:from_string:{0}'


class ImportFailure(Exception):
    """ Should be raised in order to indicate a failed import. """

    pass


class Importer(object):
    model = None

    app_label = None
    module_name = None

    queue = default_queue

    def match(self, instance):
        raise NotImplementedError(not_implemented_error.format(
            type=self.__class__.__name__,
            name='match'
        ))

    def process(self, instance, logger):
        raise NotImplementedError(not_implemented_error.format(
            type=self.__class__.__name__,
            name='process'
        ))
{'fraction_non_alphanumeric': 0.08361774744027303, 'fraction_numerical': 0.0008532423208191126, 'mean_word_length': 3.4837476099426388, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3053459', 'n_tokens_mistral': 693, 'n_tokens_neox': 665, 'n_words': 170}