Spaces:
Paused
Paused
Download scripts/verify_v050a5.py from ThomasHeisig/Brain-5D-Space: direct link, hf CLI and curl.
- Browser
- Download file 1.59 kB
-
https://huggingface.co/spaces/ThomasHeisig/Brain-5D-Space/resolve/main/scripts/verify_v050a5.py
- Command line
-
hf download hf://spaces/ThomasHeisig/Brain-5D-Space/scripts/verify_v050a5.py
-
curl -L -o verify_v050a5.py https://huggingface.co/spaces/ThomasHeisig/Brain-5D-Space/resolve/main/scripts/verify_v050a5.py
1.59 kB
| """Quality gate for Brain-5D v0.5.0-alpha.5.""" | |
| from __future__ import annotations | |
| import shutil | |
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def run(*args: str) -> None: | |
| print("+", " ".join(args), flush=True) | |
| subprocess.run(list(args), cwd=ROOT, check=True) | |
| def run_module(module: str, *args: str) -> None: | |
| run(sys.executable, "-m", module, *args) | |
| def main() -> int: | |
| run_module("pytest", "-v", "-m", "not slow") | |
| run_module( | |
| "pytest", | |
| "-v", | |
| "tests/test_structural_journal.py", | |
| "tests/test_structural_recovery.py", | |
| "tests/test_structural_undo.py", | |
| "tests/test_structural_heatmap.py", | |
| "tests/test_auto_approval.py", | |
| ) | |
| run_module("mypy", "src") | |
| run_module("black", "--check", "src", "tests", "scripts") | |
| try: | |
| run_module("pyright", "src", "scripts", "tests") | |
| except subprocess.CalledProcessError: | |
| executable = shutil.which("pyright") | |
| if executable is None: | |
| raise RuntimeError( | |
| "Pyright is a required quality gate but is not installed" | |
| ) | |
| run(executable, "src", "scripts", "tests") | |
| pylint = shutil.which("pylint") | |
| if pylint is None: | |
| raise RuntimeError("Pylint is a required quality gate but is not installed") | |
| run(pylint, "src") | |
| git = shutil.which("git") | |
| if git is None: | |
| raise RuntimeError("git is required for diff validation") | |
| run(git, "diff", "--check") | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |