diff --git a/qiskit/pulse/utils.py b/qiskit/pulse/utils.py index ba24fb661a50..c5f77749e4ed 100644 --- a/qiskit/pulse/utils.py +++ b/qiskit/pulse/utils.py @@ -12,13 +12,13 @@ """Module for common pulse programming utilities.""" import functools -import warnings from typing import List, Dict, Union import numpy as np from qiskit.circuit.parameterexpression import ParameterExpression from qiskit.pulse.exceptions import UnassignedDurationError, QiskitError +from qiskit.utils import deprecate_function # pylint: disable=cyclic-import def format_meas_map(meas_map: List[List[int]]) -> Dict[int, List[int]]: @@ -98,19 +98,14 @@ def instruction_duration_validation(duration: int): ) +@deprecate_function("Deprecated since Terra 0.22.0. Use 'qiskit.utils.deprecate_function' instead.") def deprecated_functionality(func): """A decorator that raises deprecation warning without showing alternative method.""" - - @functools.wraps(func) - def wrapper(*args, **kwargs): - warnings.warn( - f"Calling {func.__name__} is being deprecated and will be removed soon. " - "No alternative method will be provided with this change. " - "If there is any practical usage of this functionality, please write " - "an issue in Qiskit/qiskit-terra repository.", - category=DeprecationWarning, - stacklevel=2, - ) - return func(*args, **kwargs) - - return wrapper + return deprecate_function( + f"Calling {func.__name__} is being deprecated and will be removed soon. " + "No alternative method will be provided with this change. " + "If there is any practical usage of this functionality, please write " + "an issue in Qiskit/qiskit-terra repository.", + category=DeprecationWarning, + stacklevel=2, + )(func) diff --git a/releasenotes/notes/deprecated-pulse-deprecator-394ec75079441cda.yaml b/releasenotes/notes/deprecated-pulse-deprecator-394ec75079441cda.yaml new file mode 100644 index 000000000000..15b895c46017 --- /dev/null +++ b/releasenotes/notes/deprecated-pulse-deprecator-394ec75079441cda.yaml @@ -0,0 +1,7 @@ +--- +deprecations: + - | + The pulse-module function ``qiskit.pulse.utils.deprecate_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.