<commit_before>from flask import render_template, request, url_for, redirect, flash
from sqlalchemy import exc
from app import app, db
from minecraft_query import MinecraftQuery
from vmail import testmail, SignupAlert
from forms import SignupForm
from models import User
from traceback import format_exc
from fishexc import FishbansException
import fishstats

@app.route('/')
def index():
    NUMSERVERS = len(app.config['MCSERVERS'])

    return render_template('index.html',
            NUMSERVERS=NUMSERVERS)

@app.route('/dash')
def dash():
    NUMSERVERS = len(app.config['MCSERVERS'])

    return render_template('dash.html',
            NUMSERVERS=NUMSERVERS)

@app.route('/donate')
def about():
    return render_template('donate.html')

@app.route('/dynmap')
def dynmap():
    return render_template('dynmap.html')

@app.route('/forum')
def forum():
    return render_template('forum.html',
            SITE_TITLE='Voltaire')

@app.route('/mcstatus/<MCSERVER_ADDR/', defaults={'MCSERVER_PORT': 25565})
@app.route('/mcstatus/<MCSERVER_ADDR>/<int:MCSERVER_PORT>')
def return_mcstatus(MCSERVER_ADDR, MCSERVER_PORT):
    get_status = MinecraftQuery(MCSERVER_ADDR,MCSERVER_PORT).get_rules()
    return render_template('mcstatus.html', 
            get_status = get_status)

@app.route("/signup", methods = ['GET', 'POST'])
def signup():
    form = SignupForm(request.form)
    applicant_ip = request.environ.get('REMOTE_ADDR')
    if request.method == 'POST' and form.validate():
        user = User(form.mcuser.data,
                    form.mcemail.data,
                    form.applicant_age.data,
                    form.applicant_skills.data,
                    applicant_ip,
                    fishstats.Player(form.mcuser.data).hasBeenBanned())

        db.session.add(user)

        try:
            db.session.commit()
            tb = format_exc()
            SignupAlert(form.mcuser.data,
                        form.mcemail.data,
                        form.applicant_age.data,
                        form.applicant_skills.data,
                        applicant_ip,
                        fishstats.Player(form.mcuser.data).hasBeenBanned(),
                        tb)

        except exc.IntegrityError:
            tb = format_exc()
            SignupAlert(form.mcuser.data,
                        form.mcemail.data,
                        form.applicant_age.data,
                        form.applicant_skills.data,
                        applicant_ip,
                        fishstats.Player(form.mcuser.data).hasBeenBanned(),
                        tb)
            flash('Oh no! It looks like there\'s something wrong with your information. Admins have been contacted.', 'error')
            return redirect(url_for('signup'))

        else:
            flash('Thanks for signing up. Please check your email for a response soon!', 'success')
            return redirect(url_for('signup'))

    return render_template('signup.html',
            form = form)

@app.errorhandler(403)
def page_forbidden(e):
    return render_template('errorpage.html', error_code='403'), 403

@app.errorhandler(404)
def page_not_found(e):
    return render_template('errorpage.html', error_code='404'), 404

@app.errorhandler(500)
def internal_server_error(e):
    return render_template('errorpage.html', error_code='500'), 500 

<commit_msg>missing ><commit_after>from flask import render_template, request, url_for, redirect, flash
from sqlalchemy import exc
from app import app, db
from minecraft_query import MinecraftQuery
from vmail import testmail, SignupAlert
from forms import SignupForm
from models import User
from traceback import format_exc
from fishexc import FishbansException
import fishstats

@app.route('/')
def index():
    NUMSERVERS = len(app.config['MCSERVERS'])

    return render_template('index.html',
            NUMSERVERS=NUMSERVERS)

@app.route('/dash')
def dash():
    NUMSERVERS = len(app.config['MCSERVERS'])

    return render_template('dash.html',
            NUMSERVERS=NUMSERVERS)

@app.route('/donate')
def about():
    return render_template('donate.html')

@app.route('/dynmap')
def dynmap():
    return render_template('dynmap.html')

@app.route('/forum')
def forum():
    return render_template('forum.html',
            SITE_TITLE='Voltaire')

@app.route('/mcstatus/<MCSERVER_ADDR>/', defaults={'MCSERVER_PORT': 25565})
@app.route('/mcstatus/<MCSERVER_ADDR>/<int:MCSERVER_PORT>')
def return_mcstatus(MCSERVER_ADDR, MCSERVER_PORT):
    get_status = MinecraftQuery(MCSERVER_ADDR,MCSERVER_PORT).get_rules()
    return render_template('mcstatus.html', 
            get_status = get_status)

@app.route("/signup", methods = ['GET', 'POST'])
def signup():
    form = SignupForm(request.form)
    applicant_ip = request.environ.get('REMOTE_ADDR')
    if request.method == 'POST' and form.validate():
        user = User(form.mcuser.data,
                    form.mcemail.data,
                    form.applicant_age.data,
                    form.applicant_skills.data,
                    applicant_ip,
                    fishstats.Player(form.mcuser.data).hasBeenBanned())

        db.session.add(user)

        try:
            db.session.commit()
            tb = format_exc()
            SignupAlert(form.mcuser.data,
                        form.mcemail.data,
                        form.applicant_age.data,
                        form.applicant_skills.data,
                        applicant_ip,
                        fishstats.Player(form.mcuser.data).hasBeenBanned(),
                        tb)

        except exc.IntegrityError:
            tb = format_exc()
            SignupAlert(form.mcuser.data,
                        form.mcemail.data,
                        form.applicant_age.data,
                        form.applicant_skills.data,
                        applicant_ip,
                        fishstats.Player(form.mcuser.data).hasBeenBanned(),
                        tb)
            flash('Oh no! It looks like there\'s something wrong with your information. Admins have been contacted.', 'error')
            return redirect(url_for('signup'))

        else:
            flash('Thanks for signing up. Please check your email for a response soon!', 'success')
            return redirect(url_for('signup'))

    return render_template('signup.html',
            form = form)

@app.errorhandler(403)
def page_forbidden(e):
    return render_template('errorpage.html', error_code='403'), 403

@app.errorhandler(404)
def page_not_found(e):
    return render_template('errorpage.html', error_code='404'), 404

@app.errorhandler(500)
def internal_server_error(e):
    return render_template('errorpage.html', error_code='500'), 500 


{'fraction_non_alphanumeric': 0.11261730969760167, 'fraction_numerical': 0.00953374050350067, 'mean_word_length': 2.4537037037037037, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2674422', 'n_tokens_mistral': 2098, 'n_tokens_neox': 1948, 'n_words': 387}