Skip to content

Commit 428c9bc

Browse files
authored
Remove FakeBackendV2 import deprecated in Qiskit 0.46 (#1420)
### Summary In qiskit 0.46, several classes in the `qiskit.providers.fake_provider` module were deprecated, including `qiskit.providers.fake_provider.fake_backend.FakeBackendV2`. However, the removal PR failed to address this particular class, so while this particular `FakeBackendV2` was no longer part of the public API, the import path would still work. This oversight will be addressed in Qiskit/qiskit#11997, but in order to merge this PR we must make sure that all the downstream libraries covered by `qiskit-neko` are up-to-date with the change. This change adds an alternative import path for this class in qiskit-experiments. It follows the pattern from other 1.0 import deprecations. The removal would roll out in the 1.1 release, but it is indicated as a 1.0 removal because that is when it should have technically taken place. ### Details and comments Blocks Qiskit/qiskit#11997.
1 parent 6845440 commit 428c9bc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

qiskit_experiments/framework/backend_data.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,24 @@ class unifies data access for various data fields.
1818
from qiskit.providers.models import PulseBackendConfiguration
1919
from qiskit.providers import BackendV1, BackendV2
2020
from qiskit.providers.fake_provider import FakeBackend
21-
from qiskit.providers.fake_provider.fake_backend import FakeBackendV2
2221
from qiskit.utils.deprecation import deprecate_func
2322

23+
try:
24+
# Removed in Qiskit 1.0.
25+
from qiskit.providers.fake_provider.fake_backend import FakeBackendV2
26+
except ImportError:
27+
28+
class FakeBackendV2:
29+
"""Dummy class for when FakeBackendV2 import fails
30+
31+
This class is only used in isinstance checks. If the import fails, then
32+
there won't be an instance of the class either so any dummy class is
33+
fine.
34+
"""
35+
36+
pass
37+
38+
2439
try:
2540
# Removed in Qiskit 1.0. Different from the other FakeBackendV2's
2641
from qiskit.providers.fake_provider import QiskitFakeBackendV2

0 commit comments

Comments
 (0)