<commit_before># -*- coding: utf-8 -*-
from flask import Blueprint, render_template, url_for as base_url_for
from flask.ext.security import current_user
from ..extensions import user_datastore
from ..models.taxis import Taxi
from functools import partial

mod = Blueprint('examples', __name__)


@mod.route('/documentation/examples')
def doc_index():
    if not current_user.is_anonymous():
        apikeys_operator = set()
        apikeys_moteur = set()
        if 'operateur' in current_user.roles:
            apikeys_operator.add(('your token', current_user.apikey))
        if 'moteur' in current_user.roles:
            apikeys_moteur.add(('your token', current_user.apikey))
        apikeys_operator.add(('neotaxi', user_datastore.find_user(email='neotaxi').apikey))
        apikeys_moteur.add(('neomap', user_datastore.find_user(email='neomap').apikey))
        taxis = Taxi.query.filter(Taxi.added_by==user_datastore.\
                    find_user(email='neotaxi').id).all()
    else:
        apikeys_operator = [('anonymous', 'token')]
        apikeys_moteur = [('anonymous', 'token')]
        taxis = []

    url_for = partial(base_url_for, _external=True)
    return render_template('documentation/examples.html',
                 apikeys_operator=apikeys_operator,
                 apikeys_moteur=apikeys_moteur,
                 taxis=taxis,
                 url_for=url_for)
<commit_msg>Fix test for anonymity in documentation<commit_after># -*- coding: utf-8 -*-
from flask import Blueprint, render_template, url_for as base_url_for
from flask.ext.security import current_user
from ..extensions import user_datastore
from ..models.taxis import Taxi
from functools import partial

mod = Blueprint('examples', __name__)


@mod.route('/documentation/examples')
def doc_index():
    if not current_user.is_anonymous:
        apikeys_operator = set()
        apikeys_moteur = set()
        if 'operateur' in current_user.roles:
            apikeys_operator.add(('your token', current_user.apikey))
        if 'moteur' in current_user.roles:
            apikeys_moteur.add(('your token', current_user.apikey))
        apikeys_operator.add(('neotaxi', user_datastore.find_user(email='neotaxi').apikey))
        apikeys_moteur.add(('neomap', user_datastore.find_user(email='neomap').apikey))
        taxis = Taxi.query.filter(Taxi.added_by==user_datastore.\
                    find_user(email='neotaxi').id).all()
    else:
        apikeys_operator = [('anonymous', 'token')]
        apikeys_moteur = [('anonymous', 'token')]
        taxis = []

    url_for = partial(base_url_for, _external=True)
    return render_template('documentation/examples.html',
                 apikeys_operator=apikeys_operator,
                 apikeys_moteur=apikeys_moteur,
                 taxis=taxis,
                 url_for=url_for)

{'fraction_non_alphanumeric': 0.1166077738515901, 'fraction_numerical': 0.0007067137809187279, 'mean_word_length': 3.1510263929618767, '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': '3289408', 'n_tokens_mistral': 940, 'n_tokens_neox': 917, 'n_words': 161}