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

Skip to content

Commit 727cd24

Browse files
committed
Remove more API deprecated in 3.1
1 parent c041352 commit 727cd24

File tree

7 files changed

+2
-218
lines changed

7 files changed

+2
-218
lines changed

lib/matplotlib/dates.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@
162162
'SecondLocator', 'MicrosecondLocator',
163163
'rrule', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU',
164164
'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY',
165-
'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta',
166-
'seconds', 'minutes', 'hours', 'weeks')
165+
'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta')
167166

168167

169168
_log = logging.getLogger(__name__)
@@ -1836,38 +1835,6 @@ def date_ticker_factory(span, tz=None, numticks=5):
18361835
return locator, formatter
18371836

18381837

1839-
@cbook.deprecated("3.1")
1840-
def seconds(s):
1841-
"""
1842-
Return seconds as days.
1843-
"""
1844-
return s / SEC_PER_DAY
1845-
1846-
1847-
@cbook.deprecated("3.1")
1848-
def minutes(m):
1849-
"""
1850-
Return minutes as days.
1851-
"""
1852-
return m / MINUTES_PER_DAY
1853-
1854-
1855-
@cbook.deprecated("3.1")
1856-
def hours(h):
1857-
"""
1858-
Return hours as days.
1859-
"""
1860-
return h / HOURS_PER_DAY
1861-
1862-
1863-
@cbook.deprecated("3.1")
1864-
def weeks(w):
1865-
"""
1866-
Return weeks as days.
1867-
"""
1868-
return w * DAYS_PER_WEEK
1869-
1870-
18711838
class DateConverter(units.ConversionInterface):
18721839
"""
18731840
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
@@ -191,28 +191,6 @@ def detrend(x, key=None, axis=None):
191191
f"'constant', 'mean', 'linear', or a function")
192192

193193

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

lib/matplotlib/path.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -989,23 +989,3 @@ def get_path_collection_extents(
989989
return Bbox.from_extents(*_path.get_path_collection_extents(
990990
master_transform, paths, np.atleast_3d(transforms),
991991
offsets, offset_transform))
992-
993-
994-
@cbook.deprecated("3.1", alternative="get_paths_collection_extents")
995-
def get_paths_extents(paths, transforms=[]):
996-
"""
997-
Given a sequence of :class:`Path` objects and optional
998-
:class:`~matplotlib.transforms.Transform` objects, returns the
999-
bounding box that encapsulates all of them.
1000-
1001-
*paths* is a sequence of :class:`Path` instances.
1002-
1003-
*transforms* is an optional sequence of
1004-
:class:`~matplotlib.transforms.Affine2D` instances to apply to
1005-
each path.
1006-
"""
1007-
from .transforms import Bbox, Affine2D
1008-
if len(paths) == 0:
1009-
raise ValueError("No paths provided")
1010-
return Bbox.from_extents(*_path.get_path_collection_extents(
1011-
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/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
@@ -620,34 +620,6 @@ def test_detrend_mean_1D_base_slope_off_list_axis0(self):
620620
res = mlab.detrend_mean(input.tolist(), axis=0)
621621
assert_allclose(res, targ, atol=1e-08)
622622

623-
def test_demean_0D_off(self):
624-
input = 5.5
625-
targ = 0.
626-
with pytest.warns(MatplotlibDeprecationWarning):
627-
res = mlab.demean(input, axis=None)
628-
assert_almost_equal(res, targ)
629-
630-
def test_demean_1D_base_slope_off(self):
631-
input = self.sig_base + self.sig_slope + self.sig_off
632-
targ = self.sig_base + self.sig_slope_mean
633-
with pytest.warns(MatplotlibDeprecationWarning):
634-
res = mlab.demean(input)
635-
assert_allclose(res, targ, atol=1e-08)
636-
637-
def test_demean_1D_base_slope_off_axis0(self):
638-
input = self.sig_base + self.sig_slope + self.sig_off
639-
targ = self.sig_base + self.sig_slope_mean
640-
with pytest.warns(MatplotlibDeprecationWarning):
641-
res = mlab.demean(input, axis=0)
642-
assert_allclose(res, targ, atol=1e-08)
643-
644-
def test_demean_1D_base_slope_off_list(self):
645-
input = self.sig_base + self.sig_slope + self.sig_off
646-
targ = self.sig_base + self.sig_slope_mean
647-
with pytest.warns(MatplotlibDeprecationWarning):
648-
res = mlab.demean(input.tolist())
649-
assert_allclose(res, targ, atol=1e-08)
650-
651623
def test_detrend_mean_2D_default(self):
652624
arri = [self.sig_off,
653625
self.sig_base + self.sig_off]
@@ -801,82 +773,6 @@ def test_detrend_detrend_mean_2D_axis0(self):
801773
assert_allclose(res, targ,
802774
atol=1e-08)
803775

804-
def test_demean_2D_default(self):
805-
arri = [self.sig_base,
806-
self.sig_base + self.sig_off,
807-
self.sig_base + self.sig_slope,
808-
self.sig_base + self.sig_off + self.sig_slope]
809-
arrt = [self.sig_base,
810-
self.sig_base,
811-
self.sig_base + self.sig_slope_mean,
812-
self.sig_base + self.sig_slope_mean]
813-
input = np.vstack(arri).T
814-
targ = np.vstack(arrt).T
815-
with pytest.warns(MatplotlibDeprecationWarning):
816-
res = mlab.demean(input)
817-
assert_allclose(res, targ,
818-
atol=1e-08)
819-
820-
def test_demean_2D_none(self):
821-
arri = [self.sig_off,
822-
self.sig_base + self.sig_off]
823-
arrt = [self.sig_zeros,
824-
self.sig_base]
825-
input = np.vstack(arri)
826-
targ = np.vstack(arrt)
827-
with pytest.warns(MatplotlibDeprecationWarning):
828-
res = mlab.demean(input, axis=None)
829-
assert_allclose(res, targ,
830-
atol=1e-08)
831-
832-
def test_demean_2D_axis0(self):
833-
arri = [self.sig_base,
834-
self.sig_base + self.sig_off,
835-
self.sig_base + self.sig_slope,
836-
self.sig_base + self.sig_off + self.sig_slope]
837-
arrt = [self.sig_base,
838-
self.sig_base,
839-
self.sig_base + self.sig_slope_mean,
840-
self.sig_base + self.sig_slope_mean]
841-
input = np.vstack(arri).T
842-
targ = np.vstack(arrt).T
843-
with pytest.warns(MatplotlibDeprecationWarning):
844-
res = mlab.demean(input, axis=0)
845-
assert_allclose(res, targ,
846-
atol=1e-08)
847-
848-
def test_demean_2D_axis1(self):
849-
arri = [self.sig_base,
850-
self.sig_base + self.sig_off,
851-
self.sig_base + self.sig_slope,
852-
self.sig_base + self.sig_off + self.sig_slope]
853-
arrt = [self.sig_base,
854-
self.sig_base,
855-
self.sig_base + self.sig_slope_mean,
856-
self.sig_base + self.sig_slope_mean]
857-
input = np.vstack(arri)
858-
targ = np.vstack(arrt)
859-
with pytest.warns(MatplotlibDeprecationWarning):
860-
res = mlab.demean(input, axis=1)
861-
assert_allclose(res, targ,
862-
atol=1e-08)
863-
864-
def test_demean_2D_axism1(self):
865-
arri = [self.sig_base,
866-
self.sig_base + self.sig_off,
867-
self.sig_base + self.sig_slope,
868-
self.sig_base + self.sig_off + self.sig_slope]
869-
arrt = [self.sig_base,
870-
self.sig_base,
871-
self.sig_base + self.sig_slope_mean,
872-
self.sig_base + self.sig_slope_mean]
873-
input = np.vstack(arri)
874-
targ = np.vstack(arrt)
875-
with pytest.warns(MatplotlibDeprecationWarning):
876-
res = mlab.demean(input, axis=-1)
877-
assert_allclose(res, targ,
878-
atol=1e-08)
879-
880776
def test_detrend_bad_key_str_ValueError(self):
881777
input = self.sig_slope[np.newaxis]
882778
with pytest.raises(ValueError):
@@ -907,12 +803,6 @@ def test_detrend_1D_d1_ValueError(self):
907803
with pytest.raises(ValueError):
908804
mlab.detrend(input, axis=1)
909805

910-
def test_demean_1D_d1_ValueError(self):
911-
input = self.sig_slope
912-
with pytest.raises(ValueError), \
913-
pytest.warns(MatplotlibDeprecationWarning):
914-
mlab.demean(input, axis=1)
915-
916806
def test_detrend_mean_2D_d2_ValueError(self):
917807
input = self.sig_slope[np.newaxis]
918808
with pytest.raises(ValueError):
@@ -923,12 +813,6 @@ def test_detrend_2D_d2_ValueError(self):
923813
with pytest.raises(ValueError):
924814
mlab.detrend(input, axis=2)
925815

926-
def test_demean_2D_d2_ValueError(self):
927-
input = self.sig_slope[np.newaxis]
928-
with pytest.raises(ValueError), \
929-
pytest.warns(MatplotlibDeprecationWarning):
930-
mlab.demean(input, axis=2)
931-
932816
def test_detrend_linear_0D_zeros(self):
933817
input = 0.
934818
targ = 0.

0 commit comments

Comments
 (0)