<commit_before>from chatterbot.adapters import Adapter


class StorageAdapter(Adapter):
    """
    This is an abstract class that represents the interface
    that all storage adapters should implement.
    """

    def __init__(self, base_query=None, *args, **kwargs):
        super(StorageAdapter, self).__init__(**kwargs)

        self.kwargs = kwargs
        self.read_only = kwargs.get('read_only', False)
        self.default_empty_query = {}
        self.base_query = {}

    def generate_base_query(self, context):
        """
        
        """
        query = self.default_empty_query

        for Filter in context.filters:
            filter_instance = Filter()
            query = filter_instance.filter_selection(query, context)

        self.base_query = query

    def count(self):
        """
        Return the number of entries in the database.<commit_msg>Make query support for storage adapters optional.<commit_after>from chatterbot.adapters import Adapter


class StorageAdapter(Adapter):
    """
    This is an abstract class that represents the interface
    that all storage adapters should implement.
    """

    def __init__(self, base_query=None, *args, **kwargs):
        super(StorageAdapter, self).__init__(**kwargs)

        self.kwargs = kwargs
        self.read_only = kwargs.get('read_only', False)
        self.adapter_supports_queries = False

    def generate_base_query(self, chatterbot):
        """
        Create a base query for the storage adapter.
        """
        if self.adapter_supports_queries:
            for Filter in chatterbot.filters:
                filter_instance = Filter()
                self.base_query = filter_instance.filter_selection(
                    self.base_query, chatterbot
                )

    def count(self):
        """
        Return the number of entries in the database.
{'fraction_non_alphanumeric': 0.08490059108006448, 'fraction_numerical': 0.0, 'mean_word_length': 2.4040219378427787, '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': '5778809', 'n_tokens_mistral': 497, 'n_tokens_neox': 474, 'n_words': 134}