<commit_before>from app import flask_app
from app.models import kaizen_user, mapping
from flask import g, render_template, redirect, flash, url_for
from flask.ext.login import login_required


@flask_app.route('/me', endpoint='me')
@login_required
def wtf():
    mappings = view_mappings(g.user)
    allmaps = summarize_maps(mappings)
    allmaps['notes'] = view_notes(g.user, 5)
    return render_template('user_profile.html', user=g.user, mappings=mappings, allmaps=allmaps)

@flask_app.route('/user/<name>')
@login_required
def user_profile(name):
    if g.user and g.user.name == name:
        return redirect(url_for('user_profile_owner'))

    viewed = kaizen_user.user_with_name(name)
    if viewed:
        return render_template('user_profile.html', user=viewed, mappings=view_mappings(viewed), notes=view_notes(viewed, 5))
    flash('No user with name %s, should have 404ed' % name)
    #TODO return no user with name 404 page

def view_mappings(u):<commit_msg>user_profile: changed back a function name that i was testing<commit_after>from app import flask_app
from app.models import kaizen_user, mapping
from flask import g, render_template, redirect, flash, url_for
from flask.ext.login import login_required


@flask_app.route('/me', endpoint='me')
@login_required
def owner_profile():
    mappings = view_mappings(g.user)
    allmaps = summarize_maps(mappings)
    allmaps['notes'] = view_notes(g.user, 5)
    return render_template('user_profile.html', user=g.user, mappings=mappings, allmaps=allmaps)

@flask_app.route('/user/<name>')
@login_required
def user_profile(name):
    if g.user and g.user.name == name:
        return redirect(url_for('user_profile_owner'))

    viewed = kaizen_user.user_with_name(name)
    if viewed:
        return render_template('user_profile.html', user=viewed, mappings=view_mappings(viewed), notes=view_notes(viewed, 5))
    flash('No user with name %s, should have 404ed' % name)
    #TODO return no user with name 404 page

def view_mappings(u):
{'fraction_non_alphanumeric': 0.1125, 'fraction_numerical': 0.008, 'mean_word_length': 5.175925925925926, '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': '4713687', 'n_tokens_mistral': 676, 'n_tokens_neox': 645, 'n_words': 164}