Skip to content

Commit

Permalink
🎨 pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] authored and renovate[bot] committed Oct 26, 2024
1 parent 1f2d67b commit 633b31c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/mqt/qudits/quantum_circuit/gates/cx.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def validate_parameter(parameter: Parameter) -> bool:
assert isinstance(parameter[1], int)
assert isinstance(parameter[2], int)
assert isinstance(parameter[3], float)
assert (
0 <= parameter[0] < parameter[1]
), f"lev_a and lev_b are out of range or in wrong order: {parameter[0]}, {parameter[1]}"
assert 0 <= parameter[0] < parameter[1], (
f"lev_a and lev_b are out of range or in wrong order: {parameter[0]}, {parameter[1]}"
)
assert 0 <= parameter[3] <= 2 * np.pi, f"Angle should be in the range [0, 2*pi]: {parameter[2]}"

return True
Expand Down
6 changes: 3 additions & 3 deletions src/mqt/qudits/quantum_circuit/gates/gellmann.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def validate_parameter(param: Parameter) -> bool:
assert isinstance(parameter[0], int)
assert isinstance(parameter[1], int)
assert isinstance(parameter[2], str)
assert (
0 <= parameter[0] < parameter[1]
), f"lev_a and lev_b are out of range or in wrong order: {parameter[0]}, {parameter[1]}"
assert 0 <= parameter[0] < parameter[1], (
f"lev_a and lev_b are out of range or in wrong order: {parameter[0]}, {parameter[1]}"
)
assert isinstance(parameter[2], str), "type parameter should be a string"

return True
Expand Down
6 changes: 3 additions & 3 deletions src/mqt/qudits/quantum_circuit/gates/ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ def validate_parameter(parameter: Parameter) -> bool:
return False

if isinstance(parameter, list):
assert (
0 <= cast(float, parameter[0]) <= 2 * np.pi
), f"Angle should be in the range [0, 2*pi]: {parameter[0]}"
assert 0 <= cast(float, parameter[0]) <= 2 * np.pi, (
f"Angle should be in the range [0, 2*pi]: {parameter[0]}"
)
return True
if isinstance(parameter, np.ndarray):
# Add validation for numpy array if needed
Expand Down
6 changes: 3 additions & 3 deletions src/mqt/qudits/quantum_circuit/gates/perm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def validate_parameter(self, parameter: Parameter) -> bool:
"""Verify that the input is a list of indices"""
dims = self.dimensions
p = cast(list[int], parameter)
assert all(
(0 <= num < len(parameter) and num < dims) for num in p
), "Numbers are not within the range of the list length"
assert all((0 <= num < len(parameter) and num < dims) for num in p), (
"Numbers are not within the range of the list length"
)

return True

Expand Down

0 comments on commit 633b31c

Please sign in to comment.