@@ -17,7 +17,36 @@ 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
+ pass
36
+
37
+
38
+ try :
39
+ from qiskit_ibm_runtime .fake_provider .fake_backend import FakeBackendV2 as RuntimeFakeBackendV2
40
+ except ImportError :
41
+
42
+ class RuntimeFakeBackendV2 :
43
+ """Dummy class for when FakeBackendV2 import fails
44
+
45
+ This class is only used in isinstance checks. If the import fails, then
46
+ there won't be an instance of the class either so any dummy class is
47
+ fine.
48
+ """
49
+ pass
21
50
22
51
23
52
class BackendData :
@@ -255,7 +284,9 @@ def is_simulator(self):
255
284
if self ._backend .configuration ().simulator or isinstance (self ._backend , FakeBackend ):
256
285
return True
257
286
if self ._v2 :
258
- if isinstance (self ._backend , (FakeBackendV2 , fake_backend .FakeBackendV2 )):
287
+ if isinstance (
288
+ self ._backend , (FakeBackendV2 , QiskitFakeBackendV2 , RuntimeFakeBackendV2 )
289
+ ):
259
290
return True
260
291
261
292
return False
0 commit comments