a guest Jun 13th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- from collections import namedtuple
- Repo = namedtuple('Repo', 'name stars forks')
- def get_repo_stats(user, n=5):
- """Takes a Github user object and returns the top n most popular repos by star count,
- skips forks."""
- repos = 
- for repo in user.get_repos():
- if repo.fork:
- return sorted(repos, key=lambda x: x.stars, reverse=True)[:n]
RAW Paste Data