From c9797a1dded3d4dd6678fa2047fe7f3106ce6022 Mon Sep 17 00:00:00 2001 From: Diogo Gaspar Date: Tue, 29 Oct 2024 19:31:49 +0100 Subject: [PATCH] fix: add ruff suggestions --- tool/extract_deps.py | 6 +++--- tool/get_pr_info.py | 1 - tool/get_pr_review.py | 2 +- tool/github_repo.py | 1 - tool/main.py | 3 +-- tool/report_diff.py | 6 +++--- 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/tool/extract_deps.py b/tool/extract_deps.py index af649a48..c1d369b1 100644 --- a/tool/extract_deps.py +++ b/tool/extract_deps.py @@ -39,8 +39,8 @@ def extract_deps_from_pnpm_lockfile(pnpm_lockfile_yaml): # pkg_name_with_resolution = set() deps_list_data = {} - package_keys = sorted(list(yaml_data.get("packages", {}).keys())) - patches = sorted(list(yaml_data.get("patchedDependencies", {}).keys())) + package_keys = sorted(yaml_data.get("packages", {}).keys()) + patches = sorted(yaml_data.get("patchedDependencies", {}).keys()) deps_list_data = { "resolutions": package_keys, @@ -90,7 +90,7 @@ def extract_deps_from_npm(npm_lock_file): pkg_name_with_resolution.add(f"{package_name}@{package_info['version']}") deps_list_data = { - "resolutions": sorted(list(pkg_name_with_resolution)), + "resolutions": sorted(pkg_name_with_resolution), "patches": patches, } diff --git a/tool/get_pr_info.py b/tool/get_pr_info.py index 3bfba401..72ee484d 100644 --- a/tool/get_pr_info.py +++ b/tool/get_pr_info.py @@ -139,7 +139,6 @@ def get_pr_info(data): for author in authors: commit_sha = author.get("sha") commit_node_id = author.get("node_id") - commit_url = author.get("commit_url") c.execute( "SELECT pr_data FROM pr_info_sample WHERE commit_node_id=?", diff --git a/tool/get_pr_review.py b/tool/get_pr_review.py index 71352493..c188e86d 100644 --- a/tool/get_pr_review.py +++ b/tool/get_pr_review.py @@ -72,7 +72,7 @@ def get_first_pr_info(search_string): } } } - + """ diff --git a/tool/github_repo.py b/tool/github_repo.py index 58cc889e..ed0b3971 100644 --- a/tool/github_repo.py +++ b/tool/github_repo.py @@ -186,7 +186,6 @@ def get_github_repo_url(folder, dep_list, pm): pbar.update(1) # Write collected data to files - unique_repos_output = sorted(set(repos_output)) outputs = { # "github_repo_all.txt": repos_output, # "github_repo_unique.txt": unique_repos_output, diff --git a/tool/main.py b/tool/main.py index 33c339d3..d8b857f6 100644 --- a/tool/main.py +++ b/tool/main.py @@ -81,10 +81,9 @@ def get_args(): parser.add_argument( "-pm", "--package-manager", - choices=["yarn-berry", "yarn-classic", "pnpm", "maven"], required=True, help="The package manager used in the project.", - choices=["yarn-classic", "yarn-berry", "pnpm", "npm"], + choices=["yarn-classic", "yarn-berry", "pnpm", "npm", "maven"], ) parser.add_argument( "--pnpm-scope", diff --git a/tool/report_diff.py b/tool/report_diff.py index caa6256c..d724cfcc 100644 --- a/tool/report_diff.py +++ b/tool/report_diff.py @@ -109,9 +109,9 @@ def create_dataframe(record): def filter_df(df): - df_author_first = df[(df["author_first"] == True)] - df_review_first = df[df["prr_first"] == True] - df_both_first = df[(df["author_first"] == True) & (df["prr_first"] == True)] + df_author_first = df[(df["author_first"])] + df_review_first = df[df["prr_first"]] + df_both_first = df[(df["author_first"]) & (df["prr_first"])] return df_author_first, df_review_first, df_both_first