Release 11.0 (full): passage readings held back when the sentence leaves out a question word, the judge names the step it refused, the part format v1, anyone's sealed test, the sleep cycle, and the six orbiters as files in the pack (part 6)
555998c verified Download workbench/orbiters.py from psiloceyeben/oracle7: direct link, hf CLI and curl.
- Browser
- Download file 3.68 kB
-
https://huggingface.co/psiloceyeben/oracle7/resolve/main/workbench/orbiters.py
- Command line
-
hf download hf://psiloceyeben/oracle7/workbench/orbiters.py
-
curl -L -o orbiters.py https://huggingface.co/psiloceyeben/oracle7/resolve/main/workbench/orbiters.py
3.68 kB
| """orbiters (10.5) - the six orbiters as files in the pack. `oracle7.py orbiters` lists them with what each needs, `oracle7.py orbiters exam | |
| [name]` runs its exam from the pack, and `oracle7.py <name> ...` runs its tool. An orbiter that needs something missing says what, and | |
| every other part of Oracle7 keeps working. Files are in the release root, so verify, the anchor and update cover them.""" | |
| import importlib.util | |
| import json | |
| import shutil | |
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parent.parent / "orbiters" | |
| TOOLS = {"vision": "exam_pack.py", "trafficcop": "eval_routing.py", "deepspace": "eval/run_scenarios.py", "chameleon": "exam_pack.py", "artist": "exam_pack.py", "sensors": "exam_pack.py"} | |
| def cards(): | |
| return [json.load(open(c, encoding="utf-8")) for c in sorted(ROOT.glob("*/orbiter.json"))] | |
| def missing(card): | |
| """what this machine lacks for this orbiter""" | |
| out = [m for m in card.get("python", []) if importlib.util.find_spec(m) is None] | |
| out += [x for x in card.get("programs", []) if shutil.which(x) is None] | |
| return out | |
| def run_exam(card, timeout=900): | |
| lack = missing(card) | |
| if lack: | |
| return {"name": card["name"], "status": "needs " + ", ".join(lack)} | |
| try: | |
| p = subprocess.run([sys.executable, "exam_pack.py"], cwd=ROOT / card["name"], capture_output=True, text=True, timeout=timeout) | |
| except subprocess.TimeoutExpired: | |
| return {"name": card["name"], "status": "timed out"} | |
| last = (p.stdout.strip().splitlines() or ["{}"])[-1] | |
| try: | |
| r = json.loads(last) | |
| except ValueError: | |
| r = {"passed": False, "detail": (p.stderr or p.stdout)[-300:]} | |
| return dict(r, name=card["name"], status="passed" if r.get("passed") else "failed") | |
| def fetch(name): | |
| """an orbiter's packages, each checked against the lockfile in this pack, with no install scripts run""" | |
| d = ROOT / name | |
| if not (d / "pnpm-lock.yaml").exists(): | |
| print("%s has nothing to fetch" % name) | |
| return 0 | |
| runner = shutil.which("pnpm") or shutil.which("npx") | |
| if runner is None: | |
| print("%s needs node, with npx or pnpm" % name) | |
| return 1 | |
| cmd = [runner] + (["pnpm@9"] if runner.endswith(("npx", "npx.cmd")) else []) + ["install", "--frozen-lockfile", "--ignore-scripts"] | |
| return subprocess.call(cmd, cwd=d) | |
| def main(a): | |
| all_ = cards() | |
| if a[:1] == ["fetch"]: | |
| return fetch(a[1] if len(a) > 1 else "chameleon") | |
| if a[:1] == ["night"] and len(a) > 1: # the orbiter's own sleep: what stopped it, as typed holes, and what it can fill | |
| return subprocess.call([sys.executable, "night.py"] + a[2:], cwd=ROOT / a[1]) | |
| if a[:1] == ["exam"]: | |
| rows = [run_exam(c) for c in all_ if len(a) < 2 or c["name"] == a[1]] | |
| for r in rows: | |
| print("%-11s %s %s" % (r["name"], r["status"], r.get("summary", r.get("detail", "")))) | |
| return 0 if all(r["status"] != "failed" for r in rows) else 1 | |
| for c in all_: | |
| lack = missing(c) | |
| print("%-11s %s\n %s" % (c["name"], c["good_for"], "ready" if not lack else "needs " + ", ".join(lack))) | |
| return 0 | |
| def tool(name, a): | |
| """oracle7.py <name> ...: the orbiter's own entry""" | |
| card = next((c for c in cards() if c["name"] == name), None) | |
| lack = missing(card) | |
| if lack: | |
| print("%s needs %s" % (name, ", ".join(lack))) | |
| return 1 | |
| return subprocess.call([sys.executable, card.get("tool", TOOLS[name])] + list(a), cwd=ROOT / name) | |
| if __name__ == "__main__": | |
| sys.exit(main(sys.argv[1:])) | |