<commit_before>from flask import redirect
from flask import render_template
from flask import request

import database.link
from database import db_txn
from linkr import app
from uri.link import *
from uri.main import *


@app.route(LinkAliasRedirectURI.path, methods=LinkAliasRedirectURI.methods)
@db_txn
def alias_route(alias):
    # Attempt to fetch the link mapping from the database
    link = database.link.get_link_by_alias(alias)
    if not link:
        if request.method == 'GET':
            # For GET requests (likely from a browser), direct to a frontend error
            return redirect(LinkNotFoundURI.path)
        elif request.method == 'POST':
            # For POST requests (likely programmatic), send a plain-text response with an
            # appropriate status code
            return 'Link alias not found', 404

    link.increment_hits()

    return redirect(link.outgoing_url)


@app.route(HomeURI.path, defaults={'path': ''}, methods=HomeURI.methods)<commit_msg>Remove unnecessary @db_txn decorator on alias_route<commit_after>from flask import redirect
from flask import render_template
from flask import request

import database.link
from linkr import app
from uri.link import *
from uri.main import *


@app.route(LinkAliasRedirectURI.path, methods=LinkAliasRedirectURI.methods)
def alias_route(alias):
    # Attempt to fetch the link mapping from the database
    link = database.link.get_link_by_alias(alias)
    if not link:
        if request.method == 'GET':
            # For GET requests (likely from a browser), direct to a frontend error
            return redirect(LinkNotFoundURI.path)
        elif request.method == 'POST':
            # For POST requests (likely programmatic), send a plain-text response with an
            # appropriate status code
            return 'Link alias not found', 404

    link.increment_hits()

    return redirect(link.outgoing_url)


@app.route(HomeURI.path, defaults={'path': ''}, methods=HomeURI.methods)
{'fraction_non_alphanumeric': 0.07862903225806452, 'fraction_numerical': 0.0030241935483870967, 'mean_word_length': 3.460674157303371, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1593267', 'n_tokens_mistral': 547, 'n_tokens_neox': 523, 'n_words': 185}