<commit_before># -*- coding: utf-8 -*-
"""
Defines views.
"""

import calendar
from flask import abort
from flask import render_template

from presence_analyzer.main import app
from presence_analyzer import utils
from presence_analyzer import helpers


import logging
log = logging.getLogger(__name__)  # pylint: disable-msg=C0103


@app.route('/')
def mainpage():
    """
    Rendering of the front page.
    """
    return render_template('presence_weekday.html')


@app.route('/mean_time')
def mean_time_page():
    """
    Rendering of mean time page
    """
    return render_template('mean_time_weekday.html')


@app.route('/start_end')
def start_end_page():
    """
    Rendering of start-end page.
    """
    return render_template('presence_start_end.html')


@app.route('/api/v1/users', methods=['GET'])
@helpers.jsonify
def users_view():
    """
    Users listing for dropdown.
    """
    data = utils.get_data()
    users_data = utils.get_user_data()
    return_data = [
        {'user_id': user_id,
         'name': users_data[user_id].get('name'),
         'avatar': users_data[user_id].get('avatar')
        }
        for user_id in users_data.keys() if user_id in data.keys()
    ]
<commit_msg>refs #918 changes after code review<commit_after># -*- coding: utf-8 -*-
"""
Defines views.
"""

import calendar
from flask import abort
from flask import render_template

from presence_analyzer.main import app
from presence_analyzer import utils
from presence_analyzer import helpers


import logging
log = logging.getLogger(__name__)  # pylint: disable-msg=C0103


@app.route('/')
def mainpage():
    """
    Rendering of the front page.
    """
    return render_template('presence_weekday.html')


@app.route('/mean_time')
def mean_time_page():
    """
    Rendering of mean time page
    """
    return render_template('mean_time_weekday.html')


@app.route('/start_end')
def start_end_page():
    """
    Rendering of start-end page.
    """
    return render_template('presence_start_end.html')


@app.route('/api/v1/users', methods=['GET'])
@helpers.jsonify
def users_view():
    """
    Users listing for dropdown.
    """
    data = utils.get_data()
    users_info = utils.get_user_data()

    return_data = [
        {
            'user_id': user_id,
            'name': user_data['name'],
            'avatar': user_data['avatar']
        }
        for user_id, user_data in users_info.iteritems() if user_id in data
    ]

{'fraction_non_alphanumeric': 0.1319983653453208, 'fraction_numerical': 0.006129955046996322, 'mean_word_length': 3.2797202797202796, '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': '4914511', 'n_tokens_mistral': 810, 'n_tokens_neox': 786, 'n_words': 186}