Tweak formatting for hacking.

I'm about to bring in regular project infrastructure, this is a
prelude to that.

Change-Id: I58031c196ee4105a4f51c99bf7a9ad3a29d84c6b
This commit is contained in:
Robert Collins 2013-11-25 03:23:08 +00:00
parent 19b0841eb1
commit 56cc948e8e
4 changed files with 19 additions and 17 deletions

View File

@ -19,9 +19,9 @@
import calendar
import datetime
import getpass
import logging
import optparse
import sys
import logging
import utils
@ -54,7 +54,7 @@ def quartile_age(changes, quartile=2, key='age'):
if not changes:
return 0
changes = sorted(changes, key=lambda change: change[key])
quartile_age = changes[len(changes) * quartile/4][key]
quartile_age = changes[len(changes) * quartile / 4][key]
return sec_to_period_string(quartile_age)

View File

@ -29,7 +29,7 @@ import utils
def round_to_day(ts):
SECONDS_PER_DAY = 60*60*24
SECONDS_PER_DAY = 60 * 60 * 24
return (ts / (SECONDS_PER_DAY)) * SECONDS_PER_DAY
@ -213,8 +213,8 @@ def main(argv=None):
all_reviews = plus + minus
ratio = ((plus / (all_reviews)) * 100) if all_reviews > 0 else 0
r = (k['total'], k['votes']['-2'],
k['votes']['-1'], k['votes']['1'],
k['votes']['2'], k['votes']['A'], "%5.1f%%" % ratio)
k['votes']['-1'], k['votes']['1'],
k['votes']['2'], k['votes']['A'], "%5.1f%%" % ratio)
dratio = (((float(k['disagreements']) / all_reviews) * 100)
if all_reviews else 0.0)
d = (k['disagreements'], "%5.1f%%" % dratio)
@ -247,7 +247,8 @@ def main(argv=None):
'Reviews for the last %d days in projects: %s\n' %
(options.days, [project['name'] for project in projects]))
else:
file_obj.write('Reviews for the last %d days in %s\n'
file_obj.write(
'Reviews for the last %d days in %s\n'
% (options.days, projects[0]['name']))
if options.all:
file_obj.write(
@ -256,11 +257,12 @@ def main(argv=None):
file_obj.write(
'** -- %s-core team member\n' % projects[0]['name'])
writer(reviewer_data, file_obj)
file_obj.write('\nTotal reviews: %d (%.1f/day)\n' % (total,
float(total) / options.days))
file_obj.write('Total reviewers: %d (avg %.1f reviews/day)\n' % (
len(reviewers),
float(total) / options.days / len(reviewers)))
file_obj.write(
'\nTotal reviews: %d (%.1f/day)\n' % (
total, float(total) / options.days))
file_obj.write(
'Total reviewers: %d (avg %.1f reviews/day)\n' % (
len(reviewers), float(total) / options.days / len(reviewers)))
file_obj.write('Total reviews by core team: %d (%.1f/day)\n' % (
core_total, float(core_total) / options.days))
core_team_size = sum([len(project['core-team'])
@ -304,9 +306,9 @@ def main(argv=None):
' Average number of patches per changeset: %.1f\n'
% (float(patches_created) / changes_involved))
file_obj.write(
'\n(*) Disagreements are defined as a +1 or +2 vote on a ' \
'patch where a core team member later gave a -1 or -2 vote' \
', or a negative vote overridden with a positive one ' \
'\n(*) Disagreements are defined as a +1 or +2 vote on a '
'patch where a core team member later gave a -1 or -2 vote'
', or a negative vote overridden with a positive one '
'afterwards.\n')
file_obj.write(
'\n(***) Received - the number of reviews that this person '

View File

@ -24,7 +24,7 @@ import utils
def main():
logging.basicConfig(level=logging.DEBUG)
# Make sure all projects info load successfully
projects = utils.get_projects_info('', True)
utils.get_projects_info('', True)
return 0

View File

@ -18,11 +18,11 @@
import cPickle as pickle
import glob
import json
import paramiko
import logging
import os
import time
import logging
import paramiko
CACHE_AGE = 3600 # Seconds