Skip to content

Commit

Permalink
Deprecate more utils and parameters that depend on qiskit.providers.m…
Browse files Browse the repository at this point in the history
…odels
  • Loading branch information
1ucian0 committed Aug 6, 2024
1 parent 1fdd527 commit 3279c57
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
8 changes: 8 additions & 0 deletions qiskit/compiler/transpiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@
from qiskit.transpiler.passes.synthesis.high_level_synthesis import HLSConfig
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit.transpiler.target import Target
from qiskit.utils import deprecate_arg

logger = logging.getLogger(__name__)

_CircuitT = TypeVar("_CircuitT", bound=Union[QuantumCircuit, List[QuantumCircuit]])


@deprecate_arg(
"backend_properties",
since="1.3",
removal_timeline="in the 2.0 release",
additional_msg="Because `qiskit.providers.models.BackendProperties` is deprecated, it wont be"
"accepted anymore as a parameter.",
)
def transpile( # pylint: disable=too-many-return-statements
circuits: _CircuitT,
backend: Optional[Backend] = None,
Expand Down
7 changes: 7 additions & 0 deletions qiskit/providers/backend_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@
from qiskit.providers.models.pulsedefaults import PulseDefaults
from qiskit.providers.options import Options
from qiskit.providers.exceptions import BackendPropertyError
from qiskit.utils import deprecate_func

logger = logging.getLogger(__name__)


@deprecate_func(
since="1.3",
removal_timeline="in the 2.0 release",
additional_msg="With the deprecation of `qiskit.providers.models` this utility function "
"is not needed.",
)
def convert_to_target(
configuration: BackendConfiguration,
properties: BackendProperties = None,
Expand Down
9 changes: 8 additions & 1 deletion qiskit/transpiler/passes/synthesis/unitary_synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
)
from qiskit.transpiler.passes.synthesis import plugin
from qiskit.transpiler.target import Target

from qiskit.utils import deprecate_arg

GATE_NAME_MAP = {
"cx": CXGate._standard_gate,
Expand Down Expand Up @@ -313,6 +313,13 @@ def _preferred_direction(
class UnitarySynthesis(TransformationPass):
"""Synthesize gates according to their basis gates."""

@deprecate_arg(
"backend_props",
since="1.3",
removal_timeline="in the 2.0 release",
additional_msg="Because `qiskit.providers.models.BackendProperties` is deprecated, it wont be"
"accepted anymore as a parameter.",
)
def __init__(
self,
basis_gates: list[str] = None,
Expand Down
9 changes: 8 additions & 1 deletion qiskit/transpiler/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
# full target
from qiskit.providers.backend import QubitProperties # pylint: disable=unused-import
from qiskit.providers.models.backendproperties import BackendProperties
from qiskit.utils import deprecate_func
from qiskit.utils import deprecate_func, deprecate_arg

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -926,6 +926,13 @@ def __setstate__(self, state: tuple):
self._instruction_schedule_map = state["instruction_schedule_map"]
super().__setstate__(state["base"])

@deprecate_arg(
"backend_properties",
since="1.3",
removal_timeline="in the 2.0 release",
additional_msg="Because `qiskit.providers.models.BackendProperties` is deprecated, it wont be"
"accepted anymore as a parameter.",
)
@classmethod
def from_configuration(
cls,
Expand Down

0 comments on commit 3279c57

Please sign in to comment.