Ejemplo n.º 1
0
def cache_commits():
    commit_list = commits()
    for commit in commit_list:
        prefix = "commit"
        suffix = commit.sha[:5]
        json_dict = commit.__dict__
        r.hmset('{0}:{1}'.format(prefix, suffix), json_dict)
Ejemplo n.º 2
0
def build_cache():
    pulls = [z for z in pulls()]
    commits = [z for z in commits()]
    map(lambda x: add("issue", x.number, x.__dict__['_rawData']), issues)
    map(lambda x: add("pull", x.number, x.__dict__['_rawData']), pulls)
    map(lambda x: push("oldest-issues", "issue", x.number), oldest(issues))
    map(lambda x: push("oldest-pulls", "pull", x.number), oldest(pulls))
    map(lambda x: push("least-updated-pulls", "pull", x.number), least_updated(pulls))
    map(lambda x: push("least-updated-issues", "issue", x.number), least_updated(issues))
    map(lambda x: add("commit", x.sha[:5], x.__dict__['_rawData']), commits)
    

    x = 1
    for committer, commit_num in ranked_committers(commits).iteritems():
        add('committer', str(x), {'name': committer, 'commits': commit_num})
        zadd('top-committers', commit_num, "{0}:{1}".format('committer', str(x)))
        x += 1
        

    add("unique-committers-count", "1", {'total': str(len(ranked_committers(commits)))})
    add("total-commits", "1", {'total': str(len(commits))})