<commit_before># -*- coding: utf-8 -*-

#
# Copyright (C) 2015-2018 <NAME> <<EMAIL>>
#

from flask import Flask, jsonify, redirect, request, session, url_for
from flask_themes import setup_themes, render_theme_template
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from werkzeug.exceptions import abort
import logging

from flask_babel import Babel, gettext
import flask_login

from qpanel import upgrader, job, rq_worker
import qpanel.utils as uqpanel

from qpanel.config import QPanelConfig
from qpanel.backend import Backend
if QPanelConfig().has_queuelog_config():
    from qpanel.model import queuelog_data_queue

import sys
reload(sys)
sys.setdefaultencoding('utf-8')


class User(flask_login.UserMixin):
    pass


cfg = QPanelConfig()
backend = Backend()


def get_data_queues(queue=None):
    data = backend.get_data_queues()
    if queue is not None:
        try:
            data = data[queue]
        except:
            abort(404)
    if cfg.is_debug:
        app.logger.debug(data)
    return data


def get_user_config_by_name(username):
    try:
        user = User()
        user.id = username
        user.password = cfg.get('users', username)
        return user
    except BaseException:
        return None<commit_msg>Bugfix for Python 3 set utf-8 and sys.reload<commit_after># -*- coding: utf-8 -*-

#
# Copyright (C) 2015-2018 <NAME> <<EMAIL>>
#

from flask import Flask, jsonify, redirect, request, session, url_for
from flask_themes import setup_themes, render_theme_template
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from werkzeug.exceptions import abort
import logging

from flask_babel import Babel, gettext
import flask_login

from qpanel import upgrader, job, rq_worker
import qpanel.utils as uqpanel

from qpanel.config import QPanelConfig
from qpanel.backend import Backend
if QPanelConfig().has_queuelog_config():
    from qpanel.model import queuelog_data_queue

import sys
PY2 = sys.version_info[0] == 2

if PY2: # Python 3 has not setdefaultencoding and UTF-8 is default
    reload(sys)
    sys.setdefaultencoding('utf-8')

class User(flask_login.UserMixin):
    pass


cfg = QPanelConfig()
backend = Backend()


def get_data_queues(queue=None):
    data = backend.get_data_queues()
    if queue is not None:
        try:
            data = data[queue]
        except:
            abort(404)
    if cfg.is_debug:
        app.logger.debug(data)
    return data


def get_user_config_by_name(username):
    try:
        user = User()
        user.id = username
        user.password = cfg.get('users', username)
        return user
    except BaseException:
        return None
{'fraction_non_alphanumeric': 0.08120133481646273, 'fraction_numerical': 0.01260659992584353, 'mean_word_length': 3.4891846921797005, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4460258', 'n_tokens_mistral': 883, 'n_tokens_neox': 839, 'n_words': 246}