mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-03 13:14:31 +03:00
Split check and fmt tools
This commit is contained in:
parent
9e43700f55
commit
569ff3d372
|
@ -1,8 +1,11 @@
|
||||||
"""
|
"""
|
||||||
Sort imports, format code, type-check and run offline tests.
|
Check formatting, type-check and run offline tests.
|
||||||
"""
|
"""
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
BLACK_IGNORE = r"tl/(abcs|functions|types)/\w+.py"
|
||||||
|
|
||||||
|
|
||||||
def run(*args: str) -> int:
|
def run(*args: str) -> int:
|
||||||
|
@ -10,12 +13,14 @@ def run(*args: str) -> int:
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
exit(
|
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||||
run("isort", ".", "--profile", "black", "--gitignore")
|
exit(
|
||||||
or run("black", ".", "--extend-exclude", r"tl/(abcs|functions|types)/\w+.py")
|
run("isort", ".", "-c", "--profile", "black", "--gitignore")
|
||||||
or run("mypy", "--strict", ".")
|
or run("black", ".", "--check", "--extend-exclude", BLACK_IGNORE)
|
||||||
or run("pytest", ".", "-m", "not net")
|
or run("mypy", "--strict", ".")
|
||||||
)
|
or run("sphinx", "-nW", "client/doc", tmp_dir)
|
||||||
|
or run("pytest", ".", "-m", "not net")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
22
tools/fmt.py
Normal file
22
tools/fmt.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user