mirror of
https://github.com/karma-riuk/crab.git
synced 2025-07-05 05:28:13 +02:00
formatted file
This commit is contained in:
@ -3,13 +3,14 @@ from datetime import datetime
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
from github import Github
|
from github import Github
|
||||||
from utils import has_only_1_round_of_comments, has_only_1_comment, move_github_logging_to_file
|
from utils import has_only_1_round_of_comments, has_only_1_comment, move_logger_to_file
|
||||||
|
|
||||||
tqdm.pandas()
|
tqdm.pandas()
|
||||||
|
|
||||||
# Initialize GitHub API client
|
# Initialize GitHub API client
|
||||||
g = Github(os.environ["GITHUB_AUTH_TOKEN_CRAB"])
|
g = Github(os.environ["GITHUB_AUTH_TOKEN_CRAB"])
|
||||||
|
|
||||||
|
|
||||||
def process_pull(repo, pull):
|
def process_pull(repo, pull):
|
||||||
commits = pull.get_commits()
|
commits = pull.get_commits()
|
||||||
comments = pull.get_review_comments()
|
comments = pull.get_review_comments()
|
||||||
@ -24,6 +25,7 @@ def process_pull(repo, pull):
|
|||||||
"has_only_1_comment": has_only_1_comment(commits, comments),
|
"has_only_1_comment": has_only_1_comment(commits, comments),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def process_repo(repo_name):
|
def process_repo(repo_name):
|
||||||
repo = g.get_repo(repo_name)
|
repo = g.get_repo(repo_name)
|
||||||
stats = []
|
stats = []
|
||||||
@ -37,6 +39,7 @@ def process_repo(repo_name):
|
|||||||
stats.append(process_pull(repo, pull))
|
stats.append(process_pull(repo, pull))
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
repos = pd.read_csv("results.csv")
|
repos = pd.read_csv("results.csv")
|
||||||
repos = repos[(repos["good_repo_for_crab"] == True) & (repos["n_tests"] > 0)]
|
repos = repos[(repos["good_repo_for_crab"] == True) & (repos["n_tests"] > 0)]
|
||||||
@ -51,6 +54,7 @@ def main():
|
|||||||
finally:
|
finally:
|
||||||
pd.DataFrame(stats).to_csv("pr_stats.csv", index=False)
|
pd.DataFrame(stats).to_csv("pr_stats.csv", index=False)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
move_github_logging_to_file()
|
move_logger_to_file()
|
||||||
main()
|
main()
|
||||||
|
Reference in New Issue
Block a user