<commit_before>import json
from models import Project
from flask import Blueprint, abort, redirect, render_template, request, url_for

app = Blueprint('projects', __name__,
                template_folder='templates')

@app.route('/projects')
def index():
    projects = Project.get_all()
    return render_template('index.html', projects=projects)

@app.route('/projects', methods=['POST'])
def create():
    name = request.form['name'].strip()
    if (name == ''): abort(400)

    url = request.form['url'].strip()
    if (url == ''): abort(400)

    desc = request.form['desc'].strip()

    project = Project(name=name, url=url, desc=desc)
    project.put()

    redirect('/projects/' + str(project.key.id()))

@app.route('/projects/<int:project_id>', methods=['GET'])
def show(project_id):
    project = Project.get_by_id(long(project_id))
    if (project == None):
        return abort(404)
    else:
        pjson = json.dumps(project.json(), ensure_ascii=False)
        return render_template('show.html', project=project, project_json=pjson)

@app.route('/projects/<int:project_id>', methods=['PATCH'])
def update(project_id):
    abort(503)

@app.route('/projects/<int:project_id>', methods=['DELETE'])
def destroy(project_id):
    abort(503)<commit_msg>return a redirect<commit_after>import json
from models import Project
from flask import Blueprint, abort, redirect, render_template, request, url_for

app = Blueprint('projects', __name__,
                template_folder='templates')

@app.route('/projects')
def index():
    projects = Project.get_all()
    return render_template('index.html', projects=projects)

@app.route('/projects', methods=['POST'])
def create():
    name = request.form['name'].strip()
    if (name == ''): abort(400)

    url = request.form['url'].strip()
    if (url == ''): abort(400)

    desc = request.form['desc'].strip()

    project = Project(name=name, url=url, desc=desc)
    project.put()

    return redirect('/projects/' + str(project.key.id()))

@app.route('/projects/<int:project_id>', methods=['GET'])
def show(project_id):
    project = Project.get_by_id(long(project_id))
    if (project == None):
        return abort(404)
    else:
        pjson = json.dumps(project.json(), ensure_ascii=False)
        return render_template('show.html', project=project, project_json=pjson)

@app.route('/projects/<int:project_id>', methods=['PATCH'])
def update(project_id):
    abort(503)

@app.route('/projects/<int:project_id>', methods=['DELETE'])
def destroy(project_id):
    abort(503)
{'fraction_non_alphanumeric': 0.173433188805676, 'fraction_numerical': 0.011824990145841546, 'mean_word_length': 4.423076923076923, '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': '1753291', 'n_tokens_mistral': 816, 'n_tokens_neox': 790, 'n_words': 160}