<commit_before>import asyncio

from aioes import Elasticsearch
from muffin.plugins import BasePlugin


__version__ = "0.0.1"
__project__ = "muffin-elasticsearch"
__author__ = "<NAME> <<EMAIL>>"
__license__ = "MIT"


class Plugin(BasePlugin):

    """ Connect to ElasticSearch. """

    name = 'elasticsearch'
    defaults = {
        'endpoins': ['localhost:9200'],
    }

    def __init__(self, *args, **kwargs):
        """ Initialize the Plugin. """
        super().__init__(*args, **kwargs)
        self.conn = None

    def setup(self, app):
        """ Setup self. """
        super().setup(app)
        if not isinstace(list, self.cfg):
            raise TypeError('Invalid endpoints configuration format')

    @asyncio.coroutine
    def start(self, app):
        """ Connect to ElasticSearch. """
        self.conn = Elasticsearch(self.cfg.endpoins)

    def finish(self, app):
        """ Close self connections. """
        self.conn.close()

    def __getattr__(self, name):
        """ Proxy attribute to self connection. """
        return getattr(self.conn, name)<commit_msg>fix typo<commit_after>import asyncio

from aioes import Elasticsearch
from muffin.plugins import BasePlugin


__version__ = "0.0.1"
__project__ = "muffin-elasticsearch"
__author__ = "<NAME> <<EMAIL>>"
__license__ = "MIT"


class Plugin(BasePlugin):

    """ Connect to ElasticSearch. """

    name = 'elasticsearch'
    defaults = {
        'endpoints': ['localhost:9200'],
    }

    def __init__(self, *args, **kwargs):
        """ Initialize the Plugin. """
        super().__init__(*args, **kwargs)
        self.conn = None

    def setup(self, app):
        """ Setup self. """
        super().setup(app)
        if not isinstance(list, self.cfg.endpoints):
            raise TypeError('Invalid endpoints configuration format')

    @asyncio.coroutine
    def start(self, app):
        """ Connect to ElasticSearch. """
        self.conn = Elasticsearch(self.cfg.endpoints)

    def finish(self, app):
        """ Close self connections. """
        self.conn.close()

    def __getattr__(self, name):
        """ Proxy attribute to self connection. """
        return getattr(self.conn, name)
{'fraction_non_alphanumeric': 0.13756855575868374, 'fraction_numerical': 0.006398537477148081, 'mean_word_length': 2.729131175468484, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6503892', 'n_tokens_mistral': 662, 'n_tokens_neox': 640, 'n_words': 164}