Load ``.xqasm`` text or ``.xqb`` bytecode.
(path: Path, *, text: bool)
| 43 | |
| 44 | |
| 45 | def _load_program(path: Path, *, text: bool) -> Program: |
| 46 | """Load ``.xqasm`` text or ``.xqb`` bytecode.""" |
| 47 | if text or path.suffix == ".xqasm": |
| 48 | source = path.read_text(encoding="utf-8") |
| 49 | return program_from_xqasm(source, name=path.stem) |
| 50 | if path.suffix == ".xqb": |
| 51 | return program_from_bytecode(path.read_bytes(), name=path.stem) |
| 52 | raise SystemExit( |
| 53 | f"xqvm-py: unknown file extension {path.suffix!r}; pass a .xqasm " |
| 54 | "source (or use --text to force text interpretation)." |
| 55 | ) |
| 56 | |
| 57 | |
| 58 | def _build_input_data(args: argparse.Namespace) -> dict[int, Any]: |
no test coverage detected