(file_name, method, repos)
| 20 | |
| 21 | |
| 22 | def write_ranking_repo(file_name, method, repos): |
| 23 | # method: 'a'-append or 'w'-overwrite |
| 24 | table_head = "| Ranking | Project Name | Stars | Forks | Language | Open Issues | Description | Last Commit |\n\ |
| 25 | | ------- | ------------ | ----- | ----- | -------- | ----------- | ----------- | ----------- |\n" |
| 26 | with open(file_name, method, encoding='utf-8') as f: |
| 27 | f.write(table_head) |
| 28 | for idx, repo in enumerate(repos): |
| 29 | repo_description = repo['description'] |
| 30 | if repo_description is not None: |
| 31 | repo_description = repo_description.replace('|', '\|') # in case there is '|' in description |
| 32 | f.write("| {} | [{}]({}) | {} | {} | {} | {} | {} | {} |\n".format( |
| 33 | idx + 1, repo['name'], repo['html_url'], repo['stargazers_count'], repo['forks_count'], |
| 34 | repo['language'], repo['open_issues_count'], repo_description, repo['pushed_at'] |
| 35 | )) |
| 36 | f.write('\n') |
| 37 | |
| 38 | |
| 39 | def get_api_repos(API_URL): |
no outgoing calls
no test coverage detected