<commit_before>from django.db import connection


class ProsodyDatastore:
    @staticmethod
    def get_data_store(username, domain, store):
        data = {}
        with connection.cursor() as cursor:
            cursor.execute(
                    'SELECT key, value FROM prosody.prosody WHERE UPPER("user")=UPPER(%s) AND UPPER(host)=UPPER(%s) AND store=%s',
                    [username, domain, store]
                    )

            data = dict(cursor.fetchall())

        return data
<commit_msg>New get_data_value method in Prosody backend<commit_after>from django.db import connection


class ProsodyDatastore:
    @staticmethod
    def get_data_store(username, domain, store):
        data = {}
        with connection.cursor() as cursor:
            cursor.execute(
                    'SELECT key, value FROM prosody.prosody WHERE UPPER("user")=UPPER(%s) AND UPPER(host)=UPPER(%s) AND store=%s',
                    [username, domain, store]
                    )

            data = dict(cursor.fetchall())

        return data

    @staticmethod
    def get_data_value(username, domain, store, key):
        try:
            data = get_data_store(username, domain, store)[key]
        except KeyError:
            data = None

        return data

{'fraction_non_alphanumeric': 0.09565217391304348, 'fraction_numerical': 0.0, 'mean_word_length': 2.0802919708029197, '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': '7127997', 'n_tokens_mistral': 355, 'n_tokens_neox': 345, 'n_words': 92}