Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c2cf1c3

Browse files
committed
Shorten the @deprecated docs.
For internal APIs, it seems reasonable to avoid the duplication of the description of parameters (if anything, the shortened version makes the difference in `obj_type`'s behavior clearer). Also compress a bit the docstring of `warn_deprecated`.
1 parent 57489bf commit c2cf1c3

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
@@ -73,31 +73,24 @@ def warn_deprecated(
7373
----------
7474
since : str
7575
The release at which this API became deprecated.
76-
7776
message : str, optional
7877
Override the default deprecation message. The ``%(since)s``,
7978
``%(name)s``, ``%(alternative)s``, ``%(obj_type)s``, ``%(addendum)s``,
8079
and ``%(removal)s`` format specifiers will be replaced by the values
8180
of the respective arguments passed to this function.
82-
8381
name : str, optional
8482
The name of the deprecated object.
85-
8683
alternative : str, optional
8784
An alternative API that the user may use in place of the deprecated
8885
API. The deprecation warning will tell the user about this alternative
8986
if provided.
90-
9187
pending : bool, optional
9288
If True, uses a PendingDeprecationWarning instead of a
9389
DeprecationWarning. Cannot be used together with *removal*.
94-
9590
obj_type : str, optional
9691
The object type being deprecated.
97-
9892
addendum : str, optional
9993
Additional text appended directly to the final message.
100-
10194
removal : str, optional
10295
The expected removal version. With the default (an empty string), a
10396
removal version is automatically computed from *since*. Set to other
@@ -106,7 +99,7 @@ def warn_deprecated(
10699
107100
Examples
108101
--------
109-
Basic example::
102+
::
110103
111104
# To warn of the deprecation of "matplotlib.name_of_module"
112105
warn_deprecated('1.4.0', name='matplotlib.name_of_module',
@@ -135,46 +128,13 @@ def deprecated(since, *, message='', name='', alternative='', pending=False,
135128
``@deprecated`` would mess up ``__init__`` inheritance when installing its
136129
own (deprecation-emitting) ``C.__init__``).
137130
138-
Parameters
139-
----------
140-
since : str
141-
The release at which this API became deprecated.
142-
143-
message : str, optional
144-
Override the default deprecation message. The ``%(since)s``,
145-
``%(name)s``, ``%(alternative)s``, ``%(obj_type)s``, ``%(addendum)s``,
146-
and ``%(removal)s`` format specifiers will be replaced by the values
147-
of the respective arguments passed to this function.
148-
149-
name : str, optional
150-
The name used in the deprecation message; if not provided, the name
151-
is automatically determined from the deprecated object.
152-
153-
alternative : str, optional
154-
An alternative API that the user may use in place of the deprecated
155-
API. The deprecation warning will tell the user about this alternative
156-
if provided.
157-
158-
pending : bool, optional
159-
If True, uses a PendingDeprecationWarning instead of a
160-
DeprecationWarning. Cannot be used together with *removal*.
161-
162-
obj_type : str, optional
163-
The object type being deprecated; by default, 'class' if decorating
164-
a class, 'attribute' if decorating a property, 'function' otherwise.
165-
166-
addendum : str, optional
167-
Additional text appended directly to the final message.
168-
169-
removal : str, optional
170-
The expected removal version. With the default (an empty string), a
171-
removal version is automatically computed from *since*. Set to other
172-
Falsy values to not schedule a removal date. Cannot be used together
173-
with *pending*.
131+
Parameters are the same as for `warn_deprecated`, except that *obj_type*
132+
defaults to 'class' if decorating a class, 'attribute' if decorating a
133+
property, and 'function' otherwise.
174134
175135
Examples
176136
--------
177-
Basic example::
137+
::
178138
179139
@deprecated('1.4.0')
180140
def the_function_to_deprecate():

0 commit comments

Comments
 (0)