Create utils.get_core_team() function.

This just centralizes the code for getting the core team for a
project.  The next patch will add an alternate method for determining
the team by querying gerrit's REST API.

Change-Id: I016fd8378c5fb69ed7c9192899d8dcfe9bdb466e
This commit is contained in:
Russell Bryant 2015-05-21 15:50:36 -07:00
parent 149c8ae972
commit 8f5484e317
2 changed files with 8 additions and 3 deletions

View File

@ -58,7 +58,8 @@ def process_patchset(project, patchset, reviewers, ts):
# Only count code reviews. Don't add another for Approved, which
# is type 'Approved' or 'Workflow'
if review['by'].get('username', 'unknown') not in project['core-team']:
core_team = utils.get_core_team(project)
if review['by'].get('username', 'unknown') not in core_team:
# Only checking for disagreements from core team members
if int(review['value']) > 0:
@ -169,7 +170,7 @@ def write_pretty(reviewer_data, file_obj, options, reviewers, projects,
if num_reviewers else 0))
file_obj.write('Total reviews by core team: %d (%.1f/day)\n' % (
totals['core'], float(totals['core']) / options.days))
core_team_size = sum([len(project['core-team'])
core_team_size = sum([len(utils.get_core_team(project))
for project in projects])
file_obj.write('Core team size: %d (avg %.1f reviews/day)\n' % (
@ -325,7 +326,7 @@ def main(argv=None):
for k, v in reviewers:
in_core_team = False
for project in projects:
if v in project['core-team']:
if v in utils.get_core_team(project):
in_core_team = True
name = '%s%s' % (v, ' **' if in_core_team else '')

View File

@ -295,3 +295,7 @@ def get_age_of_patch(patch, now_ts):
return now_ts - approvals[0]['grantedOn']
return now_ts - patch['createdOn']
def get_core_team(project):
return project['core-team']