Skip to content

Commit

Permalink
tox fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Coull committed Apr 10, 2024
1 parent 37d3576 commit e75100a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
14 changes: 7 additions & 7 deletions src/braket/circuits/angled_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,18 +438,18 @@ def _get_angles(
"""Gets the angle with all values substituted in that are requested.
Args:
gate Union[DoubleAngledGate, TripleAngledGate]: The subclass of multi angle AngledGate for which the angle is being
obtained.
gate (Union[DoubleAngledGate, TripleAngledGate]): The subclass of multi angle AngledGate for
which the angle is being obtained.
**kwargs (FreeParameterExpression | str): The named parameters that are being filled
for a particular gate.
Returns:
Union[DoubleAngledGate, TripleAngledGate]: A new gate of the type of the AngledGate originally used with all angles
updated.
Union[DoubleAngledGate, TripleAngledGate]: A new gate of the type of the AngledGate
originally used with all angles updated.
"""
angles = [f'angle_{i + 1}' for i in range(len(gate._parameters))]
new_angles_args = {angle:
(
angles = [f"angle_{i + 1}" for i in range(len(gate._parameters))]
new_angles_args = {
angle: (
getattr(gate, angle).subs(kwargs)
if isinstance(getattr(gate, angle), FreeParameterExpression)
else getattr(gate, angle)
Expand Down
6 changes: 5 additions & 1 deletion src/braket/circuits/gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -3406,7 +3406,11 @@ def prx(
"""
return [
Instruction(
PRx(angle_1, angle_2), target=qubit, control=control, control_state=control_state, power=power
PRx(angle_1, angle_2),
target=qubit,
control=control,
control_state=control_state,
power=power,
)
for qubit in QubitSet(target)
]
Expand Down
7 changes: 3 additions & 4 deletions test/unit_tests/braket/circuits/test_gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ class SingleNegControlModifier:
]



invalid_unitary_matrices = [
(np.array([[1]])),
(np.array([1])),
Expand Down Expand Up @@ -866,13 +865,13 @@ def test_ir_gate_level(testclass, subroutine_name, irclass, irsubclasses, kwargs
Gate.PRx(angle_1=0.17, angle_2=3.45),
[4],
OpenQASMSerializationProperties(qubit_reference_type=QubitReferenceType.VIRTUAL),
f"prx(0.17, 3.45) q[4];",
"prx(0.17, 3.45) q[4];",
),
(
Gate.PRx(angle_1=0.17, angle_2=3.45),
[4],
OpenQASMSerializationProperties(qubit_reference_type=QubitReferenceType.PHYSICAL),
f"prx(0.17, 3.45) $4;",
"prx(0.17, 3.45) $4;",
),
(
Gate.MS(angle_1=0.17, angle_2=3.45),
Expand Down Expand Up @@ -1043,7 +1042,7 @@ def test_large_unitary():
def test_bind_values(gate):
double_angled = gate.__name__ in ["PRx"]
triple_angled = gate.__name__ in ("MS", "U")
num_params = 1
num_params = 1
if triple_angled:
num_params = 3
elif double_angled:
Expand Down

0 comments on commit e75100a

Please sign in to comment.