MCPcopy Create free account
hub / github.com/QuipNetwork/xquad / _load_program

Function _load_program

xqvm_py/cli/run.py:45–55  ·  view source on GitHub ↗

Load ``.xqasm`` text or ``.xqb`` bytecode.

(path: Path, *, text: bool)

Source from the content-addressed store, hash-verified

43
44
45def _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
58def _build_input_data(args: argparse.Namespace) -> dict[int, Any]:

Callers 1

mainFunction · 0.85

Calls 2

program_from_xqasmFunction · 0.90
program_from_bytecodeFunction · 0.90

Tested by

no test coverage detected