Skip to content

Commit

Permalink
[QI2-1068] Address (pre)review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
NischalQuTech committed Sep 2, 2024
1 parent 71ff67e commit 5939917
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
13 changes: 6 additions & 7 deletions qiskit_quantuminspire/qi_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class QIProvider:
def __init__(self) -> None:
self._qiskit_backends = self._construct_backends()

def _fetch_qi_backend_metadata(self) -> List[Metadata]:
def _fetch_qi_backend_metadata(self, backend_type: BackendType) -> Metadata:
"""Fetch backend metadata using api client."""
return [Metadata(id=1, backend_id=1, created_on=datetime.now(timezone.utc), data={"nqubits": 6})]
return Metadata(id=1, backend_id=1, created_on=datetime.now(timezone.utc), data={"nqubits": 6})

def _fetch_qi_backend_types(self) -> List[BackendType]:
"""Fetch backend types from CJM using api client."""
Expand All @@ -39,15 +39,14 @@ def _fetch_qi_backend_types(self) -> List[BackendType]:
def _construct_backends(self) -> List[QIBackend]:
"""Construct QIBackend using fetched backendtypes and metadata."""
qi_backend_types = self._fetch_qi_backend_types()
qi_metadata = self._fetch_qi_backend_metadata()
qi_backends = [
QIBackend(provider=self, backend_type=backend_type, metadata=metadata)
for backend_type, metadata in zip(qi_backend_types, qi_metadata)
QIBackend(provider=self, backend_type=backend_type, metadata=self._fetch_qi_backend_metadata(backend_type))
for backend_type in qi_backend_types
]
return qi_backends

def backends(self, name: Union[str, None] = None, **kwargs: Any) -> List[QIBackend]:
return self._construct_backends()
return self._qiskit_backends

def get_backend(self, name: Union[str, None] = None, **kwargs: Any) -> QIBackend:
return self._construct_backends()[0]
return self._qiskit_backends[0]
4 changes: 0 additions & 4 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
from qiskit_quantuminspire.qi_provider import QIProvider


def test_dummy() -> None:
assert True


def test_flow() -> None:
provider = QIProvider()
backend = provider.get_backend("Some-Backend")
Expand Down

0 comments on commit 5939917

Please sign in to comment.