<commit_before>from flask import render_template
from flask import Response
from . import main
import json
from ..models import User


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


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


@main.route('/search/<query>')
def search_query(query):
    looking_for = "%"+query+"%"
    users = User.query.filter((User.first_name.ilike(looking_for)) |
                              User.last_name.ilike(looking_for))\
        .order_by(User.first_name).all()
    data = dict()
    data["results"] = []
    for u in users:
        data["results"].append({
            "title": u.full_name,
            "url": "/optional/url/on/click"
        })
    json_data = json.dumps(data)
    return Response(response=json_data, status=200,
                    mimetype="application/json")<commit_msg>List comprehension :)<commit_after>from flask import render_template
from flask import Response
from . import main
import json
from ..models import User


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


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


@main.route('/search/<query>')
def search_query(query):
    looking_for = "%"+query+"%"
    users = User.query.filter((User.first_name.ilike(looking_for)) |
                              User.last_name.ilike(looking_for))\
        .order_by(User.first_name).all()
    data = dict()
    data['results'] = [{'title': u.full_name,
                        'url': '/account/profile/' + u.id} for u in users]
    '''data["results"] = []
    for u in users:
        data["results"].append({
            "title": u.full_name,
            "url": "/optional/url/on/click"
        })'''
    json_data = json.dumps(data)
    return Response(response=json_data, status=200,
                    mimetype="application/json")
{'fraction_non_alphanumeric': 0.1540864133263925, 'fraction_numerical': 0.0031233732431025507, 'mean_word_length': 2.7248062015503876, 'pattern_counts': {'":': 4, '<': 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': '4355447', 'n_tokens_mistral': 596, 'n_tokens_neox': 573, 'n_words': 119}