Skip to content

Commit 9439818

Browse files
authored
Merge pull request matplotlib#20675 from anntzer/dd
Shorten the `@deprecated` docs.
2 parents 9869421 + c2cf1c3 commit 9439818

File tree

1 file changed

+5
-45
lines changed

1 file changed

+5
-45
lines changed

lib/matplotlib/_api/deprecation.py

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -64,31 +64,24 @@ def warn_deprecated(
6464
----------
6565
since : str
6666
The release at which this API became deprecated.
67-
6867
message : str, optional
6968
Override the default deprecation message. The ``%(since)s``,
7069
``%(name)s``, ``%(alternative)s``, ``%(obj_type)s``, ``%(addendum)s``,
7170
and ``%(removal)s`` format specifiers will be replaced by the values
7271
of the respective arguments passed to this function.
73-
7472
name : str, optional
7573
The name of the deprecated object.
76-
7774
alternative : str, optional
7875
An alternative API that the user may use in place of the deprecated
7976
API. The deprecation warning will tell the user about this alternative
8077
if provided.
81-
8278
pending : bool, optional
8379
If True, uses a PendingDeprecationWarning instead of a
8480
DeprecationWarning. Cannot be used together with *removal*.
85-
8681
obj_type : str, optional
8782
The object type being deprecated.
88-
8983
addendum : str, optional
9084
Additional text appended directly to the final message.
91-
9285
removal : str, optional
9386
The expected removal version. With the default (an empty string), a
9487
removal version is automatically computed from *since*. Set to other
@@ -97,7 +90,7 @@ def warn_deprecated(
9790
9891
Examples
9992
--------
100-
Basic example::
93+
::
10194
10295
# To warn of the deprecation of "matplotlib.name_of_module"
10396
warn_deprecated('1.4.0', name='matplotlib.name_of_module',
@@ -126,46 +119,13 @@ def deprecated(since, *, message='', name='', alternative='', pending=False,
126119
``@deprecated`` would mess up ``__init__`` inheritance when installing its
127120
own (deprecation-emitting) ``C.__init__``).
128121
129-
Parameters
130-
----------
131-
since : str
132-
The release at which this API became deprecated.
133-
134-
message : str, optional
135-
Override the default deprecation message. The ``%(since)s``,
136-
``%(name)s``, ``%(alternative)s``, ``%(obj_type)s``, ``%(addendum)s``,
137-
and ``%(removal)s`` format specifiers will be replaced by the values
138-
of the respective arguments passed to this function.
139-
140-
name : str, optional
141-
The name used in the deprecation message; if not provided, the name
142-
is automatically determined from the deprecated object.
143-
144-
alternative : str, optional
145-
An alternative API that the user may use in place of the deprecated
146-
API. The deprecation warning will tell the user about this alternative
147-
if provided.
148-
149-
pending : bool, optional
150-
If True, uses a PendingDeprecationWarning instead of a
151-
DeprecationWarning. Cannot be used together with *removal*.
152-
153-
obj_type : str, optional
154-
The object type being deprecated; by default, 'class' if decorating
155-
a class, 'attribute' if decorating a property, 'function' otherwise.
156-
157-
addendum : str, optional
158-
Additional text appended directly to the final message.
159-
160-
removal : str, optional
161-
The expected removal version. With the default (an empty string), a
162-
removal version is automatically computed from *since*. Set to other
163-
Falsy values to not schedule a removal date. Cannot be used together
164-
with *pending*.
122+
Parameters are the same as for `warn_deprecated`, except that *obj_type*
123+
defaults to 'class' if decorating a class, 'attribute' if decorating a
124+
property, and 'function' otherwise.
165125
166126
Examples
167127
--------
168-
Basic example::
128+
::
169129
170130
@deprecated('1.4.0')
171131
def the_function_to_deprecate():

0 commit comments

Comments
 (0)