<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from decorators import on_command
from slackutils import cat_token, isNumber, get_nickname
from time import localtime, strftime
from subprocess import check_output
import os
import re
import json
import time
import urllib
import random
import imp
settings = imp.load_source('settings', './settings.py')
WEB_API_TOKEN = settings.WEB_API_TOKEN
CACHE_DEFAULT_URL = './apps/quiz_cache/'
CACHE_CATEGORY_URL = './apps/quiz_cache/category'


def getRandomQuestion(channel):
    infoFile = CACHE_DEFAULT_URL + channel + '.json'
    cdat = json.loads(open(infoFile).read())
    quizRaw = open(CACHE_CATEGORY_URL + cdat['category'] + '.json').read()
    qdat = json.loads(quizRaw)
    cdat['solved'].append(cdat['q_num'])
    rand_num = random.randrange(0, qdat['q_num'])
    while rand_num + 1 in chan_info['solved']:
        rand_num = random.randrange(0, qdat['q_num'])
    question = qdat['question'][rand_num]
    answer = qdat['answer'][rand_num]
    cdat['last_solved'] = int(round(time.time() * 1000))
    cdat['q_num'] = rand_num + 1
    cdat['question'] = question
    cdat['answer'] = answer
    cdat['skip_count'] = []
    cdat['give_up'] = []
    with open(infoFile, 'w') as fp:
        json.dump(cdat, fp, indent=4)
<commit_msg>Typo Error, either T_T<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from decorators import on_command
from slackutils import cat_token, isNumber, get_nickname
from time import localtime, strftime
from subprocess import check_output
import os
import re
import json
import time
import urllib
import random
import imp
settings = imp.load_source('settings', './settings.py')
WEB_API_TOKEN = settings.WEB_API_TOKEN
CACHE_DEFAULT_URL = './apps/quiz_cache/'
CACHE_CATEGORY_URL = './apps/quiz_cache/category/'


def getRandomQuestion(channel):
    infoFile = CACHE_DEFAULT_URL + channel + '.json'
    cdat = json.loads(open(infoFile).read())
    quizRaw = open(CACHE_CATEGORY_URL + cdat['category'] + '.json').read()
    qdat = json.loads(quizRaw)
    cdat['solved'].append(cdat['q_num'])
    rand_num = random.randrange(0, qdat['q_num'])
    while rand_num + 1 in chan_info['solved']:
        rand_num = random.randrange(0, qdat['q_num'])
    question = qdat['question'][rand_num]
    answer = qdat['answer'][rand_num]
    cdat['last_solved'] = int(round(time.time() * 1000))
    cdat['q_num'] = rand_num + 1
    cdat['question'] = question
    cdat['answer'] = answer
    cdat['skip_count'] = []
    cdat['give_up'] = []
    with open(infoFile, 'w') as fp:
        json.dump(cdat, fp, indent=4)

{'fraction_non_alphanumeric': 0.1405775075987842, 'fraction_numerical': 0.007598784194528876, 'mean_word_length': 4.451345755693581, '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': '47482', 'n_tokens_mistral': 926, 'n_tokens_neox': 913, 'n_words': 201}