This commit is contained in:
2026-01-21 20:35:19 -08:00
parent 06af9b30ac
commit d94e321148
13 changed files with 19 additions and 180 deletions
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env python3
"""Format all tracked Python files using the repo's YAPF style.
This script intentionally formats only files tracked by git to avoid touching
files that are ignored (e.g., venv, site-packages).
"""
import subprocess
import sys
try:
out = subprocess.check_output(["git", "ls-files", "*.py"]).decode("utf-8")
except subprocess.CalledProcessError as exc:
print("Failed to get tracked files from git:", exc, file=sys.stderr)
sys.exit(1)
files = [f for f in (line.strip() for line in out.splitlines()) if f]
print(f"Formatting {len(files)} tracked python files...")
if not files:
print("No tracked python files found.")
sys.exit(0)
for path in files:
print(path)
subprocess.run([sys.executable, "-m", "yapf", "-i", "--style", ".style.yapf", path], check=False)
print("Done")