<commit_before>from sanic import Sanic
from sanic.log import log
from sanic.response import json, text
from sanic.exceptions import ServerError

app = Sanic(__name__)

@app.route("/")
async def test_async(request):
    return json({ "test": True })
    
@app.route("/sync", methods=['GET', 'POST'])
def test_sync(request):
    return json({ "test": True })

@app.route("/dynamic/<name>/<id:int>")
def test_params(request, name, id):
    return text("yeehaww {} {}".format(name, id))

@app.route("/exception")
def exception(request):
    raise ServerError("It's dead jim")

# ----------------------------------------------- #
# Exceptions
# ----------------------------------------------- #

@app.exception(ServerError)
async def test(request, exception):
    return json({ "exception": "{}".format(exception), "status": exception.status_code }, status=exception.status_code)

# ----------------------------------------------- #
# Read from request
# ----------------------------------------------- #

@app.route("/json")
def post_json(request):
    return json({ "received": True, "message": request.json })

@app.route("/form")
def post_json(request):
    return json({ "received": True, "form_data": request.form, "test": request.form.get('test') })

@app.route("/query_string")
def query_string(request):
    return json({ "parsed": True, "args": request.args, "url": request.url, "query_string": request.query_string })

# ----------------------------------------------- #
# Run Server
# ----------------------------------------------- #

def before_start(loop):
    log.info("OH OH OH OH OHHHHHHHH")
def before_stop(loop):
    log.info("TRIED EVERYTHING")

app.run(host="0.0.0.0", port=8000, debug=True, before_start=before_start, before_stop=before_stop)

<commit_msg>Changed before_start to after_start<commit_after>from sanic import Sanic
from sanic.log import log
from sanic.response import json, text
from sanic.exceptions import ServerError

app = Sanic(__name__)

@app.route("/")
async def test_async(request):
    return json({ "test": True })
    
@app.route("/sync", methods=['GET', 'POST'])
def test_sync(request):
    return json({ "test": True })

@app.route("/dynamic/<name>/<id:int>")
def test_params(request, name, id):
    return text("yeehaww {} {}".format(name, id))

@app.route("/exception")
def exception(request):
    raise ServerError("It's dead jim")

# ----------------------------------------------- #
# Exceptions
# ----------------------------------------------- #

@app.exception(ServerError)
async def test(request, exception):
    return json({ "exception": "{}".format(exception), "status": exception.status_code }, status=exception.status_code)

# ----------------------------------------------- #
# Read from request
# ----------------------------------------------- #

@app.route("/json")
def post_json(request):
    return json({ "received": True, "message": request.json })

@app.route("/form")
def post_json(request):
    return json({ "received": True, "form_data": request.form, "test": request.form.get('test') })

@app.route("/query_string")
def query_string(request):
    return json({ "parsed": True, "args": request.args, "url": request.url, "query_string": request.query_string })

# ----------------------------------------------- #
# Run Server
# ----------------------------------------------- #

def after_start(loop):
    log.info("OH OH OH OH OHHHHHHHH")
def before_stop(loop):
    log.info("TRIED EVERYTHING")

app.run(host="0.0.0.0", port=8000, debug=True, after_start=after_start, before_stop=before_stop)


{'fraction_non_alphanumeric': 0.3055789178581441, 'fraction_numerical': 0.00448556209700028, 'mean_word_length': 2.378787878787879, 'pattern_counts': {'":': 26, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 2, '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': '1651944', 'n_tokens_mistral': 1038, 'n_tokens_neox': 1014, 'n_words': 241}