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
评论列表
文章目录