def suggestPayoutGivenType(db: Mapping[str, BountyInfo], domains: List[str]) -> BountyInfo:
""" Returns a BountyInfo containing a suggested payout and the std for the given report given the DB
for that class of vulnerability"""
if len(domains) == 0:
return db['average']
sum = 0.0
stdSum = 0.0 # Not actually the std, but good enough™
cnt = 0
for domain in domains:
try:
sum += db[domain].average
stdSum += db[domain].std
cnt += 1
except KeyError:
pass
try:
return BountyInfo(average=sum/cnt, std=stdSum/cnt)
except ZeroDivisionError:
return db['average']
评论列表
文章目录