@@ -17,7 +17,38 @@ class unifies data access for various data fields.
17
17
"""
18
18
from qiskit .providers .models import PulseBackendConfiguration
19
19
from qiskit .providers import BackendV1 , BackendV2
20
- from qiskit .providers .fake_provider import fake_backend , FakeBackendV2 , FakeBackend
20
+ from qiskit .providers .fake_provider import FakeBackendV2 , FakeBackend
21
+
22
+ # One of the FakeBackendV2's was moved from qiskit to qiskit-ibm-runtime. Check
23
+ # both packages until dropping support for qiskit<1
24
+ try :
25
+ from qiskit .providers .fake_provider .fake_backend import FakeBackendV2 as QiskitFakeBackendV2
26
+ except ImportError :
27
+
28
+ class QiskitFakeBackendV2 :
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
+
39
+ try :
40
+ from qiskit_ibm_runtime .fake_provider .fake_backend import FakeBackendV2 as RuntimeFakeBackendV2
41
+ except ImportError :
42
+
43
+ class RuntimeFakeBackendV2 :
44
+ """Dummy class for when FakeBackendV2 import fails
45
+
46
+ This class is only used in isinstance checks. If the import fails, then
47
+ there won't be an instance of the class either so any dummy class is
48
+ fine.
49
+ """
50
+
51
+ pass
21
52
22
53
23
54
class BackendData :
@@ -255,7 +286,9 @@ def is_simulator(self):
255
286
if self ._backend .configuration ().simulator or isinstance (self ._backend , FakeBackend ):
256
287
return True
257
288
if self ._v2 :
258
- if isinstance (self ._backend , (FakeBackendV2 , fake_backend .FakeBackendV2 )):
289
+ if isinstance (
290
+ self ._backend , (FakeBackendV2 , QiskitFakeBackendV2 , RuntimeFakeBackendV2 )
291
+ ):
259
292
return True
260
293
261
294
return False
0 commit comments