SHARE
TWEET

Untitled

a guest Mar 20th, 2017 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from github import Github
  2. from collections import Counter
  3. import sys
  4.  
  5. USER = None
  6. PASSWORD = None
  7.  
  8. def get_repo(repo_name):
  9.     contribs = list(g.get_repo(repo_name).get_contributors())
  10.  
  11.     return {'contribs': [c.login for c in contribs]}
  12.  
  13. g = Github(USER, PASSWORD)
  14.  
  15. repos = [get_repo(r) for r in sys.argv[1:]]
  16.  
  17. print("Contributors in all of:", ", ".join(sys.argv[1:]))
  18.  
  19. contribs = set(repos[0]["contribs"])
  20. for repo in repos[1:]:
  21.     contribs &= set(repo["contribs"])
  22.  
  23. for contrib in contribs:
  24.     print("-", contrib)
  25.  
  26. print("")
  27. print("Furthermore, the most nomadic contributors:")
  28. print("")
  29.  
  30. nomadic = Counter()
  31.  
  32. for repo in repos:
  33.     for contrib in repo["contribs"]:
  34.         nomadic[contrib] += 1
  35.  
  36. for (user, n) in nomadic.most_common():
  37.     print("- %s (%d repositories)" % (user, n))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top