Skip to content

Commit 02b11a0

Browse files
⬆️🪝 update pre-commit hooks (#140)
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](astral-sh/ruff-pre-commit@v0.9.10...v0.11.0) <!--pre-commit.ci end--> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent bd2246f commit 02b11a0

5 files changed

Lines changed: 17 additions & 17 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ repos:
5656
types_or: [yaml, markdown, html, css, javascript, json]
5757

5858
- repo: https://github.com/astral-sh/ruff-pre-commit
59-
rev: v0.9.10
59+
rev: v0.11.0
6060
hooks:
6161
- id: ruff
6262
args: ["--fix", "--show-fixes"]

resource_estimation/RE_experiments.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@
100100
def modified_logical_counts(space_factor: float, time_factor: float):
101101
return LogicalCounts(
102102
{
103-
"numQubits": int(ceil(logical_counts["numQubits"] * space_factor)),
104-
"tCount": int(ceil(logical_counts["tCount"] * time_factor)),
105-
"rotationCount": int(ceil(logical_counts["rotationCount"] * time_factor)),
106-
"rotationDepth": int(ceil(logical_counts["rotationDepth"] * time_factor)),
107-
"cczCount": int(ceil(logical_counts["cczCount"] * time_factor)),
108-
"measurementCount": int(ceil(logical_counts["measurementCount"] * time_factor)),
103+
"numQubits": ceil(logical_counts["numQubits"] * space_factor),
104+
"tCount": ceil(logical_counts["tCount"] * time_factor),
105+
"rotationCount": ceil(logical_counts["rotationCount"] * time_factor),
106+
"rotationDepth": ceil(logical_counts["rotationDepth"] * time_factor),
107+
"cczCount": ceil(logical_counts["cczCount"] * time_factor),
108+
"measurementCount": ceil(logical_counts["measurementCount"] * time_factor),
109109
}
110110
)
111111

src/mqt/problemsolver/satellitesolver/ImagingLocation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ def get_imaging_attempt(self) -> int:
2828

2929
def get_average_satellite_position(self) -> np.ndarray[Any, np.dtype[np.float64]]:
3030
longitude = 2 * np.pi / ORBIT_DURATION * self.imaging_attempt
31-
return cast(np.ndarray[Any, np.dtype[np.float64]], R_S * np.array([np.cos(longitude), np.sin(longitude), 0]))
31+
return cast("np.ndarray[Any, np.dtype[np.float64]]", R_S * np.array([np.cos(longitude), np.sin(longitude), 0]))
3232

3333
def get_longitude_angle(self) -> float:
3434
# Returns longitude of the acquisition request
3535
temp = self.position * np.array([1, 1, 0])
3636
temp /= np.linalg.norm(temp)
37-
return cast(float, np.arccos(temp[0]) if temp[1] >= 0 else 2 * np.pi - np.arccos(temp[0]))
37+
return cast("float", np.arccos(temp[0]) if temp[1] >= 0 else 2 * np.pi - np.arccos(temp[0]))
3838

3939
def get_latitude_angle(self) -> float:
4040
# Returns latitude of the acquisition request
41-
return cast(float, np.arccos(self.position[2] / R_E))
41+
return cast("float", np.arccos(self.position[2] / R_E))
4242

4343
def get_coordinates(self) -> tuple[str, str]:
4444
# Returns position of the acquisition request as GPS coordinates

src/mqt/problemsolver/satellitesolver/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def get_success_ratio(ac_reqs: list[LocationRequest], qubo: QuadraticProgram, so
4141
# sum over all LocationRequests and sum over their imaging_attempt_score if the respective indicator in sol[index] is 1
4242
solution_vector = solution_vector[::-1]
4343
return cast(
44-
float,
44+
"float",
4545
(
4646
sum(
4747
[
@@ -71,7 +71,7 @@ def create_acquisition_position(
7171
np.cos(latitude),
7272
]
7373
)
74-
return cast(np.ndarray[Any, np.dtype[np.float64]], res)
74+
return cast("np.ndarray[Any, np.dtype[np.float64]]", res)
7575

7676

7777
def calc_needed_time_between_acquisition_attempts(
@@ -85,12 +85,12 @@ def calc_needed_time_between_acquisition_attempts(
8585
theta = np.arccos(delta_r1 @ delta_r2 / (np.linalg.norm(delta_r1) * np.linalg.norm(delta_r2)))
8686
result = theta / (ROTATION_SPEED_SATELLITE * 2 * np.pi)
8787

88-
return cast(np.ndarray[Any, np.dtype[np.float64]], result)
88+
return cast("np.ndarray[Any, np.dtype[np.float64]]", result)
8989

9090

9191
def transition_possible(acq_1: LocationRequest, acq_2: LocationRequest) -> bool:
9292
"""Returns True if transition between acq_1 and acq_2 is possible, False otherwise"""
93-
t_maneuver = cast(float, calc_needed_time_between_acquisition_attempts(acq_1, acq_2))
93+
t_maneuver = cast("float", calc_needed_time_between_acquisition_attempts(acq_1, acq_2))
9494
t1 = acq_1.imaging_attempt
9595
t2 = acq_2.imaging_attempt
9696
if t1 < t2:
@@ -187,4 +187,4 @@ def convert_docplex_to_qubo(model: Model, penalty: int | None = None) -> Quadrat
187187
def get_longitude(vector: np.ndarray[Any, np.dtype[np.float64]]) -> float:
188188
temp = vector * np.array([1, 1, 0])
189189
temp /= np.linalg.norm(temp)
190-
return cast(float, np.arccos(temp[0]) if temp[1] >= 0 else 2 * np.pi - np.arccos(temp[0]))
190+
return cast("float", np.arccos(temp[0]) if temp[1] >= 0 else 2 * np.pi - np.arccos(temp[0]))

src/mqt/problemsolver/tsp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def simulate(self, qc: QuantumCircuit) -> str:
216216
job = execute(qc, backend, shots=1000)
217217
count = job.result().get_counts()
218218

219-
return cast(str, count.most_frequent())
219+
return cast("str", count.most_frequent())
220220

221221
def get_classical_result(self) -> list[int]:
222222
distance_matrix = np.array(
@@ -229,7 +229,7 @@ def get_classical_result(self) -> list[int]:
229229
)
230230
permutation, distance = solve_tsp_dynamic_programming(distance_matrix)
231231

232-
return cast(list[int], (np.array(permutation) + 1).T)
232+
return cast("list[int]", (np.array(permutation) + 1).T)
233233

234234
def controlled_unitary(
235235
self, qc: QuantumCircuit, qubits: list[QuantumRegister], phases: list[float]

0 commit comments

Comments
 (0)