Skip to content

Commit

Permalink
style: lint Python code with Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and github-actions committed Oct 29, 2024
1 parent e454ddb commit 8c99ffc
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 36 deletions.
2 changes: 1 addition & 1 deletion tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"""

from .main import main
from .report_static import write_summary
from .report_diff import generate_diff_report
from .report_static import write_summary

__version__ = "0.1.1"
__author__ = "CHAINS research project at KTH Royal Institute of Technology"
Expand Down
3 changes: 2 additions & 1 deletion tool/compare_commits.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import requests
import logging
import os

import requests
from tool_config import setup_cache

github_token = os.getenv("GITHUB_API_TOKEN")
Expand Down
2 changes: 1 addition & 1 deletion tool/compare_packages.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
import logging
import re


def parse_dependencies(file_path):
Expand Down
10 changes: 5 additions & 5 deletions tool/extract_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
Support npm, yarn classic, yarn berry, pnpm
"""

import re
import os
import subprocess
import json
import logging
import sys
import os
import re
import shutil
import yaml
import subprocess
import sys
from collections import defaultdict

import yaml
from tool_config import PNPM_LIST_COMMAND

logger = logging.getLogger(__name__)
Expand Down
12 changes: 6 additions & 6 deletions tool/get_pr_info.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import requests
import sqlite3
import os
import json
import time
import copy
import json
import logging
import os
import sqlite3
import time

import requests

GITHUB_TOKEN = os.getenv("GITHUB_API_TOKEN")
# if not GITHUB_TOKEN:
Expand Down Expand Up @@ -111,7 +111,7 @@ def fetch_pull_requests(commit_node_id):
if response.status_code != 200:
# retry 10 sec later and try 5 times
for i in range(5):
print(f"Retrying in 10 seconds...")
print("Retrying in 10 seconds...")
time.sleep(10)
response = requests.post(url, data=body, headers=headers)
if response.status_code == 200:
Expand Down
10 changes: 5 additions & 5 deletions tool/get_pr_review.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import requests
import sqlite3
import os
from pathlib import Path
import json
import copy
import json
import logging
import os
import sqlite3
from pathlib import Path

import requests

GITHUB_TOKEN = os.getenv("GITHUB_API_TOKEN")

Expand Down
3 changes: 2 additions & 1 deletion tool/get_user_commit_info.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import requests
import copy
import os
import sqlite3
import time
from pathlib import Path

import requests
from tool_config import setup_cache

script_dir = Path(__file__).parent.absolute()
Expand Down
7 changes: 4 additions & 3 deletions tool/github_repo.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import json
import logging
import os
import subprocess
import re
import json
import sqlite3
import logging
import subprocess
from pathlib import Path

from tqdm import tqdm

# from datetime import datetime
Expand Down
15 changes: 8 additions & 7 deletions tool/report_diff.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pandas as pd
from datetime import datetime

import pandas as pd


def process_data(data):
record = []
Expand Down Expand Up @@ -184,7 +185,7 @@ def generate_diff_report(data, project_repo_name, release_version_old, release_v
if downgraded_number > 0:
f.write("\n")
f.write(
f"""
"""
<details>
<summary>Downgraded packages</summary>
"""
Expand All @@ -198,7 +199,7 @@ def generate_diff_report(data, project_repo_name, release_version_old, release_v
if both_new_commits > 0:
f.write("\n")
f.write(
f"""
"""
<details>
<summary>Both Authors and Reviewers are new to the repository </summary>
"""
Expand All @@ -211,7 +212,7 @@ def generate_diff_report(data, project_repo_name, release_version_old, release_v
if new_author_commits > 0:
f.write("\n")
f.write(
f"""
"""
<details>
<summary>Authors are new to the repository </summary>
"""
Expand All @@ -224,7 +225,7 @@ def generate_diff_report(data, project_repo_name, release_version_old, release_v
if new_reviewer_commits > 0:
f.write("\n")
f.write(
f"""
"""
<details>
<summary>Reviewers are new to the repository </summary>
"""
Expand All @@ -234,9 +235,9 @@ def generate_diff_report(data, project_repo_name, release_version_old, release_v
f.write("\n")
f.write("</details>")

f.write(f"---\n")
f.write("---\n")
f.write(
f"\nReport created by [dirty-waters](https://github.com/chains-project/dirty-waters/) - version: commit.\n"
"\nReport created by [dirty-waters](https://github.com/chains-project/dirty-waters/) - version: commit.\n"
)
f.write(f"\nReport created on {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")

Expand Down
1 change: 1 addition & 0 deletions tool/report_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import subprocess
from datetime import datetime

import pandas as pd


Expand Down
8 changes: 3 additions & 5 deletions tool/static_analysis.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import base64
import json
import logging
import os
import base64
import time
import urllib.parse
from tqdm import tqdm

import requests

import tool_config
import logging
from compare_commits import tag_format as construct_tag_format

from tqdm import tqdm

github_token = os.getenv("GITHUB_API_TOKEN")

Expand Down
2 changes: 1 addition & 1 deletion tool/tool_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"""

import datetime
import pathlib
import logging
import pathlib

import requests_cache

Expand Down

0 comments on commit 8c99ffc

Please sign in to comment.