Skip to content

Commit

Permalink
Merge branch 'main' into fix_from_backend
Browse files Browse the repository at this point in the history
  • Loading branch information
doichanj authored Jul 8, 2024
2 parents a0eb927 + ad1209b commit 07acf07
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
39 changes: 35 additions & 4 deletions qiskit_aer/aerprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""Provider for Aer backends."""


from qiskit.providers import ProviderV1 as Provider
from qiskit.providers import QiskitBackendNotFoundError
from qiskit.providers.providerutils import filter_backends

from .backends.aer_simulator import AerSimulator
Expand All @@ -23,10 +23,11 @@
from .backends.unitary_simulator import UnitarySimulator


class AerProvider(Provider):
class AerProvider:
"""Provider for Aer backends."""

_BACKENDS = None
version = 1

@staticmethod
def _get_backends():
Expand Down Expand Up @@ -64,10 +65,40 @@ def _get_backends():
return AerProvider._BACKENDS

def get_backend(self, name=None, **kwargs):
return super().get_backend(name=name, **kwargs)
"""Return a single Aer backend matching the specified filtering.
Args:
name (str): name of the Aer backend.
**kwargs: dict used for filtering.
Returns:
Backend: an Aer backend matching the filtering.
Raises:
QiskitBackendNotFoundError: if no backend could be found or
more than one backend matches the filtering criteria.
"""
backends = self.backends(name, **kwargs)
if len(backends) > 1:
raise QiskitBackendNotFoundError("More than one backend matches the criteria")
if not backends:
raise QiskitBackendNotFoundError("No backend matches the criteria")

return backends[0]

def backends(self, name=None, filters=None, **kwargs):
# pylint: disable=arguments-differ
"""Return a list of backends matching the specified filtering.
Args:
name (str): name of the backend.
filters (callable): filtering conditions as a callable.
**kwargs: dict used for filtering.
Returns:
list[Backend]: a list of Backends that match the filtering
criteria.
"""
# pylint: disable=unused-argument
# Instantiate a new backend instance so if config options
# are set they will only last as long as that backend object exists
backends = []
Expand Down
5 changes: 5 additions & 0 deletions releasenotes/notes/providerABC-61311d8e5ae56d71.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
The class :class:`.AerProvider` does not implement Qiskit's ``Provider``, as it is now deprecated.
This fix removes the raising of the warning from Qiskit.

0 comments on commit 07acf07

Please sign in to comment.