def format_data(raw_data, limit_per_url_group=LIMIT_PER_URL_GROUP, limit_url_groups=LIMIT_URL_GROUPS):
    """Fomat data from LogAnalyzer for render purpose"""
    data = copy.deepcopy(raw_data)
    for k, v in data['data_details'].items():
        # Only reserve first ``limit_per_url_group`` items
        v['urls'] = sorted(v['urls'].iteritems(), key=lambda (k, v): v.total,
                           reverse=True)[:limit_per_url_group]

    data_details = sorted(data['data_details'].iteritems(),
                          key=lambda (k, v): v["duration_agr_data"].total, 
                          reverse=True)[:limit_url_groups]

    if data['requests_counter']['normal']:
        slow_rate = format(data['requests_counter']['slow'] - \
                           float(data['requests_counter']['normal']), '.2%')
    else:
        slow_rate = '-'
    data.update({
        'slow_rate': slow_rate,
        'data_details': data_details,
    })
    return data
dataset/ETHPy150Open piglei/uwsgi-sloth/uwsgi_sloth/analyzer.py/format_data/operator `/` -> `-`