<commit_before>from flask import render_template, request, session, flash
from project.database import db_session
from project.models import Phone
import project.utils.twilioutil
import random
from project.models import User, Alias
from project.database import db_session

def account_view():
    if "username" not in session:
        return redirect("/")
    return render_template("account.html", phones=Phone.query.filter(Phone.uid == session["user_id"]).all())

def add_phone():
    if "username" not in session:
        return redirect("/")
    phone = request.form["phone"]
    code = str(random.randint(0, 1000000)).zfill(6)
    project.utils.twilioutil.send_text(phone, "Your queri confirmation code is %s" % code)
    phon = Phone(session["user_id"], phone, code)
    db_session.add(phon)
    db_session.commit()
    flash("Check your phone for a confirmation code.", "success")
    return render_template("account.html")

def confirm_phone():
    if "username" not in session:
        return redirect("/")
    phone = request.form["phone"]
    code = request.form["code"]
    phon = Phone.query.filter(Phone.phone_number == phone and Phone.confirmation == code).first()
    if phon is None:
        flash("No phone found.", "danger")
        return render_template("account.html")
    phon.is_confirmed = True
    db_session.commit()
    flash("Phone <!-- illuminati --> confirmed.", "success")
    return render_template("account.html")

def delete_phone(pid):
    if "username" not in session:
        return redirect("/")
    phon = Phone.query.filter(Phone.pid == pid).first()
    if phon.uid != session["user_id"]:
        flash("Haha, no", "danger")
        return redirect("/")
    else:
        db_session.delete(phon)
        db_session.commit()
    flash("Phone deleted.", "success")
    return render_template("account.html")

def aliases():
    if "username" not in session:
        return redirect("/")
    aliaslist = [(i._from, i.to) for i in Alias.query.filter(Alias.uid == session["user_id"]).all()]
    return render_template("alias.html", aliases=aliaslist)<commit_msg>i did a stuped<commit_after>from flask import render_template, request, session, flash
from project.database import db_session
from project.models import Phone
import project.utils.twilioutil
import random
from project.models import User, Alias
from project.database import db_session

def account_view():
    if "username" not in session:
        return redirect("/")
    return render_template("account.html", phones=Phone.query.filter(Phone.uid == session["user_id"]).all())

def add_phone():
    if "username" not in session:
        return redirect("/")
    phone = request.form["phone"]
    code = str(random.randint(0, 1000000)).zfill(6)
    project.utils.twilioutil.send_text(phone, "Your queri confirmation code is %s" % code)
    phon = Phone(session["user_id"], phone, code)
    db_session.add(phon)
    db_session.commit()
    flash("Check your phone for a confirmation code.", "success")
    return render_template("account.html")

def confirm_phone():
    if "username" not in session:
        return redirect("/")
    phone = request.form["phone"]
    code = request.form["code"]
    phon = Phone.query.filter(Phone.phone_number == phone and Phone.confirmation == code).first()
    if phon is None:
        flash("No phone found.", "danger")
        return render_template("account.html")
    phon.is_confirmed = True
    db_session.commit()
    flash("Phone <!-- illuminati --> confirmed.", "success")
    return render_template("account.html")

def delete_phone(pid):
    if "username" not in session:
        return redirect("/")
    phon = Phone.query.filter(Phone.pid == pid).first()
    if phon.uid != session["user_id"]:
        flash("Haha, no", "danger")
        return redirect("/")
    else:
        db_session.delete(phon)
        db_session.commit()
    flash("Phone deleted.", "success")
    return redirect("/account/")

def aliases():
    if "username" not in session:
        return redirect("/")
    aliaslist = [(i._from, i.to) for i in Alias.query.filter(Alias.uid == session["user_id"]).all()]
    return render_template("alias.html", aliases=aliaslist)
{'fraction_non_alphanumeric': 0.13828516837831384, 'fraction_numerical': 0.0042990207786004295, 'mean_word_length': 3.61742006615215, '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': '1518089', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1205, 'n_words': 332}