Skip to content

Commit

Permalink
Internally importing qiskit.providers.backend.Backend should not ra…
Browse files Browse the repository at this point in the history
…ise `DeprecationWarning` (#12906)

* better module deprecation

* _pulse_library

* __getattr__

* copy qiskit.qobj.PulseQobjInstruction and qiskit.qobj.PulseLibraryItem for internal generic_backend_v2 usage

* lint

* Aer models

* skip

* more generic catch

* specific imports
  • Loading branch information
1ucian0 authored Aug 15, 2024
1 parent 8c74a49 commit 713ab38
Show file tree
Hide file tree
Showing 15 changed files with 499 additions and 56 deletions.
2 changes: 1 addition & 1 deletion qiskit/compiler/transpiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from qiskit.dagcircuit import DAGCircuit
from qiskit.providers.backend import Backend
from qiskit.providers.backend_compat import BackendV2Converter
from qiskit.providers.models import BackendProperties
from qiskit.providers.models.backendproperties import BackendProperties
from qiskit.pulse import Schedule, InstructionScheduleMap
from qiskit.transpiler import Layout, CouplingMap, PropertySet
from qiskit.transpiler.basepasses import BasePass
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/basic_provider/basic_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from qiskit.circuit.library.standard_gates import get_standard_gate_name_mapping, GlobalPhaseGate
from qiskit.providers import Provider
from qiskit.providers.backend import BackendV2
from qiskit.providers.models import BackendConfiguration
from qiskit.providers.models.backendconfiguration import BackendConfiguration
from qiskit.providers.options import Options
from qiskit.qobj import QasmQobj, QasmQobjConfig, QasmQobjExperiment
from qiskit.result import Result
Expand Down
6 changes: 3 additions & 3 deletions qiskit/providers/fake_provider/fake_openpulse_2q.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
import datetime
import warnings

from qiskit.providers.models import (
from qiskit.providers.models.backendconfiguration import (
GateConfig,
PulseBackendConfiguration,
PulseDefaults,
Command,
UchannelLO,
)

from qiskit.providers.models.backendproperties import Nduv, Gate, BackendProperties
from qiskit.providers.models.pulsedefaults import PulseDefaults, Command
from qiskit.qobj import PulseQobjInstruction

from .fake_backend import FakeBackend
Expand Down
5 changes: 2 additions & 3 deletions qiskit/providers/fake_provider/fake_openpulse_3q.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
"""
import warnings

from qiskit.providers.models import (
from qiskit.providers.models.backendconfiguration import (
GateConfig,
PulseBackendConfiguration,
PulseDefaults,
Command,
UchannelLO,
)
from qiskit.providers.models.pulsedefaults import PulseDefaults, Command
from qiskit.qobj import PulseQobjInstruction

from .fake_backend import FakeBackend
Expand Down
3 changes: 2 additions & 1 deletion qiskit/providers/fake_provider/fake_pulse_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"""

from qiskit.exceptions import QiskitError
from qiskit.providers.models import PulseBackendConfiguration, PulseDefaults
from qiskit.providers.models.backendconfiguration import PulseBackendConfiguration
from qiskit.providers.models.pulsedefaults import PulseDefaults

from .fake_qasm_backend import FakeQasmBackend
from .utils.json_decoder import decode_pulse_defaults
Expand Down
3 changes: 2 additions & 1 deletion qiskit/providers/fake_provider/fake_qasm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import warnings

from qiskit.exceptions import QiskitError
from qiskit.providers.models import BackendProperties, QasmBackendConfiguration
from qiskit.providers.models.backendproperties import BackendProperties
from qiskit.providers.models.backendconfiguration import QasmBackendConfiguration

from .utils.json_decoder import (
decode_backend_configuration,
Expand Down
Loading

0 comments on commit 713ab38

Please sign in to comment.