<commit_before>from random import choice
from tinydb import TinyDB


class Data:

    db = TinyDB('db.json')

    def grow_pair(self):
        """ Pick a random capital and country pair from db """
        pair_dict = choice(self.db.all())
        country = pair_dict.get('country')
        capital = pair_dict.get('capital')
        return country, capital

    def countries(self):
        """ Assign the country to correct_answer and the capital to hint """
        correct_answer, hint = self.grow_pair()
        return correct_answer, hint

    def capitals(self):
        """ Assign the country to hint and the capital to correct_answer """
        hint, correct_answer = self.grow_pair()
        return correct_answer, hint




# get a country and a capital from the db
# sort based on quiz type
# return them


<commit_msg>now passing a kind variable to data class to get correct data set<commit_after>from random import choice
from tinydb import TinyDB


class Data:

    db = TinyDB('db.json')

    def __init__(self):
        """ Pick a random capital and country pair from db """
        pair_dict = choice(self.db.all())
        self.country = pair_dict.get('country')
        self.capital = pair_dict.get('capital')

    @property
    def capitals(self):
        ans = self.capital
        hint = self.country
        return ans, hint

    @property
    def countries(self):
        ans = self.country
        hint = self.capital
        return ans, hint

    def gimmie(self, kind):
        if kind == 'capitals':
            return self.capitals
        elif kind == 'countries':
            return self.countries
        else:
            ValueError("Not a valid kind of quiz.")
{'fraction_non_alphanumeric': 0.08967551622418879, 'fraction_numerical': 0.0, 'mean_word_length': 2.365079365079365, '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': '1381149', 'n_tokens_mistral': 477, 'n_tokens_neox': 451, 'n_words': 165}