Skip to content

Commit

Permalink
⬆️🪝 Update pre-commit hook astral-sh/ruff-pre-commit to v0.8.4 (#452)
Browse files Browse the repository at this point in the history
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[astral-sh/ruff-pre-commit](https://redirect.github.com/astral-sh/ruff-pre-commit)
| repository | patch | `v0.8.3` -> `v0.8.4` |

Note: The `pre-commit` manager in Renovate is not supported by the
`pre-commit` maintainers or community. Please do not report any problems
there, instead [create a Discussion in the Renovate
repository](https://redirect.github.com/renovatebot/renovate/discussions/new)
if you have any questions.

---

### Release Notes

<details>
<summary>astral-sh/ruff-pre-commit (astral-sh/ruff-pre-commit)</summary>

###
[`v0.8.4`](https://redirect.github.com/astral-sh/ruff-pre-commit/compare/v0.8.3...v0.8.4)

[Compare
Source](https://redirect.github.com/astral-sh/ruff-pre-commit/compare/v0.8.3...v0.8.4)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "every weekend" (UTC), Automerge - At
any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/cda-tum/mqt-bench).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS43Mi41IiwidXBkYXRlZEluVmVyIjoiMzkuNzIuNSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicHJlLWNvbW1pdCJdfQ==-->

---------

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nils Quetschlich <nils.quetschlich@tum.de>
  • Loading branch information
renovate[bot] and nquetschlich authored Dec 21, 2024
1 parent 2e81046 commit a3a4cad
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ repos:

# Python linting and formatting using ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
rev: v0.8.4
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
57 changes: 29 additions & 28 deletions tests/devices/test_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import re
from typing import cast

import pytest
Expand Down Expand Up @@ -41,62 +42,62 @@ def test_device_calibration_errors() -> None:
device = Device(name="test", num_qubits=1, basis_gates=[], coupling_map=[], calibration=None)

# Test all methods with no calibration
with pytest.raises(ValueError, match="Calibration data not available for device test."):
with pytest.raises(ValueError, match=re.escape("Calibration data not available for device test.")):
device.get_single_qubit_gate_fidelity("gate1", 0)
with pytest.raises(ValueError, match="Calibration data not available for device test."):
with pytest.raises(ValueError, match=re.escape("Calibration data not available for device test.")):
device.get_single_qubit_gate_duration("gate1", 0)
with pytest.raises(ValueError, match="Calibration data not available for device test."):
with pytest.raises(ValueError, match=re.escape("Calibration data not available for device test.")):
device.get_two_qubit_gate_fidelity("gate2", 0, 1)
with pytest.raises(ValueError, match="Calibration data not available for device test."):
with pytest.raises(ValueError, match=re.escape("Calibration data not available for device test.")):
device.get_two_qubit_gate_duration("gate2", 0, 1)
with pytest.raises(ValueError, match="Calibration data not available for device test."):
with pytest.raises(ValueError, match=re.escape("Calibration data not available for device test.")):
device.get_readout_fidelity(0)
with pytest.raises(ValueError, match="Calibration data not available for device test."):
with pytest.raises(ValueError, match=re.escape("Calibration data not available for device test.")):
device.get_readout_duration(0)
with pytest.raises(ValueError, match="Calibration data not available for device test."):
with pytest.raises(ValueError, match=re.escape("Calibration data not available for device test.")):
device.sanitize_device()

# Test all methods with missing calibration data
device.calibration = DeviceCalibration()
with pytest.raises(ValueError, match="Gate gate1 not supported by device test."):
with pytest.raises(ValueError, match=re.escape("Gate gate1 not supported by device test.")):
device.get_single_qubit_gate_fidelity("gate1", 0)
with pytest.raises(ValueError, match="Gate gate1 not supported by device test."):
with pytest.raises(ValueError, match=re.escape("Gate gate1 not supported by device test.")):
device.get_single_qubit_gate_duration("gate1", 0)
with pytest.raises(ValueError, match="Gate gate2 not supported by device test."):
with pytest.raises(ValueError, match=re.escape("Gate gate2 not supported by device test.")):
device.get_two_qubit_gate_fidelity("gate2", 0, 1)
with pytest.raises(ValueError, match="Gate gate2 not supported by device test."):
with pytest.raises(ValueError, match=re.escape("Gate gate2 not supported by device test.")):
device.get_two_qubit_gate_duration("gate2", 0, 1)
with pytest.raises(ValueError, match="Readout fidelity values not available."):
with pytest.raises(ValueError, match=re.escape("Readout fidelity values not available.")):
device.get_readout_fidelity(0)
with pytest.raises(ValueError, match="Readout duration values not available."):
with pytest.raises(ValueError, match=re.escape("Readout duration values not available.")):
device.get_readout_duration(0)
with pytest.raises(ValueError, match="Single-qubit gate fidelity values not available."):
with pytest.raises(ValueError, match=re.escape("Single-qubit gate fidelity values not available.")):
device.calibration.get_single_qubit_gate_fidelity("gate_type", 0)
with pytest.raises(ValueError, match="Single-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape("Single-qubit gate duration values not available.")):
device.calibration.get_single_qubit_gate_duration("gate_type", 0)
with pytest.raises(ValueError, match="Two-qubit gate fidelity values not available."):
with pytest.raises(ValueError, match=re.escape("Two-qubit gate fidelity values not available.")):
device.calibration.get_two_qubit_gate_fidelity("gate_type", 0, 1)
with pytest.raises(ValueError, match="Two-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape("Two-qubit gate duration values not available.")):
device.calibration.get_two_qubit_gate_duration("gate_type", 0, 1)
with pytest.raises(ValueError, match="Readout fidelity values not available."):
with pytest.raises(ValueError, match=re.escape("Readout fidelity values not available.")):
device.calibration.get_readout_fidelity(0)
with pytest.raises(ValueError, match="Readout duration values not available."):
with pytest.raises(ValueError, match=re.escape("Readout duration values not available.")):
device.calibration.get_readout_duration(0)
with pytest.raises(ValueError, match="T1 values not available."):
with pytest.raises(ValueError, match=re.escape("T1 values not available.")):
device.calibration.get_t1(0)
with pytest.raises(ValueError, match="T2 values not available."):
with pytest.raises(ValueError, match=re.escape("T2 values not available.")):
device.calibration.get_t2(0)
with pytest.raises(ValueError, match="Single-qubit gate fidelity values not available."):
with pytest.raises(ValueError, match=re.escape("Single-qubit gate fidelity values not available.")):
device.calibration.compute_average_single_qubit_gate_fidelity("gate")
with pytest.raises(ValueError, match="Single-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape("Single-qubit gate duration values not available.")):
device.calibration.compute_average_single_qubit_gate_duration("gate")
with pytest.raises(ValueError, match="Two-qubit gate fidelity values not available."):
with pytest.raises(ValueError, match=re.escape("Two-qubit gate fidelity values not available.")):
device.calibration.compute_average_two_qubit_gate_fidelity("gate")
with pytest.raises(ValueError, match="Two-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape("Two-qubit gate duration values not available.")):
device.calibration.compute_average_two_qubit_gate_duration("gate")
with pytest.raises(ValueError, match="Readout fidelity values not available."):
with pytest.raises(ValueError, match=re.escape("Readout fidelity values not available.")):
device.calibration.compute_average_readout_fidelity()
with pytest.raises(ValueError, match="Readout duration values not available."):
with pytest.raises(ValueError, match=re.escape("Readout duration values not available.")):
device.calibration.compute_average_readout_duration()


Expand All @@ -105,5 +106,5 @@ def test_provider() -> None:
for provider in get_available_providers():
assert provider.provider_name in ["ibm", "rigetti", "oqc", "ionq", "quantinuum", "iqm"]

with pytest.raises(NotFoundError, match="Provider 'test' not found among available providers."):
with pytest.raises(NotFoundError, match=re.escape("Provider 'test' not found among available providers.")):
get_provider_by_name("test")
8 changes: 5 additions & 3 deletions tests/devices/test_ibm_device_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import annotations

import re

import pytest
from qiskit_ibm_runtime.fake_provider import FakeMontrealV2

Expand All @@ -14,7 +16,7 @@ def test_ibm_provider_methods() -> None:
assert IBMProvider.get_available_basis_gates() == [["id", "rz", "sx", "x", "cx", "measure", "barrier"]]
assert IBMProvider.get_native_gates() == ["id", "rz", "sx", "x", "cx", "measure", "barrier"]
assert IBMProvider.get_max_qubits() == 127
with pytest.raises(ValueError, match="Device ibm_unknown not found."):
with pytest.raises(ValueError, match=re.escape("Device ibm_unknown not found.")):
IBMProvider.get_device("ibm_unknown")


Expand Down Expand Up @@ -78,7 +80,7 @@ def test_get_ibm_washington_device() -> None:

for gate in single_qubit_gates:
assert 0 <= device.get_single_qubit_gate_fidelity(gate, q) <= 1
with pytest.raises(ValueError, match="Single-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape("Single-qubit gate duration values not available.")):
device.get_single_qubit_gate_duration(gate, q)

for q0, q1 in device.coupling_map:
Expand All @@ -105,7 +107,7 @@ def test_get_ibmq_montreal_device() -> None:

for gate in single_qubit_gates:
assert 0 <= device.get_single_qubit_gate_fidelity(gate, q) <= 1
with pytest.raises(ValueError, match="Single-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape("Single-qubit gate duration values not available.")):
device.get_single_qubit_gate_duration(gate, q)
for q0, q1 in device.coupling_map:
for gate in two_qubit_gates:
Expand Down
4 changes: 3 additions & 1 deletion tests/devices/test_iqm_device_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import annotations

import re

import pytest

from mqt.bench.devices import IQMProvider
Expand All @@ -19,7 +21,7 @@ def test_iqm_provider_methods() -> None:
assert IQMProvider.get_available_basis_gates() == [["r", "cz", "measure", "barrier"]]
assert IQMProvider.get_native_gates() == ["r", "cz", "measure", "barrier"]
assert IQMProvider.get_max_qubits() == 20
with pytest.raises(ValueError, match="Device iqm_unknown not found."):
with pytest.raises(ValueError, match=re.escape("Device iqm_unknown not found.")):
IQMProvider.get_device("iqm_unknown")


Expand Down
8 changes: 5 additions & 3 deletions tests/devices/test_oqc_device_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import annotations

import re

import pytest

from mqt.bench.devices import OQCProvider
Expand Down Expand Up @@ -29,16 +31,16 @@ def test_oqc_lucy_device() -> None:

for q in range(device.num_qubits):
assert 0 <= device.get_readout_fidelity(q) <= 1
with pytest.raises(ValueError, match="Readout duration values not available."):
with pytest.raises(ValueError, match=re.escape("Readout duration values not available.")):
device.get_readout_duration(q)

for gate in single_qubit_gates:
assert 0 <= device.get_single_qubit_gate_fidelity(gate, q) <= 1
with pytest.raises(ValueError, match="Single-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape("Single-qubit gate duration values not available.")):
device.get_single_qubit_gate_duration(gate, q)

for q0, q1 in device.coupling_map:
for gate in two_qubit_gates:
assert 0 <= device.get_two_qubit_gate_fidelity(gate, q0, q1) <= 1
with pytest.raises(ValueError, match="Two-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape("Two-qubit gate duration values not available.")):
device.get_two_qubit_gate_duration(gate, q0, q1)
8 changes: 5 additions & 3 deletions tests/devices/test_quantinuum_device_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import annotations

import re

import pytest

from mqt.bench.devices import QuantinuumProvider
Expand Down Expand Up @@ -29,16 +31,16 @@ def test_quantinuum_h2_device() -> None:

for q in range(device.num_qubits):
assert 0 <= device.get_readout_fidelity(q) <= 1
with pytest.raises(ValueError, match="Readout duration values not available."):
with pytest.raises(ValueError, match=re.escape(r"Readout duration values not available.")):
device.get_readout_duration(q)

for gate in single_qubit_gates:
assert 0 <= device.get_single_qubit_gate_fidelity(gate, q) <= 1
with pytest.raises(ValueError, match="Single-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape(r"Single-qubit gate duration values not available.")):
device.get_single_qubit_gate_duration(gate, q)

for q0, q1 in device.coupling_map:
for gate in two_qubit_gates:
assert 0 <= device.get_two_qubit_gate_fidelity(gate, q0, q1) <= 1
with pytest.raises(ValueError, match="Two-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape(r"Two-qubit gate duration values not available.")):
device.get_two_qubit_gate_duration(gate, q0, q1)
8 changes: 5 additions & 3 deletions tests/devices/test_rigetti_device_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import annotations

import re

import pytest

from mqt.bench.devices import RigettiProvider
Expand Down Expand Up @@ -29,16 +31,16 @@ def test_rigetti_aspen_m3_device() -> None:

for q in range(device.num_qubits):
assert 0 <= device.get_readout_fidelity(q) <= 1
with pytest.raises(ValueError, match="Readout duration values not available."):
with pytest.raises(ValueError, match=re.escape("Readout duration values not available.")):
device.get_readout_duration(q)

for gate in single_qubit_gates:
assert 0 <= device.get_single_qubit_gate_fidelity(gate, q) <= 1
with pytest.raises(ValueError, match="Single-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape("Single-qubit gate duration values not available.")):
device.get_single_qubit_gate_duration(gate, q)

for q0, q1 in device.coupling_map:
for gate in two_qubit_gates:
assert 0 <= device.get_two_qubit_gate_fidelity(gate, q0, q1) <= 1
with pytest.raises(ValueError, match="Two-qubit gate duration values not available."):
with pytest.raises(ValueError, match=re.escape("Two-qubit gate duration values not available.")):
device.get_two_qubit_gate_duration(gate, q0, q1)

0 comments on commit a3a4cad

Please sign in to comment.