Download tools/diagnose.py from tailot/lingologos-thinkingpython: direct link, hf CLI and curl.
- Browser
- Download file 919 Bytes
-
https://huggingface.co/datasets/tailot/lingologos-thinkingpython/resolve/main/tools/diagnose.py
- Command line
-
hf download hf://datasets/tailot/lingologos-thinkingpython/tools/diagnose.py
-
curl -L -o diagnose.py https://huggingface.co/datasets/tailot/lingologos-thinkingpython/resolve/main/tools/diagnose.py
919 Bytes
| """Print the transcript of one session, for diagnosis.""" | |
| 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) | |
| from lingologos_thinkingpython.orchestrator import MultiInstanceOrchestrator # noqa: E402 | |
| LAB = os.path.join(ROOT, "fixtures", "lab") | |
| def main() -> int: | |
| request = sys.argv[1] if len(sys.argv) > 1 else "remove the mutable default in collect" | |
| lang = sys.argv[2] if len(sys.argv) > 2 else "en" | |
| temp = tempfile.mkdtemp(prefix="labdiag_") | |
| work = os.path.join(temp, "lab") | |
| shutil.copytree(LAB, work) | |
| orch = MultiInstanceOrchestrator.from_default() | |
| report = orch.run_session(work, request, lang) | |
| print(json.dumps(report, indent=2, ensure_ascii=False)[:6000]) | |
| shutil.rmtree(temp, ignore_errors=True) | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |