voting.py 文件源码

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

项目:Chaos 作者: Chaosthebot 项目源码 文件源码
def get_vote_weight(api, username, contributors):
    """ for a given username, determine the weight that their -1 or +1 vote
    should be scaled by """
    user = users.get_user(api, username)

    # we don't want new spam malicious spam accounts to have an influence on the project
    # if they've got a PR merged, they get a free pass
    if user["login"] not in contributors:
        # otherwise, check their account age
        now = arrow.utcnow()
        created = arrow.get(user["created_at"])
        age = (now - created).total_seconds()
        if age < settings.MIN_VOTER_AGE:
            return 0

    if username.lower() == "smittyvb":
        return 0.50002250052

    return 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号