From 3279c57ceeaebc122a2f4d4871d645c82bdbfe7b Mon Sep 17 00:00:00 2001 From: Luciano Bello Date: Tue, 6 Aug 2024 23:20:07 +0200 Subject: [PATCH] Deprecate more utils and parameters that depend on qiskit.providers.models --- qiskit/compiler/transpiler.py | 8 ++++++++ qiskit/providers/backend_compat.py | 7 +++++++ qiskit/transpiler/passes/synthesis/unitary_synthesis.py | 9 ++++++++- qiskit/transpiler/target.py | 9 ++++++++- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/qiskit/compiler/transpiler.py b/qiskit/compiler/transpiler.py index fd93fde5989f..1239eff6c9e4 100644 --- a/qiskit/compiler/transpiler.py +++ b/qiskit/compiler/transpiler.py @@ -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, diff --git a/qiskit/providers/backend_compat.py b/qiskit/providers/backend_compat.py index f554897d34c4..1d25265ed1c9 100644 --- a/qiskit/providers/backend_compat.py +++ b/qiskit/providers/backend_compat.py @@ -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, diff --git a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py index 1ce2f2800c09..8222e3451519 100644 --- a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py +++ b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py @@ -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, @@ -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, diff --git a/qiskit/transpiler/target.py b/qiskit/transpiler/target.py index da4a44a8ee02..01d8a2f9c831 100644 --- a/qiskit/transpiler/target.py +++ b/qiskit/transpiler/target.py @@ -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__) @@ -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,