Skip to content

Commit

Permalink
Happify ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Boschero authored and S-Linde committed Sep 19, 2024
1 parent 3ddb210 commit 1af958e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion opensquirrel/exporter/quantify_scheduler_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def visit_bloch_sphere_rotation(self, g: BlochSphereRotation) -> None:
# Rxy rotation.
theta = round(math.degrees(g.angle), FIXED_POINT_DEG_PRECISION)
phi: float = round(math.degrees(math.atan2(g.axis[1], g.axis[0])), FIXED_POINT_DEG_PRECISION)
self.schedule.add(quantify_scheduler_gates.Rxy(theta=theta, phi=phi, qubit=self._get_qubit_string(Qubit(g.qubit))))
self.schedule.add(
quantify_scheduler_gates.Rxy(theta=theta, phi=phi, qubit=self._get_qubit_string(Qubit(g.qubit)))
)
return

if abs(g.axis[0]) < ATOL and abs(g.axis[1]) < ATOL:
Expand Down
3 changes: 1 addition & 2 deletions opensquirrel/ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections.abc import Callable, Sequence
from dataclasses import dataclass
from functools import wraps
from typing import Any, SupportsFloat, SupportsInt, Union, cast, overload, get_args
from typing import Any, SupportsFloat, SupportsInt, Union, cast, get_args, overload

import numpy as np
from numpy.typing import ArrayLike, DTypeLike, NDArray
Expand Down Expand Up @@ -555,7 +555,6 @@ def __init__(

self.matrix = matrix


def __repr__(self) -> str:
return f"MatrixGate(qubits={self.operands}, matrix={repr_round(self.matrix)})"

Expand Down
12 changes: 11 additions & 1 deletion opensquirrel/utils/matrix_expander.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@
import numpy as np
from numpy.typing import NDArray

from opensquirrel.ir import Axis, AxisLike, BlochSphereRotation, ControlledGate, Gate, IRVisitor, MatrixGate, Qubit, QubitLike
from opensquirrel.ir import (
Axis,
AxisLike,
BlochSphereRotation,
ControlledGate,
Gate,
IRVisitor,
MatrixGate,
Qubit,
QubitLike,
)


def get_reduced_ket(ket: int, qubits: Iterable[QubitLike]) -> int:
Expand Down

0 comments on commit 1af958e

Please sign in to comment.