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. include_dir is consumed here, and is tried before the directory of the including file.

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

  • FileNotFoundError – If the file does not exist, or an included file is not found.

  • 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