Skip to content

Commit 400754f

Browse files
committed
Merge pull request matplotlib#2714 from pelson/deprecate_testing.image_util
Deprecated matplotlib.testing.image_util.
2 parents 35e1823 + 18fe03d commit 400754f

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

doc/api/api_changes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ original location:
113113
does the exact same thing as `FormatStrFormatter`, but for new-style
114114
formatting strings.
115115

116+
* Deprecated `matplotlib.testing.image_util` and the only function within,
117+
`matplotlib.testing.image_util.autocontrast`. These will be removed
118+
completely in v1.5.0.
119+
116120
* The ``fmt`` argument of :meth:`~matplotlib.axes.Axes.plot_date` has been
117121
changed from ``bo`` to just ``o``, so color cycling can happen by default.
118122

lib/matplotlib/cbook.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ def new_function():
119119
120120
obj_type : str, optional
121121
The object type being deprecated.
122+
123+
Example
124+
-------
125+
# To warn of the deprecation of "matplotlib.name_of_module"
126+
warn_deprecated('1.4.0', name='matplotlib.name_of_module',
127+
obj_type='module')
128+
122129
"""
123130
message = _generate_deprecation_message(
124131
since, message, name, alternative, pending, obj_type)
@@ -129,7 +136,7 @@ def new_function():
129136
def deprecated(since, message='', name='', alternative='', pending=False,
130137
obj_type='function'):
131138
"""
132-
Used to mark a function as deprecated.
139+
Decorator to mark a function as deprecated.
133140
134141
Parameters
135142
------------
@@ -164,6 +171,13 @@ def new_function():
164171
pending : bool, optional
165172
If True, uses a PendingDeprecationWarning instead of a
166173
DeprecationWarning.
174+
175+
Example
176+
-------
177+
@deprecated('1.4.0')
178+
def the_function_to_deprecate():
179+
pass
180+
167181
"""
168182
def deprecate(func, message=message, name=name, alternative=alternative,
169183
pending=pending):

lib/matplotlib/testing/image_util.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@
3737

3838
import numpy as np
3939

40-
# TODO: Vectorize this
40+
from matplotlib.cbook import deprecated, warn_deprecated
41+
42+
43+
warn_deprecated('1.4.0', name='matplotlib.testing.image_util',
44+
obj_type='module')
45+
46+
47+
@deprecated('1.4.0')
4148
def autocontrast(image, cutoff=0):
4249
"""
4350
Maximize image contrast, based on histogram. This completely

0 commit comments

Comments
 (0)