forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `@deprecate_func` and `@deprecate_arg` decorators * Update the release note * Apply suggestions from code review Co-authored-by: Luciano Bello <bel@zurich.ibm.com> * lint * Use PyPI package_name rather than loose English --------- Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
- Loading branch information
1 parent
5a74889
commit 984cc7c
Showing
4 changed files
with
430 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 15 additions & 5 deletions
20
releasenotes/notes/new-deprecation-utilities-066aff05e221d7b1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
--- | ||
features: | ||
- | | ||
Added the function ``qiskit.util.deprecation.add_deprecation_to_docstring()``. | ||
It will rewrite the function's docstring to include a Sphinx ``.. deprecated::` directive | ||
so that the deprecation shows up in docs and with ``help()``. The deprecation decorators | ||
from ``qiskit.util.deprecation`` call ``add_deprecation_to_docstring()`` already for you; | ||
but you can call it directly if you are using different mechanisms for deprecations. | ||
Added the functions ``add_deprecation_to_docstring()``, ``@deprecate_arg``, and | ||
``@deprecate_func`` to ``qiskit.util.deprecation``. | ||
``add_deprecation_to_docstring()`` will rewrite the function's docstring to include a | ||
Sphinx ``.. deprecated::`` directive so that the deprecation shows up in docs and with | ||
``help()``. The deprecation decorators from ``qiskit.util.deprecation`` call | ||
``add_deprecation_to_docstring()`` already for you; but you can call it directly if you | ||
are using different mechanisms for deprecations. | ||
``@deprecate_func`` replaces ``@deprecate_function``. It will auto-generate most of the | ||
deprecation message for you. | ||
``@deprecate_arg`` replaces ``@deprecate_arguments``. It will generate a more useful message | ||
than before. It is also more flexible, like allowing you to set a ``predicate`` so that you | ||
only deprecate certain situations, such as using a deprecated value or data type. |
Oops, something went wrong.