Skip to content

Commit

Permalink
deprecate qiskit.pulse.utils.deprecated_functionality in favor of qis…
Browse files Browse the repository at this point in the history
…kit.utils.deprecation.deprecate_function (#8696)

* deprecate deprecated_functionality

* pylint: disable=cyclic-import

* Add reno

* Include Terra version in deprecation notice

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
  • Loading branch information
1ucian0 and jakelishman authored Sep 8, 2022
1 parent e9913e8 commit 686ba34
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
25 changes: 10 additions & 15 deletions qiskit/pulse/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 686ba34

Please sign in to comment.