spark: add count_py_files.py - utility to recursively count Python files in directory tree

This commit is contained in:
spark committed 2026-10-30 07:50:28 +00:00
1 parent 04dd709676
commit 86282cd314
1 file changed
+12
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env python3
"""Count Python files in directory tree recursively."""
import sys
from pathlib import Path
def count_py_files(directory: str = ".") -> int:
"""Count Python files in directory tree."""
return len(list(Path(directory).rglob("*.py")))
if __name__ == "__main__":
target = sys.argv[1] if len(sys.argv) > 1 else "."
print(count_py_files(target))