diff --git a/src/braket/experimental/autoqasm/__init__.py b/src/braket/experimental/autoqasm/__init__.py index 0e4f6231a..adc69a3b4 100644 --- a/src/braket/experimental/autoqasm/__init__.py +++ b/src/braket/experimental/autoqasm/__init__.py @@ -45,4 +45,4 @@ def my_program(): from .program import Program, build_program, verbatim # noqa: F401 from .transpiler import transpiler # noqa: F401 from .types import ArrayVar, BitVar, BoolVar, FloatVar, IntVar # noqa: F401 -from .types import QasmRange as range # noqa: F401 +from .types import Range as range # noqa: F401 diff --git a/src/braket/experimental/autoqasm/program/program.py b/src/braket/experimental/autoqasm/program/program.py index 9b582534d..302f5fe4d 100644 --- a/src/braket/experimental/autoqasm/program/program.py +++ b/src/braket/experimental/autoqasm/program/program.py @@ -629,12 +629,12 @@ def else_block(self) -> contextlib._GeneratorContextManager: return self._control_flow_block(oqpy.Else(oqpy_program)) def for_in( - self, iterator: aq_types.QasmRange, iterator_name: Optional[str] + self, iterator: aq_types.Range, iterator_name: Optional[str] ) -> contextlib._GeneratorContextManager: """Sets the program conversion context into a for loop context. Args: - iterator (QasmRange): The iterator of the for loop. + iterator (Range): The iterator of the for loop. iterator_name (Optional[str]): The symbol to use as the name of the iterator. Yields: diff --git a/src/braket/experimental/autoqasm/types/__init__.py b/src/braket/experimental/autoqasm/types/__init__.py index 630c5873b..a909b9a87 100644 --- a/src/braket/experimental/autoqasm/types/__init__.py +++ b/src/braket/experimental/autoqasm/types/__init__.py @@ -16,12 +16,4 @@ """ from .conversions import map_parameter_type, var_type_from_oqpy, wrap_value # noqa: F401 -from .types import ( # noqa: F401 - ArrayVar, - BitVar, - BoolVar, - FloatVar, - IntVar, - QasmRange, - is_qasm_type, -) +from .types import ArrayVar, BitVar, BoolVar, FloatVar, IntVar, Range, is_qasm_type # noqa: F401 diff --git a/src/braket/experimental/autoqasm/types/types.py b/src/braket/experimental/autoqasm/types/types.py index 081fa9e72..4cb3ebc89 100644 --- a/src/braket/experimental/autoqasm/types/types.py +++ b/src/braket/experimental/autoqasm/types/types.py @@ -43,7 +43,7 @@ def is_qasm_type(val: Any) -> bool: return isinstance(val, qasm_types) -class QasmRange(oqpy.Range): +class Range(oqpy.Range): def __init__( self, start: int, @@ -64,7 +64,7 @@ def __init__( if stop is None: stop = start start = 0 - super(QasmRange, self).__init__(start, stop, step) + super(Range, self).__init__(start, stop, step) self.annotations = annotations or [] diff --git a/test/unit_tests/braket/experimental/autoqasm/test_operators.py b/test/unit_tests/braket/experimental/autoqasm/test_operators.py index 75438e9c3..7abbcc620 100644 --- a/test/unit_tests/braket/experimental/autoqasm/test_operators.py +++ b/test/unit_tests/braket/experimental/autoqasm/test_operators.py @@ -180,7 +180,7 @@ def test_control_flow_for_loop_qasm() -> None: """Tests aq.operators.for_stmt with a QASM iterable.""" with aq.build_program(aq.program.UserConfig(num_qubits=10)) as program_conversion_context: aq.operators.for_stmt( - iter=aq.types.QasmRange(3), + iter=aq.types.Range(3), extra_test=None, body=for_body, get_state=None, diff --git a/test/unit_tests/braket/experimental/autoqasm/test_types.py b/test/unit_tests/braket/experimental/autoqasm/test_types.py index caa2d7b2b..0084f8933 100644 --- a/test/unit_tests/braket/experimental/autoqasm/test_types.py +++ b/test/unit_tests/braket/experimental/autoqasm/test_types.py @@ -17,7 +17,7 @@ import pytest import braket.experimental.autoqasm as aq -from braket.experimental.autoqasm.types import QasmRange +from braket.experimental.autoqasm.types import Range @pytest.mark.parametrize( @@ -30,14 +30,14 @@ def test_range( range_params: tuple[int, int, int], expected_range_params: tuple[int, int, int] ) -> None: - """Test `QasmRange()` returning correct `QasmRange` object. + """Test `Range()` returning correct `Range` object. Args: - range_params (tuple[int, int, int]): Range parameters to instantiate `QasmRange` + range_params (tuple[int, int, int]): Range parameters to instantiate `Range` expected_range_params (tuple[int, int, int]): Expected range parameters """ start, stop, step = range_params - qrange = QasmRange(start, stop, step) + qrange = Range(start, stop, step) assert isinstance(qrange, oqpy.Range) assert (qrange.start, qrange.stop, qrange.step) == expected_range_params