style: Format Python script with linter

This commit is contained in:
Paul Gauthier (aider) 2025-03-12 13:54:36 -07:00
parent a6ebed8d16
commit 5f125c1812

View file

@ -61,11 +61,11 @@ def main():
sys.exit(1) sys.exit(1)
print(f"Found {len(lang_defs)} language definitions") print(f"Found {len(lang_defs)} language definitions")
# Process each language # Process each language
successes = 0 successes = 0
total = len(lang_defs) total = len(lang_defs)
for lang, config in lang_defs.items(): for lang, config in lang_defs.items():
print(f"Processing {lang}...") print(f"Processing {lang}...")
@ -87,7 +87,7 @@ def main():
if len(parts) < 5: if len(parts) < 5:
print(f"Skipping {lang}: Invalid GitHub URL format") print(f"Skipping {lang}: Invalid GitHub URL format")
continue continue
owner = parts[-2] owner = parts[-2]
repo = parts[-1] repo = parts[-1]
@ -101,19 +101,19 @@ def main():
# 1. Branch specified in the config # 1. Branch specified in the config
# 2. Default branch from GitHub API # 2. Default branch from GitHub API
# 3. Common branch names (main, master, etc.) # 3. Common branch names (main, master, etc.)
branches_to_try = [] branches_to_try = []
# 1. Branch from config (if specified) # 1. Branch from config (if specified)
config_branch = config.get("branch") config_branch = config.get("branch")
if config_branch: if config_branch:
branches_to_try.append(config_branch) branches_to_try.append(config_branch)
# 2. Default branch from GitHub API # 2. Default branch from GitHub API
default_branch = get_default_branch(owner, repo) default_branch = get_default_branch(owner, repo)
if default_branch and default_branch not in branches_to_try: if default_branch and default_branch not in branches_to_try:
branches_to_try.append(default_branch) branches_to_try.append(default_branch)
# 3. Add common branch names # 3. Add common branch names
for branch in common_branches: for branch in common_branches:
if branch not in branches_to_try: if branch not in branches_to_try:
@ -127,10 +127,10 @@ def main():
success = True success = True
successes += 1 successes += 1
break break
if not success: if not success:
print(f"Failed to download tags for {lang} after trying all branches") print(f"Failed to download tags for {lang} after trying all branches")
# Be nice to GitHub's API # Be nice to GitHub's API
time.sleep(0.1) time.sleep(0.1)