<commit_before>"""maintains all functionalities running on homepage."""
from flask import Blueprint, g

from decorators import template_renderer
from mod_auth.models import Role
from mod_home.models import CCExtractorVersion, GeneralData

mod_home = Blueprint('home', __name__)


@mod_home.before_app_request
def before_app_request() -> None:
    """Curate menu entries before app request."""
    g.menu_entries['home'] = {
        'title': 'Home',
        'icon': 'home',
        'route': 'home.index'
    }


@mod_home.route('/', methods=['GET', 'POST'])
@template_renderer()
def index():
    """Render index home page."""
    last_commit = GeneralData.query.filter(GeneralData.key == 'last_commit').first().value
    last_release = CCExtractorVersion.query.order_by(CCExtractorVersion.released.desc()).first()
    test_access = False
    if g.user is not None and g.user.role in [Role.tester, Role.contributor, Role.admin]:
        test_access = True
    return {
        'ccx_last_release': last_release,
        'ccx_latest_commit': last_commit,
        'test_access': test_access
    }


@mod_home.route('/about')
@template_renderer()
def about():
    """Render about page."""
    return {}

@mod_home.route('/download_ccx')
def download_ccx():
    path_to_tester = '/repository/testsuite.tar'
    return send_file(path_to_tester, as_attachment=True, attachment_filename='testsuite.tar')<commit_msg>Update controllers.py<commit_after>"""maintains all functionalities running on homepage."""
from flask import Blueprint, g

from decorators import template_renderer
from mod_auth.models import Role
from mod_home.models import CCExtractorVersion, GeneralData

mod_home = Blueprint('home', __name__)


@mod_home.before_app_request
def before_app_request() -> None:
    """Curate menu entries before app request."""
    g.menu_entries['home'] = {
        'title': 'Home',
        'icon': 'home',
        'route': 'home.index'
    }


@mod_home.route('/', methods=['GET', 'POST'])
@template_renderer()
def index():
    """Render index home page."""
    last_commit = GeneralData.query.filter(GeneralData.key == 'last_commit').first().value
    last_release = CCExtractorVersion.query.order_by(CCExtractorVersion.released.desc()).first()
    test_access = False
    if g.user is not None and g.user.role in [Role.tester, Role.contributor, Role.admin]:
        test_access = True
    return {
        'ccx_last_release': last_release,
        'ccx_latest_commit': last_commit,
        'test_access': test_access
    }


@mod_home.route('/about')
@template_renderer()
def about():
    """Render about page."""
    return {}
{'fraction_non_alphanumeric': 0.13429988553987027, 'fraction_numerical': 0.0, 'mean_word_length': 4.101167315175097, 'pattern_counts': {'":': 0, '<': 3, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1271814', 'n_tokens_mistral': 808, 'n_tokens_neox': 800, 'n_words': 187}