Created
December 29, 2011 20:54
-
-
Save rhelmer/1536146 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import json | |
| import urllib2 | |
| url = 'https://github.com/mozilla/socorro/graphs/impact_data' | |
| data = json.load(urllib2.urlopen(url)) | |
| attribs = {'n': 'username', 'a': 'additions', 'c': 'commits', 'd': 'deletions'} | |
| results = {} | |
| for n in data['authors']: | |
| entry = data['authors'][n] | |
| impact = entry['a'] + entry['d'] | |
| results[impact] = {} | |
| for attrib in attribs: | |
| name = attribs[attrib] | |
| value = entry[attrib] | |
| if name == 'username': | |
| value = value.split('@')[0] | |
| results[impact][name] = value | |
| keylist = results.keys() | |
| keylist.sort(reverse=True) | |
| for impact in keylist: | |
| print results[impact]['username'] | |
| del results[impact]['username'] | |
| print '\timpact(add+del):\t%s' % impact | |
| for r in results[impact]: | |
| print '\t%s:\t\t%s' % (r, results[impact][r]) | |
| print '---' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment