<commit_before>import json
import logging

from flask import abort
from flask import Blueprint
from flask import render_template

from pajbot.managers import DBManager
from pajbot.managers.redis import RedisManager
from pajbot.models.emote import Emote
from pajbot.streamhelper import StreamHelper
from pajbot.web.utils import nocache

page = Blueprint('clr', __name__, url_prefix='/clr')
config = None

log = logging.getLogger('pajbot')


@page.route('/overlay/<widget_id>')
@page.route('/overlay/<widget_id>/<random_shit>')
@nocache
def overlay(widget_id, **options):
    return render_template('clr/overlay.html',
            widget={})


@page.route('/donations/<widget_id>')
@page.route('/donations/<widget_id>/<random_shit>')
@nocache
def donations(widget_id, **options):
    redis = RedisManager.get()
    widget = redis.hget(
            '{streamer}:clr:donations'.format(streamer=StreamHelper.get_streamer()),
            widget_id)
    if widget is None:
        abort(404)

    tts_authentication = ''
    if 'extra' in config:
        tts_authentication = config['extra'].get('tts_authentication', '')

    with DBManager.create_session_scope() as db_session:
        emotes = db_session.query(Emote).all()
        return render_template('clr/donations.html',
                widget=json.loads(widget),
                emotes=emotes,
                tts_authentication=tts_authentication)
<commit_msg>No longer fetch "unused emotes" to the donation clr<commit_after>import json
import logging

from flask import abort
from flask import Blueprint
from flask import render_template

from pajbot.managers import DBManager
from pajbot.managers.redis import RedisManager
from pajbot.models.emote import Emote
from pajbot.models.emote import EmoteStats
from pajbot.streamhelper import StreamHelper
from pajbot.web.utils import nocache

page = Blueprint('clr', __name__, url_prefix='/clr')
config = None

log = logging.getLogger('pajbot')


@page.route('/overlay/<widget_id>')
@page.route('/overlay/<widget_id>/<random_shit>')
@nocache
def overlay(widget_id, **options):
    return render_template('clr/overlay.html',
            widget={})


@page.route('/donations/<widget_id>')
@page.route('/donations/<widget_id>/<random_shit>')
@nocache
def donations(widget_id, **options):
    redis = RedisManager.get()
    widget = redis.hget(
            '{streamer}:clr:donations'.format(streamer=StreamHelper.get_streamer()),
            widget_id)
    if widget is None:
        abort(404)

    tts_authentication = ''
    if 'extra' in config:
        tts_authentication = config['extra'].get('tts_authentication', '')

    with DBManager.create_session_scope() as db_session:
        emotes = db_session.query(Emote).join(EmoteStats).all()
        return render_template('clr/donations.html',
                widget=json.loads(widget),
                emotes=emotes,
                tts_authentication=tts_authentication)

{'fraction_non_alphanumeric': 0.1179890560875513, 'fraction_numerical': 0.002051983584131327, 'mean_word_length': 3.9242424242424243, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '1518020', 'n_tokens_mistral': 938, 'n_tokens_neox': 917, 'n_words': 188}