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

Skip to content

Commit 4148262

Browse files
authored
Merge pull request #18522 from QuLogic/delete-deprecations
Remove mlab, toolkits, and misc deprecations
2 parents d14874f + b8fdef7 commit 4148262

File tree

14 files changed

+62
-621
lines changed

14 files changed

+62
-621
lines changed

doc/api/figure_api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Classes
1616
:template: autosummary.rst
1717
:nosignatures:
1818

19-
AxesStack
2019
Figure
2120
SubplotParams
2221

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
``matplotlib.mlab``
2+
~~~~~~~~~~~~~~~~~~~
3+
``mlab.apply_window`` and ``mlab.stride_repeat`` have been removed.
4+
5+
Axes3D
6+
~~~~~~
7+
``axes3d.unit_bbox`` has been removed; use ``Bbox.unit`` instead.
8+
9+
axisartist
10+
~~~~~~~~~~
11+
``mpl_toolkits.axisartist.grid_finder.GridFinderBase`` has been removed; use
12+
`.GridFinder` instead.
13+
14+
``axisartist.axis_artist.BezierPath`` has been removed; use
15+
`.patches.PathPatch` instead.
16+
17+
Returning a factor equal to None from axisartist Locators (which are **not**
18+
the same as "standard" tick Locators), or passing a factor equal to None
19+
to axisartist Formatters (which are **not** the same as "standard" tick
20+
Formatters) is no longer supported. Pass a factor equal to 1 instead.
21+
22+
Misc
23+
~~~~
24+
``matplotlib.get_home`` has been removed; use standard library instead.
25+
26+
``matplotlib.compare_versions`` has been removed; use comparison of
27+
``distutils.version.LooseVersion``\s instead.
28+
29+
``matplotlib.checkdep_ps_distiller`` has been removed.
30+
31+
``matplotlib.figure.AxesStack`` has been removed.
32+
33+
``BboxBase.is_unit`` has been removed; check the `.Bbox` extents if needed.
34+
35+
``Affine2DBase.matrix_from_values(...)`` has been removed; use (for example)
36+
``Affine2D.from_values(...).get_matrix()`` instead.
37+
38+
``style.core.is_style_file`` and ``style.core.iter_style_files`` have been
39+
removed.

doc/api/prev_api_changes/api_changes_2.1.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ a previous axes instance currently reuses the earlier instance. This
329329
behavior has been deprecated in Matplotlib 2.1. In a future version, a
330330
*new* instance will always be created and returned. Meanwhile, in such
331331
a situation, a deprecation warning is raised by
332-
:class:`~matplotlib.figure.AxesStack`.
332+
``matplotlib.figure.AxesStack``.
333333

334334
This warning can be suppressed, and the future behavior ensured, by passing
335335
a *unique* label to each axes instance. See the docstring of

doc/users/prev_whats_new/whats_new_1.4.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ Support for detrending and windowing 2D arrays in mlab
114114
Todd Jennings added support for 2D arrays in the
115115
:func:`~matplotlib.mlab.detrend_mean`, :func:`~matplotlib.mlab.detrend_none`,
116116
and :func:`~matplotlib.mlab.detrend`, as well as adding
117-
:func:`~matplotlib.mlab.apply_window` which support windowing 2D arrays.
117+
``matplotlib.mlab.apply_window`` which support windowing 2D arrays.
118118

119119
Support for strides in mlab
120120
```````````````````````````
121-
Todd Jennings added some functions to mlab to make it easier to use numpy
121+
Todd Jennings added some functions to mlab to make it easier to use NumPy
122122
strides to create memory-efficient 2D arrays. This includes
123-
:func:`~matplotlib.mlab.stride_repeat`, which repeats an array to create a 2D
123+
``matplotlib.mlab.stride_repeat``, which repeats an array to create a 2D
124124
array, and :func:`~matplotlib.mlab.stride_windows`, which uses a moving window
125125
to create a 2D array from a 1D array.
126126

lib/matplotlib/__init__.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -135,23 +135,6 @@
135135
}"""
136136

137137

138-
@cbook.deprecated("3.2")
139-
def compare_versions(a, b):
140-
"""Return whether version *a* is greater than or equal to version *b*."""
141-
if isinstance(a, bytes):
142-
cbook.warn_deprecated(
143-
"3.0", message="compare_versions arguments should be strs.")
144-
a = a.decode('ascii')
145-
if isinstance(b, bytes):
146-
cbook.warn_deprecated(
147-
"3.0", message="compare_versions arguments should be strs.")
148-
b = b.decode('ascii')
149-
if a:
150-
return LooseVersion(a) >= LooseVersion(b)
151-
else:
152-
return False
153-
154-
155138
def _check_versions():
156139

157140
# Quickfix to ensure Microsoft Visual C++ redistributable
@@ -382,26 +365,6 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
382365
raise ValueError("Unknown executable: {!r}".format(name))
383366

384367

385-
@cbook.deprecated("3.2")
386-
def checkdep_ps_distiller(s):
387-
if not s:
388-
return False
389-
try:
390-
_get_executable_info("gs")
391-
except ExecutableNotFoundError:
392-
_log.warning(
393-
"Setting rcParams['ps.usedistiller'] requires ghostscript.")
394-
return False
395-
if s == "xpdf":
396-
try:
397-
_get_executable_info("pdftops")
398-
except ExecutableNotFoundError:
399-
_log.warning(
400-
"Setting rcParams['ps.usedistiller'] to 'xpdf' requires xpdf.")
401-
return False
402-
return s
403-
404-
405368
def checkdep_usetex(s):
406369
if not s:
407370
return False
@@ -421,20 +384,6 @@ def checkdep_usetex(s):
421384
return True
422385

423386

424-
@cbook.deprecated("3.2", alternative="os.path.expanduser('~')")
425-
@_logged_cached('$HOME=%s')
426-
def get_home():
427-
"""
428-
Return the user's home directory.
429-
430-
If the user's home directory cannot be found, return None.
431-
"""
432-
try:
433-
return str(Path.home())
434-
except Exception:
435-
return None
436-
437-
438387
def _get_xdg_config_dir():
439388
"""
440389
Return the XDG configuration directory, according to the XDG base

lib/matplotlib/figure.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,6 @@ def __contains__(self, a):
152152
return a in self.as_list()
153153

154154

155-
@cbook.deprecated("3.2")
156-
class AxesStack(_AxesStack):
157-
pass
158-
159-
160155
class SubplotParams:
161156
"""
162157
A class to hold the parameters for a subplot.

lib/matplotlib/mlab.py

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@
4545
4646
`stride_windows`
4747
Get all windows in an array in a memory-efficient manner
48-
49-
`stride_repeat`
50-
Repeat an array in a memory-efficient manner
51-
52-
`apply_window`
53-
Apply a window along a given axis
5448
"""
5549

5650
import functools
@@ -85,63 +79,6 @@ def window_none(x):
8579
return x
8680

8781

88-
@cbook.deprecated("3.2")
89-
def apply_window(x, window, axis=0, return_window=None):
90-
"""
91-
Apply the given window to the given 1D or 2D array along the given axis.
92-
93-
Parameters
94-
----------
95-
x : 1D or 2D array or sequence
96-
Array or sequence containing the data.
97-
98-
window : function or array.
99-
Either a function to generate a window or an array with length
100-
*x*.shape[*axis*]
101-
102-
axis : int
103-
The axis over which to do the repetition.
104-
Must be 0 or 1. The default is 0
105-
106-
return_window : bool
107-
If true, also return the 1D values of the window that was applied
108-
"""
109-
x = np.asarray(x)
110-
111-
if x.ndim < 1 or x.ndim > 2:
112-
raise ValueError('only 1D or 2D arrays can be used')
113-
if axis+1 > x.ndim:
114-
raise ValueError('axis(=%s) out of bounds' % axis)
115-
116-
xshape = list(x.shape)
117-
xshapetarg = xshape.pop(axis)
118-
119-
if np.iterable(window):
120-
if len(window) != xshapetarg:
121-
raise ValueError('The len(window) must be the same as the shape '
122-
'of x for the chosen axis')
123-
windowVals = window
124-
else:
125-
windowVals = window(np.ones(xshapetarg, dtype=x.dtype))
126-
127-
if x.ndim == 1:
128-
if return_window:
129-
return windowVals * x, windowVals
130-
else:
131-
return windowVals * x
132-
133-
xshapeother = xshape.pop()
134-
135-
otheraxis = (axis+1) % 2
136-
137-
windowValsRep = stride_repeat(windowVals, xshapeother, axis=otheraxis)
138-
139-
if return_window:
140-
return windowValsRep * x, windowVals
141-
else:
142-
return windowValsRep * x
143-
144-
14582
def detrend(x, key=None, axis=None):
14683
"""
14784
Return x with its trend removed.
@@ -343,62 +280,6 @@ def stride_windows(x, n, noverlap=None, axis=0):
343280
return np.lib.stride_tricks.as_strided(x, shape=shape, strides=strides)
344281

345282

346-
@cbook.deprecated("3.2")
347-
def stride_repeat(x, n, axis=0):
348-
"""
349-
Repeat the values in an array in a memory-efficient manner. Array x is
350-
stacked vertically n times.
351-
352-
.. warning::
353-
354-
It is not safe to write to the output array. Multiple
355-
elements may point to the same piece of memory, so
356-
modifying one value may change others.
357-
358-
Parameters
359-
----------
360-
x : 1D array or sequence
361-
Array or sequence containing the data.
362-
363-
n : int
364-
The number of time to repeat the array.
365-
366-
axis : int
367-
The axis along which the data will run.
368-
369-
References
370-
----------
371-
`stackoverflow: Repeat NumPy array without replicating data?
372-
<http://stackoverflow.com/a/5568169>`_
373-
"""
374-
if axis not in [0, 1]:
375-
raise ValueError('axis must be 0 or 1')
376-
x = np.asarray(x)
377-
if x.ndim != 1:
378-
raise ValueError('only 1-dimensional arrays can be used')
379-
380-
if n == 1:
381-
if axis == 0:
382-
return np.atleast_2d(x)
383-
else:
384-
return np.atleast_2d(x).T
385-
if n < 1:
386-
raise ValueError('n cannot be less than 1')
387-
388-
# np.lib.stride_tricks.as_strided easily leads to memory corruption for
389-
# non integer shape and strides, i.e. n. See #3845.
390-
n = int(n)
391-
392-
if axis == 0:
393-
shape = (n, x.size)
394-
strides = (0, x.strides[0])
395-
else:
396-
shape = (x.size, n)
397-
strides = (x.strides[0], 0)
398-
399-
return np.lib.stride_tricks.as_strided(x, shape=shape, strides=strides)
400-
401-
402283
def _spectral_helper(x, y=None, NFFT=None, Fs=None, detrend_func=None,
403284
window=None, noverlap=None, pad_to=None,
404285
sides=None, scale_by_freq=None, mode=None):

lib/matplotlib/style/core.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ def _remove_blacklisted_style_params(d, warn=True):
5555
return o
5656

5757

58-
@cbook.deprecated("3.2")
59-
def is_style_file(filename):
60-
"""Return True if the filename looks like a style file."""
61-
return STYLE_FILE_PATTERN.match(filename) is not None
62-
63-
6458
def _apply_style(d, warn=True):
6559
mpl.rcParams.update(_remove_blacklisted_style_params(d, warn=warn))
6660

@@ -182,17 +176,6 @@ def update_user_library(library):
182176
return library
183177

184178

185-
@cbook.deprecated("3.2")
186-
def iter_style_files(style_dir):
187-
"""Yield file path and name of styles in the given directory."""
188-
for path in os.listdir(style_dir):
189-
filename = os.path.basename(path)
190-
if is_style_file(filename):
191-
match = STYLE_FILE_PATTERN.match(filename)
192-
path = os.path.abspath(os.path.join(style_dir, path))
193-
yield path, match.group(1)
194-
195-
196179
def read_style_directory(style_dir):
197180
"""Return dictionary of styles defined in *style_dir*."""
198181
styles = dict()

0 commit comments

Comments
 (0)