<commit_before># -*- coding: utf-8 -*-
import json
import os
import gevent
from gevent.queue import Queue
from urllib import urlencode
from flask import Flask, send_from_directory, request, Response, session
from flask import g, redirect, url_for
from flask_admin import Admin, AdminIndexView
from flask_babelex import Babel, gettext, lazy_gettext
from flask_migrate import Migrate
from flask_security import Security, SQLAlchemyUserDatastore, \
    UserMixin, RoleMixin, login_required
from flask_sqlalchemy import SQLAlchemy, models_committed


app = Flask('AstConfMan', instance_relative_config=True)
app.config.from_object('config')


# For smooth language switcher
def append_to_query(s, param, value):
    params = dict(request.args.items())
    params[param] = value
    return '%s?%s' % (request.path, urlencode(params))
app.jinja_env.filters['append_to_query'] = append_to_query


try:
  app.config.from_pyfile('config.py')
except IOError:
  pass


db = SQLAlchemy()
db.init_app(app)

migrate = Migrate(app, db)

from flask_bootstrap import Bootstrap
Bootstrap(app)

babel = Babel(app)
@babel.localeselector
def get_locale():
    if request.args.get('lang'):
        session['lang'] = request.args.get('lang')        
    return session.get('lang', app.config.get('LANGUAGE'))


# Define models
roles_users = db.Table('roles_users',<commit_msg>Update app.py<commit_after># -*- coding: utf-8 -*-
import json
import os
import gevent
from gevent.queue import Queue
from urllib import urlencode
from flask import Flask, send_from_directory, request, Response, session
from flask import g, redirect, url_for
from flask_admin import Admin, AdminIndexView
from flask_babelex import Babel, gettext, lazy_gettext
from flask_migrate import Migrate
from flask_security import Security, SQLAlchemyUserDatastore, \
    UserMixin, RoleMixin, login_required
from flask_sqlalchemy import SQLAlchemy, models_committed


app = Flask('AstConfMan', instance_relative_config=True)
app.config.from_object('config')


# For smooth language switcher
def append_to_query(s, param, value):
    params = {}
    params[param] = value
    return '%s?%s' % (request.path, urlencode(params))
app.jinja_env.filters['append_to_query'] = append_to_query


try:
  app.config.from_pyfile('config.py')
except IOError:
  pass


db = SQLAlchemy()
db.init_app(app)

migrate = Migrate(app, db)

from flask_bootstrap import Bootstrap
Bootstrap(app)

babel = Babel(app)
@babel.localeselector
def get_locale():
    if request.args.get('lang'):
        session['lang'] = request.args.get('lang')        
    return session.get('lang', app.config.get('LANGUAGE'))


# Define models
roles_users = db.Table('roles_users',
{'fraction_non_alphanumeric': 0.10477255779269203, 'fraction_numerical': 0.0007457121551081282, 'mean_word_length': 5.342789598108747, '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': '302178', 'n_tokens_mistral': 905, 'n_tokens_neox': 858, 'n_words': 225}