autoqasm.errors module

Errors raised in the AutoQASM build process.

exception autoqasm.errors.AutoQasmError[source]

Bases: Exception

Base class for all AutoQASM exceptions.

exception autoqasm.errors.AutoQasmTypeError[source]

Bases: AutoQasmError

Generic type error.

exception autoqasm.errors.UnsupportedFeatureError[source]

Bases: AutoQasmError

AutoQASM unsupported feature.

exception autoqasm.errors.ParameterTypeError[source]

Bases: AutoQasmError

AutoQASM parameter type error.

exception autoqasm.errors.MissingParameterTypeError[source]

Bases: AutoQasmError

AutoQASM requires type hints for subroutine parameters.

exception autoqasm.errors.ParameterNotFoundError[source]

Bases: AutoQasmError

A FreeParameter could not be found in the program.

exception autoqasm.errors.InvalidGateDefinition[source]

Bases: AutoQasmError

Gate definition does not meet the necessary requirements.

exception autoqasm.errors.InvalidCalibrationDefinition[source]

Bases: AutoQasmError

Calibration definition does not meet the necessary requirements.

exception autoqasm.errors.InvalidTargetQubit[source]

Bases: AutoQasmError

Target qubit is invalid in the current context.

exception autoqasm.errors.UnsupportedGate[source]

Bases: AutoQasmError

Gate is not supported by the target device.

exception autoqasm.errors.UnsupportedNativeGate[source]

Bases: AutoQasmError

Native gate is not supported by the target device.

exception autoqasm.errors.VerbatimBlockNotAllowed[source]

Bases: AutoQasmError

Verbatim block is not supported by the target device.

exception autoqasm.errors.UnknownQubitCountError[source]

Bases: AutoQasmError

Missing declaration for the number of qubits.

exception autoqasm.errors.OutsideProgramContextError(feature: str | None = None)[source]

Bases: AutoQasmError

Raised when an AutoQASM feature is used outside of an active program context (i.e. outside a function decorated with @aq.main / @aq.subroutine / @aq.gate).

Parameters:

feature (str | None) – The name of the AutoQASM feature being invoked outside of an active program context, if known. Used to produce a slightly more pointed error message.

exception autoqasm.errors.BuildError[source]

Bases: AutoQasmError

Non-AutoQasmError raised during program construction, wrapped with actionable guidance pointing back to the user’s code.

The original exception is preserved via __cause__.

exception autoqasm.errors.InsufficientQubitCountError[source]

Bases: AutoQasmError

Target device does not have enough qubits for the program.

exception autoqasm.errors.UnsupportedConditionalExpressionError(true_type: type | None, false_type: type | None)[source]

Bases: AutoQasmError

Conditional expressions which return values are not supported.

exception autoqasm.errors.InvalidAssignmentStatement[source]

Bases: AutoQasmError

Invalid assignment statement for an AutoQASM variable.

exception autoqasm.errors.InvalidArrayDeclaration[source]

Bases: AutoQasmError

Invalid declaration of an AutoQASM array variable.

exception autoqasm.errors.UnsupportedSubroutineReturnType[source]

Bases: AutoQasmError

Unsupported return type for an AutoQASM subroutine.

exception autoqasm.errors.NameConflict[source]

Bases: AutoQasmError

Name conflict between user-named variables.

exception autoqasm.errors.NestedMainProgramError[source]

Bases: AutoQasmError

Main program nested inside another main program.