diff --git a/qiskit/circuit/library/n_local/n_local.py b/qiskit/circuit/library/n_local/n_local.py index b3db02b94f03..1188436a9e8d 100644 --- a/qiskit/circuit/library/n_local/n_local.py +++ b/qiskit/circuit/library/n_local/n_local.py @@ -21,7 +21,6 @@ from qiskit.circuit.quantumregister import QuantumRegister from qiskit.circuit import Instruction, Parameter, ParameterVector, ParameterExpression from qiskit.circuit.parametertable import ParameterTable -from qiskit.utils.deprecation import deprecate_arguments from ..blueprintcircuit import BlueprintCircuit @@ -793,12 +792,10 @@ def add_layer( return self - @deprecate_arguments({"param_dict": "parameters"}) def assign_parameters( self, parameters: Union[dict, List[float], List[Parameter], ParameterVector], inplace: bool = False, - param_dict: Optional[dict] = None, ) -> Optional[QuantumCircuit]: """Assign parameters to the n-local circuit. diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py index 82013a7f3b04..d49371217e4e 100644 --- a/qiskit/circuit/quantumcircuit.py +++ b/qiskit/circuit/quantumcircuit.py @@ -31,7 +31,7 @@ from qiskit.qasm.qasm import Qasm from qiskit.qasm.exceptions import QasmError from qiskit.circuit.exceptions import CircuitError -from qiskit.utils.deprecation import deprecate_function, deprecate_arguments +from qiskit.utils.deprecation import deprecate_function from .parameterexpression import ParameterExpression from .quantumregister import QuantumRegister, Qubit, AncillaRegister, AncillaQubit from .classicalregister import ClassicalRegister, Clbit @@ -2128,10 +2128,7 @@ def _unsorted_parameters(self): return parameters - @deprecate_arguments({"param_dict": "parameters"}) - def assign_parameters( - self, parameters, inplace=False, param_dict=None - ): # pylint: disable=unused-argument + def assign_parameters(self, parameters, inplace=False): """Assign parameters to new parameters or values. The keys of the parameter dictionary must be Parameter instances in the current circuit. The @@ -2143,11 +2140,9 @@ def assign_parameters( parameter values. If a dict, it specifies the mapping from ``current_parameter`` to ``new_parameter``, where ``new_parameter`` can be a new parameter object or a numeric value. If an iterable, the elements are assigned to the existing parameters - in the order they were inserted. You can call ``QuantumCircuit.parameters`` to check - this order. + in the order of ``QuantumCircuit.parameters``. inplace (bool): If False, a copy of the circuit with the bound parameters is returned. If True the circuit instance itself is modified. - param_dict (dict): Deprecated, use ``parameters`` instead. Raises: CircuitError: If parameters is a dict and contains parameters not present in the @@ -2238,8 +2233,7 @@ def assign_parameters( bound_circuit._assign_parameter(self.parameters[i], value) return None if inplace else bound_circuit - @deprecate_arguments({"value_dict": "values"}) - def bind_parameters(self, values, value_dict=None): # pylint: disable=unused-argument + def bind_parameters(self, values): """Assign numeric parameters to values yielding a new circuit. To assign new Parameter objects or bind the values in-place, without yielding a new @@ -2247,7 +2241,6 @@ def bind_parameters(self, values, value_dict=None): # pylint: disable=unused-ar Args: values (dict or iterable): {parameter: value, ...} or [value1, value2, ...] - value_dict (dict): Deprecated, use ``values`` instead. Raises: CircuitError: If values is a dict and contains parameters not present in the circuit. diff --git a/releasenotes/notes/remove-deprecated-assign-parameters-args-9712d7d01e82c390.yaml b/releasenotes/notes/remove-deprecated-assign-parameters-args-9712d7d01e82c390.yaml new file mode 100644 index 000000000000..b18198b897cd --- /dev/null +++ b/releasenotes/notes/remove-deprecated-assign-parameters-args-9712d7d01e82c390.yaml @@ -0,0 +1,14 @@ +--- +upgrade: + - | + Delete the arguments `param_dict` in :meth:`qiskit.circuit.QuantumCircuit.assign_parameters` + and `value_dict` in :meth:`qiskit.circuit.QuantumCircuit.bind_parameters`, which have been + deprecated in [PR 5759](https://github.com/Qiskit/qiskit-terra/pull/5759). Instead, + use the arguments `parameters` resp. `values`. +fixes: + - | + Fix the statement about the parameter order if the parameters are provided as + iteratble and not dictionary in + :meth:`qiskit.circuit.QuantumCircuit.assign_parameters`. The parameters are not + sorted by insertion but by name, with the special case that the order of a + :class:`~qiskit.circuit.ParameterVector` is maintained.