pyqasm.load

load(filename, **kwargs)[source]

Loads an OpenQASM program into a QasmModule object.

Parameters:
  • filename (str) – The filename of the OpenQASM program to validate.

  • **kwargs – Forwarded to loads(); see it for the supported names.

Raises:
  • TypeError – If filename is not a string, or if an unrecognized keyword argument is passed.

  • FileNotFoundError – If the file does not exist.

  • ValueError – If a numeric keyword argument is zero or negative.

  • 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