Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using deprecated BaseBackend class #1501

Merged
merged 2 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions qiskit/providers/aer/noise/noise_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from numpy import ndarray

from qiskit.circuit import Instruction, Delay
from qiskit.providers import BaseBackend, BackendV1, BackendV2
from qiskit.providers.exceptions import BackendPropertyError
from qiskit.providers.models import BackendProperties
from qiskit.transpiler import PassManager
Expand Down Expand Up @@ -303,10 +302,14 @@ def from_backend(cls, backend,
Raises:
NoiseError: If the input backend is not valid.
"""
if isinstance(backend, BackendV2):
backend_interface_version = getattr(backend, "version", None)
if not isinstance(backend_interface_version, int):
backend_interface_version = 0

if backend_interface_version == 2:
raise NoiseError(
"NoiseModel.from_backend does not currently support V2 Backends.")
if isinstance(backend, (BaseBackend, BackendV1)):
if backend_interface_version <= 1:
properties = backend.properties()
configuration = backend.configuration()
basis_gates = configuration.basis_gates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from warnings import warn
from collections import OrderedDict
from qiskit.providers import BaseBackend, Backend
from qiskit.providers import Backend
from ...aererror import AerError
from .hamiltonian_model import HamiltonianModel

Expand Down Expand Up @@ -94,7 +94,7 @@ def from_backend(cls, backend, subsystem_list=None):
AerError: If channel or u_channel_lo are invalid.
"""

if not isinstance(backend, (BaseBackend, Backend)):
if not isinstance(backend, Backend):
raise AerError("{} is not a Qiskit backend".format(backend))

# get relevant information from backend
Expand Down