Skip to content

Commit

Permalink
Allow measure to accept any iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
rmshaffer committed Oct 26, 2023
1 parent d07115c commit 09ef788
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/braket/experimental/autoqasm/instructions/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,26 @@ def my_program():
"""


from collections.abc import Iterable
from typing import Union

from braket.experimental.autoqasm import program
from braket.experimental.autoqasm import types as aq_types
from braket.experimental.autoqasm.instructions.qubits import QubitIdentifierType, _qubit


def measure(qubits: Union[QubitIdentifierType, list[QubitIdentifierType]]) -> aq_types.BitVar:
def measure(qubits: Union[QubitIdentifierType, Iterable[QubitIdentifierType]]) -> aq_types.BitVar:
"""Add qubit measurement statements to the program and assign the measurement
results to bit variables.
Args:
qubits (Union[QubitIdentifierType, list[QubitIdentifierType]]): The target qubits
qubits (Union[QubitIdentifierType, Iterable[QubitIdentifierType]]): The target qubits
to measure.
Returns:
BitVar: Bit variable the measurement results are assigned to.
"""
if not isinstance(qubits, list):
if not isinstance(qubits, Iterable):
qubits = [qubits]

oqpy_program = program.get_program_conversion_context().get_oqpy_program()
Expand Down

0 comments on commit 09ef788

Please sign in to comment.