autoqasm.types.types module

AutoQASM types and type utilities.

autoqasm.types.types.is_qasm_type(val: Any) bool[source]

Returns whether the provided object is of a QASM type or is itself a QASM type which receives special treatment by AutoQASM.

Parameters:

val (Any) – The object of which to check the type.

Returns:

bool – Whether the object is a QASM type.

autoqasm.types.types.make_annotations_list(annotations: str | Iterable[str] | None) list[str][source]
autoqasm.types.types.is_qubit_identifier_type(qubit: Any) bool[source]

Checks if a given object is a qubit identifier type.

Parameters:

qubit (Any) – The object to check.

Returns:

bool – True if the object is a qubit identifier type, False otherwise.

class autoqasm.types.types.Range(start: int, stop: int | None = None, step: int | None = 1, annotations: str | Iterable[str] | None = None)[source]

Bases: Range

Creates a range definition.

Parameters:
  • start (int) – Start of the range.

  • stop (int | None) – End of the range. Defaults to None.

  • step (int | None) – Step of the range. Defaults to 1.

  • annotations (str | Iterable[str] | None) – Annotations for the range.

class autoqasm.types.types.ArrayVar(init_expression: Iterable, *args, annotations: str | Iterable[str] | None = None, **kwargs)[source]

Bases: ArrayVar

class autoqasm.types.types.BitVar(*args, annotations: str | Iterable[str] | None = None, **kwargs)[source]

Bases: BitVar

class autoqasm.types.types.BoolVar(*args, annotations: str | Iterable[str] | None = None, **kwargs)[source]

Bases: BoolVar

class autoqasm.types.types.FloatVar(*args, annotations: str | Iterable[str] | None = None, **kwargs)[source]

Bases: FloatVar

class autoqasm.types.types.IntVar(*args, annotations: str | Iterable[str] | None = None, **kwargs)[source]

Bases: IntVar