<commit_before>import sqlite3


class DBControl:
    def __init__(self, db_name=":memory:"):
        self.db_conn = sqlite3.connect(db_name)

    def create_tables(self):
        self.db_conn.execute("""CREATE TABLE IF NOT EXISTS Articles ("
                                    id INTEGER PRIMARY KEY AUTOINCREMENT,
                                    text TEXT,
                                    digest TEXT UNIQUE,
                                    updatedate TEXT)""")
        self.db_conn.execute("CREATE VIRTUAL TABLE Articles_fts USING fts4( words TEXT )")
        self.db_conn.commit()

    def close_connect(self):
        self.db_conn.close()<commit_msg>Fixed create_tables method bug and test pattern, and add _select_all method.<commit_after>import sqlite3


class DBControl:
    def __init__(self, db_name=":memory:"):
        self.db_conn = sqlite3.connect(db_name)

    def create_tables(self):
        c = self.db_conn.cursor()
        c.execute("""CREATE TABLE IF NOT EXISTS Articles (
                                    id INTEGER PRIMARY KEY AUTOINCREMENT,
                                    text TEXT,
                                    digest TEXT UNIQUE,
                                    updatedate TEXT)""")
        c.execute("CREATE VIRTUAL TABLE Articles_fts USING fts4( words TEXT )")
        self.db_conn.commit()

    def close_connect(self):
        self.db_conn.close()
        self.db_conn = None

    def _select_all(self, table_name):
        c = self.db_conn.cursor()
        c.execute("SELECT * FROM " + table_name)
        return c.fetchall()
{'fraction_non_alphanumeric': 0.08632640201638311, 'fraction_numerical': 0.003780718336483932, 'mean_word_length': 1.7006802721088434, 'pattern_counts': {'":': 2, '<': 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': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '605810', 'n_tokens_mistral': 460, 'n_tokens_neox': 424, 'n_words': 105}