Split check and fmt tools

This commit is contained in:
Lonami Exo
2023-09-13 20:15:49 +02:00
parent 9e43700f55
commit 569ff3d372
2 changed files with 34 additions and 7 deletions

22
tools/fmt.py Normal file
View File

@@ -0,0 +1,22 @@
"""
Sort imports and format code.
"""
import subprocess
import sys
BLACK_IGNORE = r"tl/(abcs|functions|types)/\w+.py"
def run(*args: str) -> int:
return subprocess.run((sys.executable, "-m", *args)).returncode
def main() -> None:
exit(
run("isort", ".", "--profile", "black", "--gitignore")
or run("black", ".", "--extend-exclude", BLACK_IGNORE)
)
if __name__ == "__main__":
main()