<commit_before>from flask import render_template, request
from . import main
from ..models import Resource
import json


@main.route('/')
def index():
    return render_template('main/index.html')


@main.route('/get-resources')
def get_resources():
    resources = Resource.query.all()
    resources_as_dicts = Resource.get_resources_as_dicts(resources)
    return json.dumps(resources_as_dicts)


@main.route('/get-associations/<int:resource_id>')
def get_associations(resource_id):
    resource = Resource.query.get(resource_id)
    associations = {}
    if resource is None: return json.dumps(associations)
    for descriptor in resource.text_descriptors:
        associations[descriptor.descriptor.name] = descriptor.text
    for descriptor in resource.option_descriptors:
        associations[descriptor.descriptor.name] = descriptor.descriptor.values[
            descriptor.option]
    return json.dumps(associations)

<commit_msg>small style fix<commit_after>from flask import render_template
from . import main
from ..models import Resource
import json


@main.route('/')
def index():
    return render_template('main/index.html')


@main.route('/get-resources')
def get_resources():
    resources = Resource.query.all()
    resources_as_dicts = Resource.get_resources_as_dicts(resources)
    return json.dumps(resources_as_dicts)


@main.route('/get-associations/<int:resource_id>')
def get_associations(resource_id):
    resource = Resource.query.get(resource_id)
    associations = {}
    if resource is None:
        return json.dumps(associations)
    for td in resource.text_descriptors:
        associations[td.descriptor.name] = td.text
    for od in resource.option_descriptors:
        associations[od.descriptor.name] = od.descriptor.values[od.option]
    return json.dumps(associations)

{'fraction_non_alphanumeric': 0.10558319513543395, 'fraction_numerical': 0.0, 'mean_word_length': 4.386904761904762, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2176570', 'n_tokens_mistral': 526, 'n_tokens_neox': 527, 'n_words': 110}