Download tools/smoke_lab.py from tailot/lingologos-thinkingpython: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/datasets/tailot/lingologos-thinkingpython/resolve/main/tools/smoke_lab.py
- Command line
-
hf download hf://datasets/tailot/lingologos-thinkingpython/tools/smoke_lab.py
-
curl -L -o smoke_lab.py https://huggingface.co/datasets/tailot/lingologos-thinkingpython/resolve/main/tools/smoke_lab.py
1.08 kB
| """Smoke run: one request per shape, against a copy of the lab fixture.""" | |
| import json | |
| import os | |
| import shutil | |
| import sys | |
| import tempfile | |
| ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| sys.path.insert(0, ROOT) | |
| sys.path.insert(0, os.path.join(ROOT, "tools")) | |
| import ask # noqa: E402 | |
| LAB = os.path.join(ROOT, "fixtures", "lab") | |
| REQUESTS_FILE = os.path.join(ROOT, "catalog", "smoke_requests.json") | |
| def requests() -> list: | |
| with open(REQUESTS_FILE, "r", encoding="utf-8") as handle: | |
| return [(r["lang"], r["text"]) for r in json.load(handle)["requests"]] | |
| def main() -> int: | |
| for lang, request in requests(): | |
| temp = tempfile.mkdtemp(prefix="labcheck_") | |
| work = os.path.join(temp, "lab") | |
| shutil.copytree(LAB, work) | |
| code = ask.main(["--workspace", work, "--request", request, "--lang", lang, | |
| "--in-process"]) | |
| print("exit=%d %s %s" % (code, lang, request)) | |
| shutil.rmtree(temp, ignore_errors=True) | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |