def get_category_stats(self):
"""Get a count of CheckState results for each category of checks.
Ignore collection counts to avoid duplications"""
flat_results = self.get_flattened_results()
categories = list(set([x.category for x in flat_results]))
metrics = {}
for category in categories:
metrics[category] = collections.Counter([
x.status for x in filter(
lambda y: len(y.subchecks) == 0 and y.category==category,
flat_results
)
])
return metrics
评论列表
文章目录