1- import json
21import os
3- import pathlib
4- from collections import defaultdict
52from datetime import datetime , timedelta
6- from typing import Optional
73
84from github import Github
95from github .Issue import Issue
106from github .Repository import Repository
11- from pytz import timezone
127
138
149def main ():
1510 start_time : datetime = datetime .now ()
1611
12+ # --- Initialization ---
1713 # GitHub Workflow will pass in the token as an environment variable,
18- # but we can place it in our env when running the script locally, for convenience
14+ # but we can place it in our env when running the script locally,
15+ # for convenience
1916 local_github_token : str | None = None
20- github_token : str | None = local_github_token or os .getenv ("GITHUB_ACCESS_TOKEN" )
17+ github_token : str | None = (
18+ local_github_token or os .getenv ("GITHUB_ACCESS_TOKEN" )
19+ )
2120 github = Github (github_token )
2221
22+ # repository name
23+ repo_name : str = "pvlib/pvlib-python"
24+ repository : Repository = github .get_repo (repo_name )
25+
2326 # Rate limiting
2427 remaining_requests_before : int = github .rate_limiting [0 ]
2528 print (f"Remaining requests before: { remaining_requests_before } " )
2629
27-
28- repo_name : str = "pvlib/pvlib-python"
29- repository : Repository = github .get_repo (repo_name )
30-
30+ # --- Actions ---
3131 # Get sorted issues
32- query : str = f'repo:{ repository .full_name } is:open is:issue sort:reactions-+1-desc'
32+ query : str = (
33+ f'repo:{ repository .full_name } is:open is:issue sort:reactions-+1-desc'
34+ )
3335 issues = github .search_issues (query )
3436
3537 # Format markdown
3638 ranked_issues = []
3739 for i , issue in enumerate (issues ):
3840 markdown_bullet_point : str = (
39- f"{ issue .html_url } ({ issue ._rawData ["reactions" ]["+1" ]} :thumbsup:)"
41+ f"{ issue .html_url } " +
42+ f"({ issue ._rawData ["reactions" ]["+1" ]} :thumbsup:)"
4043 )
4144
4245 markdown_bullet_point = f"{ i + 1 } . { markdown_bullet_point } "
@@ -45,7 +48,6 @@ def main():
4548 if i >= 19 :
4649 break
4750
48-
4951 # edit top issues
5052 top_issues_card : Issue = repository .get_issue (number = 2196 )
5153 header = "Top Ranking Issues"
@@ -60,9 +62,5 @@ def main():
6062 print (run_duration )
6163
6264
63-
6465if __name__ == "__main__" :
6566 main ()
66- print ('done' )
67-
68- # TODO: Sort label output into core and non core sections
0 commit comments