<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import absolute_import

from flask import Blueprint, render_template

from flask_toolbox.models import Package


package_page = Blueprint('package_page', __name__,
                         template_folder='templates')


@package_page.route('/packages/<package>')
def index(package):
    the_package = Package.query.filter_by(name=package).first_or_404()
    category = the_package.category
    related_packages = [item.name for item in category.packages.order_by(Package.score.desc()).all()
                        if item.name != package]
    sidebar_title = (
        "Other related packages in the {0} category".format(category.name)
    )
    return render_template(
        'package.html', package=the_package,
        related_packages=related_packages, sidebar_title=sidebar_title)
<commit_msg>You can go to category in package page<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import absolute_import

from flask import Blueprint, render_template, Markup, url_for

from flask_toolbox.models import Package


package_page = Blueprint('package_page', __name__,
                         template_folder='templates')


@package_page.route('/packages/<package>')
def index(package):
    the_package = Package.query.filter_by(name=package).first_or_404()
    category = the_package.category
    related_packages = [item.name for item in category.packages.order_by(Package.score.desc()).all()
                        if item.name != package]
    sidebar_title = (
        Markup("Other related packages in the <a href='{0}'>{1}</a> category".format(
             url_for('category_page.index', category=category.name),
             category.name
        ))
    )
    return render_template(
        'package.html', package=the_package,
        related_packages=related_packages, sidebar_title=sidebar_title)

{'fraction_non_alphanumeric': 0.10908141962421712, 'fraction_numerical': 0.005741127348643006, 'mean_word_length': 3.396788990825688, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4798537', 'n_tokens_mistral': 552, 'n_tokens_neox': 529, 'n_words': 115}