<commit_before>from psyion.ext.database import SQLiteResource

def create_backend(server, id, label, database, **kw):
    if server == 'sqlite3':
        return create_sqlite3_backend(id, label, database, **kw)


def create_sqlite3_backend(id, label, database, min=None, max=None, name=None):
    """
    Backend factory for creating database pools.
    """
    class DBResource(SQLiteResource):
        meta = {
                'id': id,
                'label': label,
                'min': min,
                'max' : max,
                'conn_args': {'database': database},
                'auto_initialize': True
            }
    return DBResource


class DBViewer(SQLiteResource):
    meta = {
            'id': 'db_viewer',
            'label': 'Database Viewer Pool',
            'min': 4,
            'max': 8
            }

<commit_msg>clean up<commit_after>from psyion.ext.database import SQLiteResource

def create_backend(server, id, label, database, **kw):
    if server == 'sqlite3':
        return create_sqlite3_backend(id, label, database, **kw)
    elif server == 'postgres':
        raise NotImplementedError


def create_sqlite3_backend(id, label, database, min=None, max=None, name=None):
    """
    Backend factory for creating database pools with the sqlite3 database.
    """
    class DBResource(SQLiteResource):
        meta = {
                'id': id,
                'label': label,
                'min': min,
                'max' : max,
                'conn_args': {'database': database},
                'auto_initialize': True
            }
    return DBResource


def create_postgresql_backend(id, label, database, min=None, max=None):
    """
    Backend factory for creating database pools with the postgresql database.
    """
    class DBResource(PgSQLResource):
        meta = {
                'id': id,
                'label': label,
                'min': min,
                'max' : max,
                'conn_args': {'database': database},
                'auto_initialize': True
            }
    return DBResource


{'fraction_non_alphanumeric': 0.1138996138996139, 'fraction_numerical': 0.004343629343629344, 'mean_word_length': 1.9321074964639322, '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': '898115', 'n_tokens_mistral': 597, 'n_tokens_neox': 567, 'n_words': 155}