Beispiel #1
0
#!/usr/bin/python

import operator
import webkit

counts = {}
for date, author in webkit.parse_log():
    author = webkit.canonicalize_email(author)
    counts[author] = counts.get(author, 0) + 1

companies = {}
unknown = {}
for email, count in counts.iteritems():
    company = webkit.classify_email(email)
    companies[company] = companies.get(company, 0) + count
    if company == "unknown":
        unknown[email] = count
    elif company == "misc":
        unknown["*" + email] = count


if unknown:
    print ('unclassified (star denotes "commits examined, and their ' 'backer is a minor contributor"):')
    for email, count in sorted(unknown.iteritems(), key=operator.itemgetter(1), reverse=True):
        print "  %s (%d)" % (email, count)


for company, count in sorted(companies.iteritems(), key=operator.itemgetter(1), reverse=True):
    print "%s: %d" % (company, count)
Beispiel #2
0
#!/usr/bin/python

import webkit
import datetime
from collections import defaultdict

start = None
end = None
data = defaultdict(lambda: defaultdict(lambda: 0))
for date, author in webkit.parse_log(since='3 years ago'):
    author = webkit.canonicalize_email(author)
    company = webkit.classify_email(author)
    date = datetime.date(*map(int, date.split('-')))
    if start is None or date < start:
        start = date
    if end is None or date > end:
        end = date
    data[date][company] += 1

show_companies = set(['google', 'apple', 'nokia', 'rim'])
print "Date," + ','.join(show_companies) + ",other"
date = start
while date <= end:
    row = [date.strftime("%Y%m%d")]
    for company in show_companies:
        row.append(data[date][company])
    misc = 0
    for company in data[date].keys():
        if company not in show_companies:
            misc += data[date][company]
    row.append(misc)