def count_stats(): issue = 0 commit = 0 comment = 0 milestone = 0 for item in files: print item issue_data = read.get_issues(item) issue += len(issue_data.keys()) print "ISSUE: " + str(len(issue_data.keys())) milestone_data = read.get_milestones(item) milestone += len(milestone_data) print "milestone: " + str(len(milestone_data)) comment_data = read.get_comments(item) comment += len(comment_data) print "comment: " + str(len(comment_data)) commit_data = read.get_commits(item) commit += len(commit_data) print "commit: " + str(len(commit_data)) print print "Total" print "ISSUE: " + str(issue) print "commit: " + str(commit) print "comment: " + str(comment) print "milestone: " + str(milestone) print
def process_2(): neg_full = {} for item in files: milestones = read.get_milestones(item) milestones = {x["name"]:x["closed_at"] for x in milestones if x["closed_at"] } issue_data = read.get_issues(item) issue_diffs = [] for issue in issue_data.keys(): ist = max(issue_data[issue], key=lambda item:item['when']) if ist["milestone"] in milestones.keys(): issue_diffs.append((milestones[ist["milestone"]] - ist["when"]) / (60*60)) pos_diff = [x for x in issue_diffs if x>0] data = {"Less than an hour": sum([1 for x in pos_diff if x>=0 and x<1]), "2 to 5 hours": sum([1 for x in pos_diff if x>=1 and x<5]), "5 to 10 hours": sum([1 for x in pos_diff if x>=5 and x<10]), "10 hours": sum([1 for x in pos_diff if x>=10]) } pos_diff_per = len(pos_diff)*100/len(issue_diffs) graph.pie_chart(data, str(pos_diff_per)+"\% for project "+item) neg_diff = [-x for x in issue_diffs if x<0] data = {"Less than an hour": sum([1 for x in neg_diff if x>=0 and x<1]), "2 to 5 hours": sum([1 for x in neg_diff if x>=1 and x<5]), "5 to 10 hours": sum([1 for x in neg_diff if x>=5 and x<10]), "10 hours": sum([1 for x in neg_diff if x>=10]) } neg_diff_per = len(neg_diff)*100/len(issue_diffs) graph.pie_chart(data, str(neg_diff_per)+"\% for project "+item) neg_full["Project "+item] = neg_diff_per graph.pie_chart(neg_full, "Closed after milestone")
def process_2(): neg_full = {} for item in files: milestones = read.get_milestones(item) milestones = { x["name"]: x["closed_at"] for x in milestones if x["closed_at"] } issue_data = read.get_issues(item) issue_diffs = [] for issue in issue_data.keys(): ist = max(issue_data[issue], key=lambda item: item['when']) if ist["milestone"] in milestones.keys(): issue_diffs.append( (milestones[ist["milestone"]] - ist["when"]) / (60 * 60)) pos_diff = [x for x in issue_diffs if x > 0] data = { "Less than an hour": sum([1 for x in pos_diff if x >= 0 and x < 1]), "2 to 5 hours": sum([1 for x in pos_diff if x >= 1 and x < 5]), "5 to 10 hours": sum([1 for x in pos_diff if x >= 5 and x < 10]), "10 hours": sum([1 for x in pos_diff if x >= 10]) } pos_diff_per = len(pos_diff) * 100 / len(issue_diffs) graph.pie_chart(data, str(pos_diff_per) + "\% for project " + item) neg_diff = [-x for x in issue_diffs if x < 0] data = { "Less than an hour": sum([1 for x in neg_diff if x >= 0 and x < 1]), "2 to 5 hours": sum([1 for x in neg_diff if x >= 1 and x < 5]), "5 to 10 hours": sum([1 for x in neg_diff if x >= 5 and x < 10]), "10 hours": sum([1 for x in neg_diff if x >= 10]) } neg_diff_per = len(neg_diff) * 100 / len(issue_diffs) graph.pie_chart(data, str(neg_diff_per) + "\% for project " + item) neg_full["Project " + item] = neg_diff_per graph.pie_chart(neg_full, "Closed after milestone")
def process_8(): for item in files: milestones = read.get_milestones(item) milestones = [(x["due_at"] - x["created_at"]) / (60 * 60 * 24) for x in milestones if x["due_at"]] graph.bar_chart(milestones, title="Milestone created before due")
def process_8(): for item in files: milestones = read.get_milestones(item) milestones = [(x["due_at"]-x["created_at"])/(60*60*24) for x in milestones if x["due_at"]] graph.bar_chart(milestones, title="Milestone created before due")