refactor: Simplify tags URL construction and remove unused import

This commit is contained in:
Paul Gauthier (aider) 2025-03-12 13:52:55 -07:00
parent ae6192111d
commit 1ab5238405

View file

@ -3,7 +3,6 @@
import json import json
import os import os
import sys import sys
from pathlib import Path
import requests import requests
@ -50,10 +49,12 @@ def main():
_, _, _, owner, repo = repo_url.rstrip("/").split("/") _, _, _, owner, repo = repo_url.rstrip("/").split("/")
# Construct the raw file URL # Construct the raw file URL
# Build the GitHub raw content path
base_url = f"https://raw.githubusercontent.com/{owner}/{repo}/{branch}"
if directory: if directory:
tags_url = f"https://raw.githubusercontent.com/{owner}/{repo}/{branch}/{directory}/queries/tags.scm" tags_url = f"{base_url}/{directory}/queries/tags.scm"
else: else:
tags_url = f"https://raw.githubusercontent.com/{owner}/{repo}/{branch}/queries/tags.scm" tags_url = f"{base_url}/queries/tags.scm"
# Create the language directory in the output path # Create the language directory in the output path
lang_dir = os.path.join(output_dir, lang) lang_dir = os.path.join(output_dir, lang)