diff --git a/qiskit/pulse/transforms/alignments.py b/qiskit/pulse/transforms/alignments.py index 412a543387d2..a00ee82873ba 100644 --- a/qiskit/pulse/transforms/alignments.py +++ b/qiskit/pulse/transforms/alignments.py @@ -13,13 +13,14 @@ import abc from typing import Callable, Dict, Any, Union, Tuple +import warnings import numpy as np from qiskit.circuit.parameterexpression import ParameterExpression, ParameterValueType from qiskit.pulse.exceptions import PulseError from qiskit.pulse.schedule import Schedule, ScheduleComponent -from qiskit.pulse.utils import instruction_duration_validation, deprecated_functionality +from qiskit.pulse.utils import instruction_duration_validation class AlignmentKind(abc.ABC): @@ -44,9 +45,14 @@ def align(self, schedule: Schedule) -> Schedule: """ pass - @deprecated_functionality def to_dict(self) -> Dict[str, Any]: """Returns dictionary to represent this alignment.""" + warnings.warn( + "The AlignmentKind.to_dict method is deprecated as of Qiskit Terra " + "0.21 and will be removed no sooner than 3 months after the release date.", + category=DeprecationWarning, + stacklevel=2, + ) return {"alignment": self.__class__.__name__} @property @@ -329,9 +335,14 @@ def align(self, schedule: Schedule) -> Schedule: return aligned - @deprecated_functionality def to_dict(self) -> Dict[str, Any]: """Returns dictionary to represent this alignment.""" + warnings.warn( + "The AlignEquispaced.to_dict method is deprecated as of Qiskit Terra " + "0.21 and will be removed no sooner than 3 months after the release date.", + category=DeprecationWarning, + stacklevel=2, + ) return {"alignment": self.__class__.__name__, "duration": self.duration} @@ -413,12 +424,17 @@ def align(self, schedule: Schedule) -> Schedule: return aligned - @deprecated_functionality def to_dict(self) -> Dict[str, Any]: """Returns dictionary to represent this alignment. .. note:: ``func`` is not presented in this dictionary. Just name. """ + warnings.warn( + "The AlignFunc.to_dict method is deprecated as of Qiskit Terra " + "0.21 and will be removed no sooner than 3 months after the release date.", + category=DeprecationWarning, + stacklevel=2, + ) return { "alignment": self.__class__.__name__, "duration": self.duration, diff --git a/releasenotes/notes/deprecated-pulse-deprecator-394ec75079441cda.yaml b/releasenotes/notes/deprecated-pulse-deprecator-394ec75079441cda.yaml index 15b895c46017..17a114f347cb 100644 --- a/releasenotes/notes/deprecated-pulse-deprecator-394ec75079441cda.yaml +++ b/releasenotes/notes/deprecated-pulse-deprecator-394ec75079441cda.yaml @@ -1,7 +1,7 @@ --- deprecations: - | - The pulse-module function ``qiskit.pulse.utils.deprecate_functionality`` is + The pulse-module function ``qiskit.pulse.utils.deprecated_functionality`` is deprecated and will be removed in a future release. This was a primarily internal-only function. The same functionality is supplied by ``qiskit.utils.deprecate_function``, which should be used instead.