pyqasm.loads

loads(program, **kwargs)[source]

Loads an OpenQASM program into a QasmModule object.

Parameters:
  • program (openqasm3.ast.Program or str) – The OpenQASM program to validate.

  • **kwargs – Additional arguments to pass to the loads function. device_qubits (int): Number of physical qubits available on the target device. device_cycle_time (float): The duration of a hardware device cycle, in seconds. compiler_angle_type_size (int): The width of the angle type in the compiler. extern_functions (dict): Dictionary of extern functions to be added to the module.

Raises:
  • TypeError – If the input is not a string or an openqasm3.ast.Program instance.

  • ValidationError – If the program fails parsing or semantic validation.

Returns:

An object containing the parsed qasm representation along with

some useful metadata and methods

Return type:

QasmModule