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

from flask import Blueprint, render_template, request

from ..webapp import db
from ..yml import Builder as YMLBuilder
from ..action import export_manager

bp = Blueprint('public', __name__)
logger = logging.getLogger(__name__)


@bp.route('/yml')
def yml():
    yml_builder = YMLBuilder(session=db.session)
    ctx = {
        'generation_date': yml_builder.generation_date(),
        'genres': yml_builder.genres_list(),
        'offers': yml_builder.offers()
    }
    expman = export_manager.ExportManager(db.session)
    expdata = {
        'user_agent': request.environ.get('HTTP_USER_AGENT'),
        'ip': request.environ.get('REMOTE_ADDR'),
        'format': 'yml'
    }
    exp = expman.from_dict(expdata)
    message = "YML export for {}@{} completed"
    logger.info(message.format(request.environ.get('HTTP_USER_AGENT'),
                               request.environ.get('REMOTE_ADDR')))
    return render_template('yml.xml', **ctx)


@bp.route('/table')
def table():
    message = "Table export for {}@{} completed"
    logger.info(message.format(request.environ.get('HTTP_USER_AGENT'),
                               request.environ.get('REMOTE_ADDR')))
<commit_msg>raise proper exception for table export<commit_after># -*- coding: utf-8 -*-
import logging

from flask import Blueprint, render_template, request

from ..webapp import db
from ..yml import Builder as YMLBuilder
from ..action import export_manager

bp = Blueprint('public', __name__)
logger = logging.getLogger(__name__)


@bp.route('/yml')
def yml():
    yml_builder = YMLBuilder(session=db.session)
    ctx = {
        'generation_date': yml_builder.generation_date(),
        'genres': yml_builder.genres_list(),
        'offers': yml_builder.offers()
    }
    expman = export_manager.ExportManager(db.session)
    expdata = {
        'user_agent': request.environ.get('HTTP_USER_AGENT'),
        'ip': request.environ.get('REMOTE_ADDR'),
        'format': 'yml'
    }
    exp = expman.from_dict(expdata)
    message = "YML export for {}@{} completed"
    logger.info(message.format(request.environ.get('HTTP_USER_AGENT'),
                               request.environ.get('REMOTE_ADDR')))
    return render_template('yml.xml', **ctx)


@bp.route('/table')
def table():
    message = "Table export for {}@{} completed"
    logger.info(message.format(request.environ.get('HTTP_USER_AGENT'),
                               request.environ.get('REMOTE_ADDR')))
    raise NotImplementedError('Not yet')

{'fraction_non_alphanumeric': 0.14088941361668633, 'fraction_numerical': 0.0007870916961826052, 'mean_word_length': 3.2155887230514097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6775988', 'n_tokens_mistral': 805, 'n_tokens_neox': 784, 'n_words': 154}