<commit_before>"""Handles database connection, and all that fun stuff.
Adds a wrapper to pymongo.

@package ppbot

"""
from pymongo import mongo_client
from pymongo import database
from pymongo import collection

from settings import *

class ModuleMongoClient(mongo_client.MongoClient):
    def __getattr__(self, name):
        attr = super(ModuleMongoClient, self).__getattr__(name)
        if isinstance(attr, database.Database):
            return ModuleDatabase(self, name)
        return attr

class ModuleDatabase(database.Database):
    def __getattr__(self, name):
        attr = super(ModuleDatabase, self).__getattr__(name)
        if isinstance(attr, collection.Collection):
            return ModuleCollection(self, name)
        return attr

class ModuleCollection(collection.Collection):
    def __init__(self, database, name, create=False, **kwargs):
        _name = 'module_%s_%s' % (self.__class__.__name__, name)
        super(ModuleCollection, self).__init__(database=database,
            name=_name,
            create=create)

client = mongo_client.MongoClient(MONGO_HOST, MONGO_PORT)
db = client[MONGO_DB]
module_client = ModuleMongoClient(MONGO_HOST, MONGO_PORT)
module_db = module_client[MONGO_DB]
<commit_msg>Remove ModuleMongo stuff<commit_after>"""Handles database connection, and all that fun stuff.
Adds a wrapper to pymongo.

@package ppbot

"""
from pymongo import mongo_client

from settings import *

client = mongo_client.MongoClient(MONGO_HOST, MONGO_PORT)
db = client[MONGO_DB]

{'fraction_non_alphanumeric': 0.08773087071240106, 'fraction_numerical': 0.0, 'mean_word_length': 4.360424028268551, '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': '1226459', 'n_tokens_mistral': 457, 'n_tokens_neox': 448, 'n_words': 117}