in crashes.py [0:0]
def generateTopReportsList(reports):
# For certain types of reasons like RustMozCrash, organize
# the most common for a report list. Otherwise just dump the
# first MaxReportCount.
reasonCounter = Counter()
for report in reports:
crashReason = report['crashreason']
reasonCounter[crashReason] += 1
reportCol = reasonCounter.most_common(MaxReportCount)
if len(reportCol) < MaxReportCount:
return reports
colCount = len(reportCol)
maxReasonCount = int(math.ceil(MaxReportCount / colCount))
reportList = list()
count = 0
for reason, count in reportCol:
for report in reports:
if report['crashreason'] == reason:
reportList.append(report)
count += 1
if count > maxReasonCount:
break # next reason
return reportList