From ab1d30e7c112e3a515491964d00bc00a573972f9 Mon Sep 17 00:00:00 2001 From: Coull Date: Mon, 8 Apr 2024 11:19:44 -0700 Subject: [PATCH] tox fix --- src/braket/ir/ahs/hamiltonian.py | 9 +++++---- src/braket/ir/ahs/shifting_field.py | 4 ++-- test/unit_tests/braket/ir/ahs/test_ahs_program_v1.py | 12 ++++++++---- test/unit_tests/braket/task_result/conftest.py | 4 +--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/braket/ir/ahs/hamiltonian.py b/src/braket/ir/ahs/hamiltonian.py index ccb6a46..6036662 100644 --- a/src/braket/ir/ahs/hamiltonian.py +++ b/src/braket/ir/ahs/hamiltonian.py @@ -18,6 +18,7 @@ from braket.ir.ahs.driving_field import DrivingField from braket.ir.ahs.local_detuning import LocalDetuning + class Hamiltonian(BaseModel): """ Specifies the Hamiltonian @@ -34,21 +35,21 @@ class Hamiltonian(BaseModel): drivingFields: List[DrivingField] localDetuning: List[LocalDetuning] = Field(alias="shiftingFields") - + def __getattr__(self, name): if name == "shiftingFields": name = "localDetuning" return self.__dict__[name] - + def __setattr__(self, name, value): if name == "shiftingFields": name = "localDetuning" self.__dict__[name] = value - + def __delattr__(self, name): if name == "shiftingFields": name = "localDetuning" del self.__dict__[name] - + class Config: allow_population_by_field_name = True diff --git a/src/braket/ir/ahs/shifting_field.py b/src/braket/ir/ahs/shifting_field.py index cd79172..eaffdb2 100644 --- a/src/braket/ir/ahs/shifting_field.py +++ b/src/braket/ir/ahs/shifting_field.py @@ -13,8 +13,8 @@ from braket.ir.ahs.local_detuning import LocalDetuning - # The class `ShiftingField` is deprecated. Please use `LocalDetuning` instead. # This file and class will be removed in a future version. -# We are retaining this now to avoid breaking backwards compatibility for users already utilizing this nomenclature. +# We are retaining this now to avoid breaking backwards compatibility for users already +# utilizing this nomenclature. ShiftingField = LocalDetuning diff --git a/test/unit_tests/braket/ir/ahs/test_ahs_program_v1.py b/test/unit_tests/braket/ir/ahs/test_ahs_program_v1.py index 9bf5bcb..d60cd5a 100644 --- a/test/unit_tests/braket/ir/ahs/test_ahs_program_v1.py +++ b/test/unit_tests/braket/ir/ahs/test_ahs_program_v1.py @@ -27,14 +27,18 @@ [3.0e-6, 0.0], [3.0e-6, 3.0e-6], [3.0e-6, 6.0e-6], - ], + ], "filling": [1, 1, 1, 1, 0, 0], } } -@pytest.fixture(params=[ - "shiftingFields", "localDetuning", -]) + +@pytest.fixture( + params=[ + "shiftingFields", + "localDetuning", + ] +) def valid_hamiltonian_input(request): return { "drivingFields": [ diff --git a/test/unit_tests/braket/task_result/conftest.py b/test/unit_tests/braket/task_result/conftest.py index 0f6b6d4..fde6b71 100644 --- a/test/unit_tests/braket/task_result/conftest.py +++ b/test/unit_tests/braket/task_result/conftest.py @@ -139,9 +139,7 @@ def blackbird_program(): ) -@pytest.fixture(params=[ - "shiftingFields", "localDetuning" -]) +@pytest.fixture(params=["shiftingFields", "localDetuning"]) def ahs_program(request): return AHSProgram( setup={