<commit_before># -*- coding: utf-8 -*-
"""A module for opsdroid to allow persist in mongo database."""
import logging
from motor.motor_asyncio import AsyncIOMotorClient

from opsdroid.database import Database


class DatabaseMongo(Database):
    """A module for opsdroid to allow memory to persist in a mongo database.

    Attributes:

    """

    def __init__(self, config, opsdroid=None):
        """Create the connection.

        Set some basic properties from the database config such as the name
        of this database.

        Attributes:
            config (dict): The config for this database specified in the
                           `configuration.yaml` file.

        """
        super().__init__(config, opsdroid=opsdroid)
        logging.debug("Loaded mongo database connector")
        self.name = "mongo"
        self.config = config
        self.client = None
        self.database = None

    async def connect(self):
        """Connect to the database."""
        host = self.config["host"] if "host" in self.config else "localhost"
        port = self.config["port"] if "port" in self.config else "27017"
        database = self.config["database"] if "database" in self.config else "opsdroid"
        path = "mongodb://" + host + ":" + port
        self.client = AsyncIOMotorClient(path)
        self.database = self.client[database]<commit_msg>Remove unused Attributes from Mongodb docstrings (#1028)<commit_after># -*- coding: utf-8 -*-
"""A module for opsdroid to allow persist in mongo database."""
import logging
from motor.motor_asyncio import AsyncIOMotorClient

from opsdroid.database import Database


class DatabaseMongo(Database):
    """A module for opsdroid to allow memory to persist in a mongo database."""

    def __init__(self, config, opsdroid=None):
        """Create the connection.

        Set some basic properties from the database config such as the name
        of this database.

        Attributes:
            config (dict): The config for this database specified in the
                           `configuration.yaml` file.

        """
        super().__init__(config, opsdroid=opsdroid)
        logging.debug("Loaded mongo database connector")
        self.name = "mongo"
        self.config = config
        self.client = None
        self.database = None

    async def connect(self):
        """Connect to the database."""
        host = self.config["host"] if "host" in self.config else "localhost"
        port = self.config["port"] if "port" in self.config else "27017"
        database = self.config["database"] if "database" in self.config else "opsdroid"
        path = "mongodb://" + host + ":" + port
        self.client = AsyncIOMotorClient(path)
        self.database = self.client[database]
{'fraction_non_alphanumeric': 0.1020260492040521, 'fraction_numerical': 0.005788712011577424, 'mean_word_length': 2.5862516212710767, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2746078', 'n_tokens_mistral': 758, 'n_tokens_neox': 715, 'n_words': 258}