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

import argparse
import sys

parser = argparse.ArgumentParser()
parser.add_argument("-c", metavar="config.json", help="use the provided config file", default = "cfg.json")
args = parser.parse_args()

from conf import settings as cfg
if not cfg.read_from_file( args.c ):
  sys.exit(1)

from flask import Flask, request, jsonify, redirect, url_for, make_response, render_template, escape
from urllib.parse import unquote
from werkzeug.contrib.fixers import ProxyFix
import rating
import sys
from uuid import UUID

from submission import submit_match

RUN_POST_PROCESS = cfg['run_post_process']
app = Flask(__name__, static_url_path='/static')
app.wsgi_app = ProxyFix(app.wsgi_app)


@app.template_filter('ql_nickname')
def render_ql_nickname( nickname ):
  nickname = str(escape(nickname))
  for i in range(8):
    nickname = nickname.replace("^" + str(i), '</span><span class="qc' + str(i) + '">')
  return '<span class="qc7">' + nickname + '</span>';


@app.template_filter('seconds_to_mmss')
def seconds_to_mmss( value ):
  seconds = int(escape(value))
  m, s = divmod(seconds, 60)
  return "%02d:%02d" % (m, s)


@app.route('/')
@app.route('/matches/')
@app.route('/matches/<int:page>/')
@app.route('/matches/<gametype>/')
@app.route('/matches/<gametype>/<int:page>/')
@app.route("/player/<int:steam_id>/matches/")
@app.route("/player/<int:steam_id>/matches/<int:page>/")<commit_msg>added cache.GAMETYPE_NAMES var to all controllers<commit_after>#!/usr/bin/python3
# -*- coding: utf-8 -*-

import argparse
import sys

parser = argparse.ArgumentParser()
parser.add_argument("-c", metavar="config.json", help="use the provided config file", default = "cfg.json")
args = parser.parse_args()

from conf import settings as cfg
if not cfg.read_from_file( args.c ):
  sys.exit(1)

from flask import Flask, request, jsonify, redirect, url_for, make_response, render_template as base_render_template, escape
from urllib.parse import unquote
from werkzeug.contrib.fixers import ProxyFix
import rating
import sys
from uuid import UUID

from db import cache
from submission import submit_match

RUN_POST_PROCESS = cfg['run_post_process']
app = Flask(__name__, static_url_path='/static')
app.wsgi_app = ProxyFix(app.wsgi_app)


def render_template(template, **context):
  context['gametype_names'] = cache.GAMETYPE_NAMES
  return base_render_template(template, **context)


@app.template_filter('ql_nickname')
def render_ql_nickname( nickname ):
  nickname = str(escape(nickname))
  for i in range(8):
    nickname = nickname.replace("^" + str(i), '</span><span class="qc' + str(i) + '">')
  return '<span class="qc7">' + nickname + '</span>';


@app.template_filter('seconds_to_mmss')
def seconds_to_mmss( value ):
  seconds = int(escape(value))
  m, s = divmod(seconds, 60)
  return "%02d:%02d" % (m, s)


@app.route('/')
@app.route('/matches/')
@app.route('/matches/<int:page>/')
@app.route('/matches/<gametype>/')
@app.route('/matches/<gametype>/<int:page>/')
@app.route("/player/<int:steam_id>/matches/")
@app.route("/player/<int:steam_id>/matches/<int:page>/")
{'fraction_non_alphanumeric': 0.16704143912624478, 'fraction_numerical': 0.007067137809187279, 'mean_word_length': 5.639658848614072, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '1124071', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1094, 'n_words': 240}