Skip to content

Commit dc7c6ba

Browse files
committed
chore: fix ruff linting errors
1 parent 6ca3efa commit dc7c6ba

3 files changed

Lines changed: 9 additions & 18 deletions

File tree

.github/scripts/calculate_release_details.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env python3
2+
import glob
3+
import json
24
import os
35
import re
46
import subprocess
5-
import json
6-
import glob
77
from datetime import datetime
88

99

@@ -38,7 +38,7 @@ def main():
3838
manifest_path = manifest_files[0]
3939
domain = os.path.basename(os.path.dirname(manifest_path))
4040

41-
with open(manifest_path, "r", encoding="utf-8") as f:
41+
with open(manifest_path, encoding="utf-8") as f:
4242
manifest = json.load(f)
4343

4444
friendly_name = manifest.get("name", domain)
@@ -49,10 +49,7 @@ def main():
4949
if os.path.exists("docs"):
5050
docs_url = f"https://{owner}.github.io/{repo_name}/"
5151
else:
52-
if repo:
53-
docs_url = f"https://github.com/{repo}"
54-
else:
55-
docs_url = f"https://github.com/faserf/{repo_name}"
52+
docs_url = f"https://github.com/{repo}" if repo else f"https://github.com/faserf/{repo_name}"
5653

5754
# Calculate version via version_manager
5855
bump_args = [
@@ -126,10 +123,7 @@ def main():
126123

127124
# Count commits
128125
total_commit_count = 0
129-
if changelog_from:
130-
count_range = f"{changelog_from}..HEAD"
131-
else:
132-
count_range = "HEAD"
126+
count_range = f"{changelog_from}..HEAD" if changelog_from else "HEAD"
133127

134128
commit_count_raw = run_git(["rev-list", "--count", count_range])
135129
if commit_count_raw.isdigit():

.github/scripts/version_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def get_current_version(manifest_path=None):
4747
except (subprocess.CalledProcessError, IndexError, ValueError):
4848
pass
4949
if manifest_path and os.path.exists(manifest_path):
50-
with open(manifest_path, "r", encoding="utf-8") as f:
50+
with open(manifest_path, encoding="utf-8") as f:
5151
return json.load(f).get("version", "1.0.0")
5252
return "1.0.0"
5353

@@ -56,14 +56,14 @@ def write_version(v, manifest_path=None):
5656
if manifest_path is None:
5757
manifest_path = MANIFEST_FILE
5858
if manifest_path and os.path.exists(manifest_path):
59-
with open(manifest_path, "r", encoding="utf-8") as f:
59+
with open(manifest_path, encoding="utf-8") as f:
6060
data = json.load(f)
6161
data["version"] = v
6262
with open(manifest_path, "w", encoding="utf-8") as f:
6363
json.dump(data, f, indent=2)
6464
f.write("\n")
6565
if os.path.exists("pyproject.toml"):
66-
with open("pyproject.toml", "r", encoding="utf-8") as f:
66+
with open("pyproject.toml", encoding="utf-8") as f:
6767
content = f.read()
6868
content = re.sub(
6969
r'^version\s*=\s*".*?"', f'version = "{v}"', content, flags=re.MULTILINE

scripts/generate_changelog.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,7 @@ def main():
198198
bucket = TYPE_MAP[raw_type]
199199

200200
desc_cap = desc[0].upper() + desc[1:] if desc else desc
201-
if raw_scope:
202-
display = f"**{raw_scope}:** {desc_cap}"
203-
else:
204-
display = desc_cap
201+
display = f"**{raw_scope}:** {desc_cap}" if raw_scope else desc_cap
205202
else:
206203
display = msg[0].upper() + msg[1:] if msg else msg
207204
msg_lower = msg.lower()

0 commit comments

Comments
 (0)