mirror of
https://github.com/Z3Prover/z3
synced 2026-03-15 01:29:59 +00:00
run black and ruff on all skill scripts
This commit is contained in:
parent
9d674404c8
commit
621638abb9
7 changed files with 103 additions and 60 deletions
15
.github/skills/encode/scripts/encode.py
vendored
15
.github/skills/encode/scripts/encode.py
vendored
|
|
@ -15,7 +15,6 @@ from pathlib import Path
|
|||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent.parent / "shared"))
|
||||
from z3db import Z3DB, run_z3, setup_logging
|
||||
|
||||
|
||||
VALIDATION_TIMEOUT = 5
|
||||
|
||||
|
||||
|
|
@ -41,7 +40,10 @@ def validate(formula: str, z3_bin: str = None, debug: bool = False) -> dict:
|
|||
Returns a dict with 'valid' (bool), 'errors' (list), and 'raw' output.
|
||||
"""
|
||||
result = run_z3(
|
||||
formula, z3_bin=z3_bin, timeout=VALIDATION_TIMEOUT, debug=debug,
|
||||
formula,
|
||||
z3_bin=z3_bin,
|
||||
timeout=VALIDATION_TIMEOUT,
|
||||
debug=debug,
|
||||
)
|
||||
errors = find_errors(result["stdout"]) + find_errors(result["stderr"])
|
||||
|
||||
|
|
@ -72,8 +74,10 @@ def report_errors(errors: list, formula: str):
|
|||
def write_output(formula: str, output_path: str, fmt: str):
|
||||
"""Write the validated formula to a file or stdout."""
|
||||
if fmt == "python":
|
||||
print("python format output is generated by the agent, "
|
||||
"not by this script", file=sys.stderr)
|
||||
print(
|
||||
"python format output is generated by the agent, " "not by this script",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
if output_path:
|
||||
|
|
@ -131,7 +135,8 @@ def main():
|
|||
for err in result["errors"]:
|
||||
db.log_finding(run_id, "syntax", err, severity="error")
|
||||
db.finish_run(
|
||||
run_id, "error",
|
||||
run_id,
|
||||
"error",
|
||||
result["raw"]["duration_ms"],
|
||||
result["raw"]["exit_code"],
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue