Skip to content

Commit

Permalink
Merge pull request qBraid#510 from qBraid/rh1-dev
Browse files Browse the repository at this point in the history
display to top-level, compat py39
  • Loading branch information
ryanhill1 authored Dec 14, 2023
2 parents 5ea25c2 + d2461ad commit f981d2e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 31 deletions.
File renamed without changes.
13 changes: 5 additions & 8 deletions qbraid/_qdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,12 @@ def __dynamic_importer(opt_modules: List[str]) -> list:
return imported


# pylint: disable=undefined-variable,inconsistent-return-statements
def __get_class(module: str):
match module:
# pylint: disable=undefined-variable
case "qiskit_ibm_provider":
return qiskit_ibm_provider.IBMBackend # type: ignore
case "braket.aws":
return braket.aws.AwsDevice # type: ignore
case _:
pass
if module == "qiskit_ibm_provider":
return qiskit_ibm_provider.IBMBackend # type: ignore
if module == "braket.aws":
return braket.aws.AwsDevice # type: ignore


# Supported quantum devices.
Expand Down
29 changes: 13 additions & 16 deletions qbraid/_qprogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,20 @@ def __dynamic_importer(opt_modules: List[str]) -> list:
return imported


# pylint: disable=undefined-variable,inconsistent-return-statements
def __get_class(module: str):
match module:
# pylint: disable=undefined-variable
case "cirq":
return cirq.Circuit # type: ignore
case "qiskit":
return qiskit.QuantumCircuit # type: ignore
case "braket.circuits":
return braket.circuits.Circuit # type: ignore
case "pyquil":
return pyquil.Program # type: ignore
case "pytket":
return pytket._tket.circuit.Circuit # type: ignore
case "openqasm3":
return openqasm3.ast.Program # type: ignore
case _:
pass
if module == "cirq":
return cirq.Circuit # type: ignore
if module == "qiskit":
return qiskit.QuantumCircuit # type: ignore
if module == "braket.circuits":
return braket.circuits.Circuit # type: ignore
if module == "pyquil":
return pyquil.Program # type: ignore
if module == "pytket":
return pytket._tket.circuit.Circuit # type: ignore
if module == "openqasm3":
return openqasm3.ast.Program # type: ignore


# Supported quantum programs.
Expand Down
6 changes: 3 additions & 3 deletions qbraid/get_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
except ImportError:
pass

from qbraid.api import ApiError, QbraidSession
from qbraid.load_provider import device_wrapper
from qbraid.visualization.display_utils import running_in_jupyter, update_progress_bar
from ._display import running_in_jupyter, update_progress_bar
from .api import ApiError, QbraidSession
from .load_provider import device_wrapper


def refresh_devices():
Expand Down
4 changes: 2 additions & 2 deletions qbraid/get_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
except ImportError:
pass

from ._display import running_in_jupyter, update_progress_bar
from .api import QbraidSession
from .load_provider import job_wrapper
from .visualization.display_utils import running_in_jupyter, update_progress_bar


def _display_jobs_basic(data, msg):
Expand Down Expand Up @@ -141,7 +141,7 @@ def get_jobs(filters: Optional[dict] = None, refresh: bool = False):
if refresh and not QuantumJob.status_final(status):
try:
qbraid_job = job_wrapper(job_id)
status_obj = qbraid_job.status()
status_obj = qbraid_job.status() # TODO: surpress warnings here
status = status_obj.name
except Exception: # pylint: disable=broad-except
pass
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ classifiers =
Intended Audience :: Science/Research
Natural Language :: English
Programming Language :: Python
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Scientific/Engineering
Topic :: Scientific/Engineering :: Physics

[options]
packages = find:
python_requires = >=3.10
python_requires = >=3.9

install_requires =
networkx>=2.5,<4.0
Expand Down
2 changes: 1 addition & 1 deletion tests/top_level/test_top_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import pytest

from qbraid import __version__
from qbraid._display import running_in_jupyter, update_progress_bar
from qbraid._warnings import _warn_new_version
from qbraid.exceptions import PackageValueError
from qbraid.get_devices import get_devices
from qbraid.get_jobs import _display_jobs_jupyter, get_jobs
from qbraid.visualization.display_utils import running_in_jupyter, update_progress_bar

# pylint: disable=missing-function-docstring,redefined-outer-name

Expand Down

0 comments on commit f981d2e

Please sign in to comment.