From 4f8c8720c2c27e7c5df529c9b0cb2b3ad364fb67 Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Tue, 25 Apr 2023 13:01:36 -0400 Subject: Fix deprecation warning formatting in docs, require deprecated_in parameter --- python/deprecation.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'python/deprecation.py') diff --git a/python/deprecation.py b/python/deprecation.py index f87be905..a97e2101 100644 --- a/python/deprecation.py +++ b/python/deprecation.py @@ -112,7 +112,7 @@ class UnsupportedWarning(DeprecatedWarning): "%(details)s" % (parts)) -def deprecated(deprecated_in=None, removed_in=None, current_version=None, +def deprecated(deprecated_in: str, removed_in=None, current_version=None, details=""): """Decorate a function to signify its deprecation @@ -130,16 +130,11 @@ def deprecated(deprecated_in=None, removed_in=None, current_version=None, :param deprecated_in: The version at which the decorated method is considered deprecated. This will usually be the next version to be released when the decorator is - added. The default is **None**, which effectively - means immediate deprecation. If this is not - specified, then the `removed_in` and - `current_version` arguments are ignored. + added. :param removed_in: The version or :class:`datetime.date` when the decorated method will be removed. The default is **None**, specifying that the function is not currently planned to be removed. - Note: This parameter cannot be set to a value if - `deprecated_in=None`. :param current_version: The source of version information for the currently running code. This will usually be a `__version__` attribute on your library. @@ -208,7 +203,7 @@ def deprecated(deprecated_in=None, removed_in=None, current_version=None, # If removed_in is a version, use "removed in" parts = { "deprecated_in": - " %s" % deprecated_in if deprecated_in else "", + " %s" % deprecated_in if deprecated_in else "", "removed_in": "\n This will be removed {} {}.".format("on" if isinstance(removed_in, date) else "in", removed_in) if removed_in else "", -- cgit v1.3.1