<commit_before>import os
import time
import aiohttp
import mimetypes

import hippod.ex3000
import hippod.error_object

def get_reports(app):
    report_list = list()
    reports_path = app['REPORT_PATH']
    # dir_list = os.listdir(reports_path)
    mtime = lambda f: os.stat(os.path.join(reports_path, f)).st_mtime
    dir_list = list(sorted(os.listdir(reports_path), key=mtime))
    for file in dir_list:
        report = dict()
        report_file_path = os.path.join(reports_path, file)
        report['name'] = file
        report['size'] = "{} KB".format(os.path.getsize(report_file_path)>>10)
        report_list.append(report)
    return report_list


def get_concrete_report(app, report_name):
    reports_path = app['REPORT_PATH']
    report_path = os.path.join(reports_path, report_name)
    mime_type, enconding = mimetypes.guess_type(report_name)
    with open(report_path, 'rb') as file:
        data = file.read()
        return mime_type, data


def handle(request):
    if request.method != "GET":
        msg = "Internal Error...request method: {} is not allowed".format(request.method)
        raise ApiError(msg)
    app = request.app
    try:
        start = time.clock()<commit_msg>reverse the order of reports on report page<commit_after>import os
import time
import aiohttp
import mimetypes

import hippod.ex3000
import hippod.error_object

def get_reports(app):
    report_list = list()
    reports_path = app['REPORT_PATH']
    # dir_list = os.listdir(reports_path)
    mtime = lambda f: os.stat(os.path.join(reports_path, f)).st_mtime
    dir_list = list(sorted(os.listdir(reports_path), key=mtime, reverse=True))
    for file in dir_list:
        report = dict()
        report_file_path = os.path.join(reports_path, file)
        report['name'] = file
        report['size'] = "{} KB".format(os.path.getsize(report_file_path)>>10)
        report_list.append(report)
    return report_list


def get_concrete_report(app, report_name):
    reports_path = app['REPORT_PATH']
    report_path = os.path.join(reports_path, report_name)
    mime_type, enconding = mimetypes.guess_type(report_name)
    with open(report_path, 'rb') as file:
        data = file.read()
        return mime_type, data


def handle(request):
    if request.method != "GET":
        msg = "Internal Error...request method: {} is not allowed".format(request.method)
        raise ApiError(msg)
    app = request.app
    try:
        start = time.clock()
{'fraction_non_alphanumeric': 0.11500815660685156, 'fraction_numerical': 0.004893964110929853, 'mean_word_length': 3.4519056261343013, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, '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': '5799085', 'n_tokens_mistral': 832, 'n_tokens_neox': 805, 'n_words': 175}