<commit_before><commit_msg>created mock sql driver (resolves #24)<commit_after># -*- coding: utf-8 -*-
"""
A mock database driver module.
"""


class MockConnection(object):
    """
    A mock Connection object.

    :param \**kwargs: Accepts anything.
    """

    def __init__(self, **kwargs):
        self.kwargs = kwargs

        # Used to determine if the connection is "open" or not.
        self.open = True

    def close(self):
        """
        "Closes" the connection.
        """
        self.open = False

    def cursor(self):
        """
        Returns a mock Cursor object.
        """
        return MockCursor(self)


class MockCursor(object):
    """
    A mock Cursor object.

    :param MockConnection connection: A MockConnection object.
    """

    def __init__(self, connection):
        self.connection = connection

    def close(self):
        """
        "Closes" the cursor.
        """
        self.connection = None


def connect(**kwargs):
    """
    Returns a mock Connection object.

    :param \**kwargs: Accepts anything, which is passed to the Connection
                      object.
    """
    return MockConnection(**kwargs)
{'fraction_non_alphanumeric': 0.1170940170940171, 'fraction_numerical': 0.002564102564102564, 'mean_word_length': 2.0654450261780104, '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': '2080887', 'n_tokens_mistral': 325, 'n_tokens_neox': 306, 'n_words': 100}