<commit_before>from flask import Flask
from flask import render_template
from flask_bootstrap import Bootstrap
from os import listdir
from os.path import isfile, join
from parser_xml import parse_standing_from_file as parse_file
from classes import TotalStandings

app = Flask(__name__)


@app.route("/")
def hello_world():
    files = getFiles("./samples")
    totalStandings = TotalStandings(
        [parse_file("./samples/" + file) for file in files])
    return render_template(
        "index.html", files=files,
        standings=None, totalStandings=totalStandings)


def getFiles(mypath):
    return [f for f in listdir(mypath) if isfile(join(mypath, f))]


@app.route("/showtable/<string:table>")
def showtable(table):
    files = getFiles("./samples")
    standings = parse_file("./samples/" + table) \
        if table in files else None

    return render_template(
        "index.html", files=files, standings=standings,
        totalStandings=None)


if __name__ == "__main__":
    Bootstrap(app)
    app.run(debug=True)<commit_msg>Updates webapp.py<commit_after>from flask import Flask
from flask import render_template
from flask_bootstrap import Bootstrap
from os import listdir
from os.path import isfile, join
from parser_xml import parse_standing_from_file as parse_file
from classes import TotalStandings

app = Flask(__name__)


@app.route("/")
def hello_world():
    files = getFiles("./samples")
    totalStandings = TotalStandings(
        [parse_file("./samples/" + file) for file in files])
    return render_template(
        "index.html", files=files,
        standings=None, totalStandings=totalStandings)


def getFiles(mypath):
    return sorted([f for f in listdir(mypath) if isfile(join(mypath, f))])


@app.route("/showtable/<string:table>")
def showtable(table):
    files = getFiles("./samples")
    standings = parse_file("./samples/" + table) \
        if table in files else None

    return render_template(
        "index.html", files=files, standings=standings,
        totalStandings=None)


if __name__ == "__main__":
    Bootstrap(app)
    app.run(debug=True)
{'fraction_non_alphanumeric': 0.10968660968660969, 'fraction_numerical': 0.0, 'mean_word_length': 3.9810874704491725, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '1391246', 'n_tokens_mistral': 657, 'n_tokens_neox': 633, 'n_words': 176}