payout.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:AutoTriageBot 作者: salesforce 项目源码 文件源码
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']
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号