<commit_before>class PluginMeta(type):

    """ Ensure that each plugin is singleton. """

    _instances = {}

    def __call__(cls, *args, **kwargs):
        if cls not in cls._instances:
            cls._instances[cls] = super(PluginMeta, cls).__call__(*args, **kwargs)
        return cls._instances[cls]


class BasePlugin(metaclass=PluginMeta):

    """ Implement base plugin functionality. """

    name = 'base'
    defaults = {}

    def __init__(self, **options):
        self.app = None
        self.options = options

    def setup(self, app):
        """ Initialize the application. """
        self.app = app
        for key in self.defaults:<commit_msg>Implement a Plugin Exception<commit_after>class PluginException(Exception):

    """ Implement any exception in plugins. """


class PluginMeta(type):

    """ Ensure that each plugin is singleton. """

    _instances = {}

    def __call__(cls, *args, **kwargs):
        if cls not in cls._instances:
            cls._instances[cls] = super(PluginMeta, cls).__call__(*args, **kwargs)
        return cls._instances[cls]


class BasePlugin(metaclass=PluginMeta):

    """ Implement base plugin functionality. """

    name = 'base'
    defaults = {}

    def __init__(self, **options):
        self.app = None
        self.options = options

    def setup(self, app):
        """ Initialize the application. """
        self.app = app
        for key in self.defaults:
{'fraction_non_alphanumeric': 0.12552301255230125, 'fraction_numerical': 0.0, 'mean_word_length': 2.6513994910941476, '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': '1522465', 'n_tokens_mistral': 416, 'n_tokens_neox': 405, 'n_words': 113}