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

Skip to content

Commit f585f9e

Browse files
authored
Merge pull request #16047 from timhoffm/remove-3.1-deprecations4
Remove more API deprecated in 3.1
2 parents 1cbb4cc + 24bc805 commit f585f9e

File tree

9 files changed

+19
-219
lines changed

9 files changed

+19
-219
lines changed

doc/api/next_api_changes/removals.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Classes and methods
5656

5757
- ``sphinxext.plot_directive.plot_directive()``
5858
(use the class ``PlotDirective`` instead)
59+
- ``sphinxext.mathmpl.math_directive()``
60+
(use the class ``MathDirective`` instead)
5961

6062
- ``Artist.aname`` property (no replacement)
6163
- ``Axis.iter_ticks`` (no replacement)
@@ -74,6 +76,20 @@ Classes and methods
7476
- ``colorbar.ColorbarBase.set_clim`` (use ``ScalarMappable.set_clim`` instead)
7577
- ``colorbar.ColorbarBase.set_norm`` (use ``ScalarMappable.set_norm`` instead)
7678

79+
- ``dates.seconds()`` (no replacement)
80+
- ``dates.minutes()`` (no replacement)
81+
- ``dates.hours()`` (no replacement)
82+
- ``dates.weeks()`` (no replacement)
83+
84+
- ``font_manager.OSXInstalledFonts()`` (no replacement)
85+
86+
- ``mlab.demean()`` (use ``mlab.detrend_mean()`` instead)
87+
88+
- ``projections.process_projection_requirements()`` (no replacement)
89+
90+
- ``path.get_paths_extents()``
91+
(use ``path.get_path_collection_extents()`` instead)
92+
7793
- ``text.TextWithDash`` (use ``text.Annotation`` instead)
7894

7995
- ``mplot3d.proj3d.line2d()`` (no replacement)

lib/matplotlib/dates.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@
163163
'rrule', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU',
164164
'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY',
165165
'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta',
166-
'seconds', 'minutes', 'hours', 'weeks',
167166
'DateConverter', 'ConciseDateConverter')
168167

169168

@@ -1839,38 +1838,6 @@ def date_ticker_factory(span, tz=None, numticks=5):
18391838
return locator, formatter
18401839

18411840

1842-
@cbook.deprecated("3.1")
1843-
def seconds(s):
1844-
"""
1845-
Return seconds as days.
1846-
"""
1847-
return s / SEC_PER_DAY
1848-
1849-
1850-
@cbook.deprecated("3.1")
1851-
def minutes(m):
1852-
"""
1853-
Return minutes as days.
1854-
"""
1855-
return m / MINUTES_PER_DAY
1856-
1857-
1858-
@cbook.deprecated("3.1")
1859-
def hours(h):
1860-
"""
1861-
Return hours as days.
1862-
"""
1863-
return h / HOURS_PER_DAY
1864-
1865-
1866-
@cbook.deprecated("3.1")
1867-
def weeks(w):
1868-
"""
1869-
Return weeks as days.
1870-
"""
1871-
return w * DAYS_PER_WEEK
1872-
1873-
18741841
class DateConverter(units.ConversionInterface):
18751842
"""
18761843
Converter for `datetime.date` and `datetime.datetime` data, or for

lib/matplotlib/font_manager.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,6 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
253253
return [str(path) for path in items if path.suffix.lower() in fontext]
254254

255255

256-
@cbook.deprecated("3.1")
257-
def OSXInstalledFonts(directories=None, fontext='ttf'):
258-
"""Get list of font files on OS X."""
259-
if directories is None:
260-
directories = OSXFontDirectories
261-
return [path
262-
for directory in directories
263-
for path in list_fonts(directory, get_fontext_synonyms(fontext))]
264-
265-
266256
@lru_cache()
267257
def _call_fc_list():
268258
"""Cache and list the font filenames known to `fc-list`.

lib/matplotlib/mlab.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -190,28 +190,6 @@ def detrend(x, key=None, axis=None):
190190
f"'constant', 'mean', 'linear', or a function")
191191

192192

193-
@cbook.deprecated("3.1", alternative="detrend_mean")
194-
def demean(x, axis=0):
195-
"""
196-
Return x minus its mean along the specified axis.
197-
198-
Parameters
199-
----------
200-
x : array or sequence
201-
Array or sequence containing the data
202-
Can have any dimensionality
203-
204-
axis : int
205-
The axis along which to take the mean. See numpy.mean for a
206-
description of this argument.
207-
208-
See Also
209-
--------
210-
detrend_mean : Same as `demean` except for the default *axis*.
211-
"""
212-
return detrend_mean(x, axis=axis)
213-
214-
215193
def detrend_mean(x, axis=None):
216194
"""
217195
Return x minus the mean(x).

lib/matplotlib/path.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -991,23 +991,3 @@ def get_path_collection_extents(
991991
return Bbox.from_extents(*_path.get_path_collection_extents(
992992
master_transform, paths, np.atleast_3d(transforms),
993993
offsets, offset_transform))
994-
995-
996-
@cbook.deprecated("3.1", alternative="get_paths_collection_extents")
997-
def get_paths_extents(paths, transforms=[]):
998-
"""
999-
Given a sequence of :class:`Path` objects and optional
1000-
:class:`~matplotlib.transforms.Transform` objects, returns the
1001-
bounding box that encapsulates all of them.
1002-
1003-
*paths* is a sequence of :class:`Path` instances.
1004-
1005-
*transforms* is an optional sequence of
1006-
:class:`~matplotlib.transforms.Affine2D` instances to apply to
1007-
each path.
1008-
"""
1009-
from .transforms import Bbox, Affine2D
1010-
if len(paths) == 0:
1011-
raise ValueError("No paths provided")
1012-
return Bbox.from_extents(*_path.get_path_collection_extents(
1013-
Affine2D(), paths, transforms, [], Affine2D()))

lib/matplotlib/projections/__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .. import axes, docstring, cbook
1+
from .. import axes, docstring
22
from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
33
from .polar import PolarAxes
44
from mpl_toolkits.mplot3d import Axes3D
@@ -56,10 +56,5 @@ def get_projection_class(projection=None):
5656
raise ValueError("Unknown projection %r" % projection)
5757

5858

59-
@cbook.deprecated("3.1")
60-
def process_projection_requirements(figure, *args, **kwargs):
61-
return figure._process_projection_requirements(*args, **kwargs)
62-
63-
6459
get_projection_names = projection_registry.get_projection_names
6560
docstring.interpd.update(projection_names=get_projection_names())

lib/matplotlib/pylab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
## We are still importing too many things from mlab; more cleanup is needed.
3030

3131
from matplotlib.mlab import (
32-
demean, detrend, detrend_linear, detrend_mean, detrend_none,
33-
window_hanning, window_none)
32+
detrend, detrend_linear, detrend_mean, detrend_none, window_hanning,
33+
window_none)
3434

3535
from matplotlib import cbook, mlab, pyplot as plt
3636
from matplotlib.pyplot import *

lib/matplotlib/sphinxext/mathmpl.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@ def math_role(role, rawtext, text, lineno, inliner,
3131
math_role.options = {'fontset': fontset_choice}
3232

3333

34-
@cbook.deprecated("3.1", alternative="MathDirective")
35-
def math_directive(name, arguments, options, content, lineno,
36-
content_offset, block_text, state, state_machine):
37-
latex = ''.join(content)
38-
node = latex_math(block_text)
39-
node['latex'] = latex
40-
node['fontset'] = options.get('fontset', 'cm')
41-
return [node]
42-
43-
4434
class MathDirective(Directive):
4535
has_content = True
4636
required_arguments = 0

lib/matplotlib/tests/test_mlab.py

Lines changed: 0 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -575,34 +575,6 @@ def test_detrend_mean_1D_base_slope_off_list_axis0(self):
575575
res = mlab.detrend_mean(input.tolist(), axis=0)
576576
assert_allclose(res, targ, atol=1e-08)
577577

578-
def test_demean_0D_off(self):
579-
input = 5.5
580-
targ = 0.
581-
with pytest.warns(MatplotlibDeprecationWarning):
582-
res = mlab.demean(input, axis=None)
583-
assert_almost_equal(res, targ)
584-
585-
def test_demean_1D_base_slope_off(self):
586-
input = self.sig_base + self.sig_slope + self.sig_off
587-
targ = self.sig_base + self.sig_slope_mean
588-
with pytest.warns(MatplotlibDeprecationWarning):
589-
res = mlab.demean(input)
590-
assert_allclose(res, targ, atol=1e-08)
591-
592-
def test_demean_1D_base_slope_off_axis0(self):
593-
input = self.sig_base + self.sig_slope + self.sig_off
594-
targ = self.sig_base + self.sig_slope_mean
595-
with pytest.warns(MatplotlibDeprecationWarning):
596-
res = mlab.demean(input, axis=0)
597-
assert_allclose(res, targ, atol=1e-08)
598-
599-
def test_demean_1D_base_slope_off_list(self):
600-
input = self.sig_base + self.sig_slope + self.sig_off
601-
targ = self.sig_base + self.sig_slope_mean
602-
with pytest.warns(MatplotlibDeprecationWarning):
603-
res = mlab.demean(input.tolist())
604-
assert_allclose(res, targ, atol=1e-08)
605-
606578
def test_detrend_mean_2D_default(self):
607579
arri = [self.sig_off,
608580
self.sig_base + self.sig_off]
@@ -756,82 +728,6 @@ def test_detrend_detrend_mean_2D_axis0(self):
756728
assert_allclose(res, targ,
757729
atol=1e-08)
758730

759-
def test_demean_2D_default(self):
760-
arri = [self.sig_base,
761-
self.sig_base + self.sig_off,
762-
self.sig_base + self.sig_slope,
763-
self.sig_base + self.sig_off + self.sig_slope]
764-
arrt = [self.sig_base,
765-
self.sig_base,
766-
self.sig_base + self.sig_slope_mean,
767-
self.sig_base + self.sig_slope_mean]
768-
input = np.vstack(arri).T
769-
targ = np.vstack(arrt).T
770-
with pytest.warns(MatplotlibDeprecationWarning):
771-
res = mlab.demean(input)
772-
assert_allclose(res, targ,
773-
atol=1e-08)
774-
775-
def test_demean_2D_none(self):
776-
arri = [self.sig_off,
777-
self.sig_base + self.sig_off]
778-
arrt = [self.sig_zeros,
779-
self.sig_base]
780-
input = np.vstack(arri)
781-
targ = np.vstack(arrt)
782-
with pytest.warns(MatplotlibDeprecationWarning):
783-
res = mlab.demean(input, axis=None)
784-
assert_allclose(res, targ,
785-
atol=1e-08)
786-
787-
def test_demean_2D_axis0(self):
788-
arri = [self.sig_base,
789-
self.sig_base + self.sig_off,
790-
self.sig_base + self.sig_slope,
791-
self.sig_base + self.sig_off + self.sig_slope]
792-
arrt = [self.sig_base,
793-
self.sig_base,
794-
self.sig_base + self.sig_slope_mean,
795-
self.sig_base + self.sig_slope_mean]
796-
input = np.vstack(arri).T
797-
targ = np.vstack(arrt).T
798-
with pytest.warns(MatplotlibDeprecationWarning):
799-
res = mlab.demean(input, axis=0)
800-
assert_allclose(res, targ,
801-
atol=1e-08)
802-
803-
def test_demean_2D_axis1(self):
804-
arri = [self.sig_base,
805-
self.sig_base + self.sig_off,
806-
self.sig_base + self.sig_slope,
807-
self.sig_base + self.sig_off + self.sig_slope]
808-
arrt = [self.sig_base,
809-
self.sig_base,
810-
self.sig_base + self.sig_slope_mean,
811-
self.sig_base + self.sig_slope_mean]
812-
input = np.vstack(arri)
813-
targ = np.vstack(arrt)
814-
with pytest.warns(MatplotlibDeprecationWarning):
815-
res = mlab.demean(input, axis=1)
816-
assert_allclose(res, targ,
817-
atol=1e-08)
818-
819-
def test_demean_2D_axism1(self):
820-
arri = [self.sig_base,
821-
self.sig_base + self.sig_off,
822-
self.sig_base + self.sig_slope,
823-
self.sig_base + self.sig_off + self.sig_slope]
824-
arrt = [self.sig_base,
825-
self.sig_base,
826-
self.sig_base + self.sig_slope_mean,
827-
self.sig_base + self.sig_slope_mean]
828-
input = np.vstack(arri)
829-
targ = np.vstack(arrt)
830-
with pytest.warns(MatplotlibDeprecationWarning):
831-
res = mlab.demean(input, axis=-1)
832-
assert_allclose(res, targ,
833-
atol=1e-08)
834-
835731
def test_detrend_bad_key_str_ValueError(self):
836732
input = self.sig_slope[np.newaxis]
837733
with pytest.raises(ValueError):
@@ -862,12 +758,6 @@ def test_detrend_1D_d1_ValueError(self):
862758
with pytest.raises(ValueError):
863759
mlab.detrend(input, axis=1)
864760

865-
def test_demean_1D_d1_ValueError(self):
866-
input = self.sig_slope
867-
with pytest.raises(ValueError), \
868-
pytest.warns(MatplotlibDeprecationWarning):
869-
mlab.demean(input, axis=1)
870-
871761
def test_detrend_mean_2D_d2_ValueError(self):
872762
input = self.sig_slope[np.newaxis]
873763
with pytest.raises(ValueError):
@@ -878,12 +768,6 @@ def test_detrend_2D_d2_ValueError(self):
878768
with pytest.raises(ValueError):
879769
mlab.detrend(input, axis=2)
880770

881-
def test_demean_2D_d2_ValueError(self):
882-
input = self.sig_slope[np.newaxis]
883-
with pytest.raises(ValueError), \
884-
pytest.warns(MatplotlibDeprecationWarning):
885-
mlab.demean(input, axis=2)
886-
887771
def test_detrend_linear_0D_zeros(self):
888772
input = 0.
889773
targ = 0.

0 commit comments

Comments
 (0)