<commit_before>"""
DTrove Datastore Base Classes
=============================

The base classes that define the interface for all datastores.

If you wish to create your own datastore, simply subclass the base and
override the methods you need to for example::

    from dtrove.datastores import base
    from dtrove.commands import run

    class MyBackyardDBManager(base.BaseManager):

        def backup():
            with self.conn as connection:
                run('/bin/bash my_backup.sh')

        @property
        def name():
            return 'ClassNameOverriddenDB'

Templates for the managers live in `dtrove/datastores/<manager_name>` where
manager name by default is the lowercase manager name with the 'Manager'
removed. For example 'MySQLManager' would be 'mysql'.

More on templates later.

"""

from cStringIO import StringIO


class BaseManager(object):
    """Manager Base

    :param datastore: The actual datastore version that is being managed.
                      The datastores have the image and package information to
                      install on the guest vm's.
    """

    def __init__(self, datastore):
        """Creates a Manager"""
        self.datastore = datastore
        self.image = datastore.image
        self.packages = datastore.packages

    @property
    def name(self):
        """Returns the name of the manager ex: MySQLManager = mysql"""
        return self.__class__.__name__.replace('Manager', '').lower()

    def backup():
        """Preform a backup on the remote instance."""<commit_msg>Adding a prepare call to the base datastore<commit_after>"""
DTrove Datastore Base Classes
=============================

The base classes that define the interface for all datastores.

If you wish to create your own datastore, simply subclass the base and
override the methods you need to for example::

    from dtrove.datastores import base
    from dtrove.commands import run

    class MyBackyardDBManager(base.BaseManager):

        def backup():
            with self.conn as connection:
                run('/bin/bash my_backup.sh')

        @property
        def name():
            return 'ClassNameOverriddenDB'

Templates for the managers live in `dtrove/datastores/<manager_name>` where
manager name by default is the lowercase manager name with the 'Manager'
removed. For example 'MySQLManager' would be 'mysql'.

More on templates later.

"""

from cStringIO import StringIO


class BaseManager(object):
    """Manager Base

    :param datastore: The actual datastore version that is being managed.
                      The datastores have the image and package information to
                      install on the guest vm's.
    """

    def __init__(self, datastore):
        """Creates a Manager"""
        self.datastore = datastore
        self.image = datastore.image
        self.packages = datastore.packages

    @property
    def name(self):
        """Returns the name of the manager ex: MySQLManager = mysql"""
        return self.__class__.__name__.replace('Manager', '').lower()

    def backup():
        """Preform a backup on the remote instance."""
        raise NotImplementedError()

    def prepare():
        """Install and configure the datastore on the instance."""
        raise NotImplementedError()
{'fraction_non_alphanumeric': 0.09413908290312785, 'fraction_numerical': 0.0, 'mean_word_length': 2.786206896551724, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3917495', 'n_tokens_mistral': 869, 'n_tokens_neox': 822, 'n_words': 336}