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

Skip to content

Remove more API deprecated in 3.1 #16047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions doc/api/next_api_changes/removals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Classes and methods

- ``sphinxext.plot_directive.plot_directive()``
(use the class ``PlotDirective`` instead)
- ``sphinxext.mathmpl.math_directive()``
(use the class ``MathDirective`` instead)

- ``Artist.aname`` property (no replacement)
- ``Axis.iter_ticks`` (no replacement)
Expand All @@ -69,6 +71,20 @@ Classes and methods
- ``colorbar.ColorbarBase.set_clim`` (use ``ScalarMappable.set_clim`` instead)
- ``colorbar.ColorbarBase.set_norm`` (use ``ScalarMappable.set_norm`` instead)

- ``dates.seconds()`` (no replacement)
- ``dates.minutes()`` (no replacement)
- ``dates.hours()`` (no replacement)
- ``dates.weeks()`` (no replacement)

- ``font_manager.OSXInstalledFonts()`` (no replacement)

- ``mlab.demean()`` (use ``mlab.detrend_mean()`` instead)

- ``projections.process_projection_requirements()`` (no replacement)

- ``path.get_paths_extents()``
(use ``path.get_path_collection_extents()`` instead)

- ``text.TextWithDash`` (use ``text.Annotation`` instead)

- ``mplot3d.proj3d.line2d()`` (no replacement)
Expand Down
33 changes: 0 additions & 33 deletions lib/matplotlib/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
'rrule', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU',
'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY',
'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta',
'seconds', 'minutes', 'hours', 'weeks',
'DateConverter', 'ConciseDateConverter')


Expand Down Expand Up @@ -1837,38 +1836,6 @@ def date_ticker_factory(span, tz=None, numticks=5):
return locator, formatter


@cbook.deprecated("3.1")
def seconds(s):
"""
Return seconds as days.
"""
return s / SEC_PER_DAY


@cbook.deprecated("3.1")
def minutes(m):
"""
Return minutes as days.
"""
return m / MINUTES_PER_DAY


@cbook.deprecated("3.1")
def hours(h):
"""
Return hours as days.
"""
return h / HOURS_PER_DAY


@cbook.deprecated("3.1")
def weeks(w):
"""
Return weeks as days.
"""
return w * DAYS_PER_WEEK


class DateConverter(units.ConversionInterface):
"""
Converter for `datetime.date` and `datetime.datetime` data, or for
Expand Down
10 changes: 0 additions & 10 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,6 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
return [str(path) for path in items if path.suffix.lower() in fontext]


@cbook.deprecated("3.1")
def OSXInstalledFonts(directories=None, fontext='ttf'):
"""Get list of font files on OS X."""
if directories is None:
directories = OSXFontDirectories
return [path
for directory in directories
for path in list_fonts(directory, get_fontext_synonyms(fontext))]


@lru_cache()
def _call_fc_list():
"""Cache and list the font filenames known to `fc-list`.
Expand Down
22 changes: 0 additions & 22 deletions lib/matplotlib/mlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,28 +191,6 @@ def detrend(x, key=None, axis=None):
f"'constant', 'mean', 'linear', or a function")


@cbook.deprecated("3.1", alternative="detrend_mean")
def demean(x, axis=0):
"""
Return x minus its mean along the specified axis.

Parameters
----------
x : array or sequence
Array or sequence containing the data
Can have any dimensionality

axis : int
The axis along which to take the mean. See numpy.mean for a
description of this argument.

See Also
--------
detrend_mean : Same as `demean` except for the default *axis*.
"""
return detrend_mean(x, axis=axis)


def detrend_mean(x, axis=None):
"""
Return x minus the mean(x).
Expand Down
20 changes: 0 additions & 20 deletions lib/matplotlib/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,23 +990,3 @@ def get_path_collection_extents(
return Bbox.from_extents(*_path.get_path_collection_extents(
master_transform, paths, np.atleast_3d(transforms),
offsets, offset_transform))


@cbook.deprecated("3.1", alternative="get_paths_collection_extents")
def get_paths_extents(paths, transforms=[]):
"""
Given a sequence of :class:`Path` objects and optional
:class:`~matplotlib.transforms.Transform` objects, returns the
bounding box that encapsulates all of them.

*paths* is a sequence of :class:`Path` instances.

*transforms* is an optional sequence of
:class:`~matplotlib.transforms.Affine2D` instances to apply to
each path.
"""
from .transforms import Bbox, Affine2D
if len(paths) == 0:
raise ValueError("No paths provided")
return Bbox.from_extents(*_path.get_path_collection_extents(
Affine2D(), paths, transforms, [], Affine2D()))
7 changes: 1 addition & 6 deletions lib/matplotlib/projections/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .. import axes, docstring, cbook
from .. import axes, docstring
from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
from .polar import PolarAxes
from mpl_toolkits.mplot3d import Axes3D
Expand Down Expand Up @@ -56,10 +56,5 @@ def get_projection_class(projection=None):
raise ValueError("Unknown projection %r" % projection)


@cbook.deprecated("3.1")
def process_projection_requirements(figure, *args, **kwargs):
return figure._process_projection_requirements(*args, **kwargs)


get_projection_names = projection_registry.get_projection_names
docstring.interpd.update(projection_names=get_projection_names())
4 changes: 2 additions & 2 deletions lib/matplotlib/pylab.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@
## We are still importing too many things from mlab; more cleanup is needed.

from matplotlib.mlab import (
demean, detrend, detrend_linear, detrend_mean, detrend_none,
window_hanning, window_none)
detrend, detrend_linear, detrend_mean, detrend_none, window_hanning,
window_none)

from matplotlib import cbook, mlab, pyplot as plt
from matplotlib.pyplot import *
Expand Down
10 changes: 0 additions & 10 deletions lib/matplotlib/sphinxext/mathmpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ def math_role(role, rawtext, text, lineno, inliner,
math_role.options = {'fontset': fontset_choice}


@cbook.deprecated("3.1", alternative="MathDirective")
def math_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
latex = ''.join(content)
node = latex_math(block_text)
node['latex'] = latex
node['fontset'] = options.get('fontset', 'cm')
return [node]


class MathDirective(Directive):
has_content = True
required_arguments = 0
Expand Down
116 changes: 0 additions & 116 deletions lib/matplotlib/tests/test_mlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,34 +624,6 @@ def test_detrend_mean_1D_base_slope_off_list_axis0(self):
res = mlab.detrend_mean(input.tolist(), axis=0)
assert_allclose(res, targ, atol=1e-08)

def test_demean_0D_off(self):
input = 5.5
targ = 0.
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=None)
assert_almost_equal(res, targ)

def test_demean_1D_base_slope_off(self):
input = self.sig_base + self.sig_slope + self.sig_off
targ = self.sig_base + self.sig_slope_mean
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input)
assert_allclose(res, targ, atol=1e-08)

def test_demean_1D_base_slope_off_axis0(self):
input = self.sig_base + self.sig_slope + self.sig_off
targ = self.sig_base + self.sig_slope_mean
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=0)
assert_allclose(res, targ, atol=1e-08)

def test_demean_1D_base_slope_off_list(self):
input = self.sig_base + self.sig_slope + self.sig_off
targ = self.sig_base + self.sig_slope_mean
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input.tolist())
assert_allclose(res, targ, atol=1e-08)

def test_detrend_mean_2D_default(self):
arri = [self.sig_off,
self.sig_base + self.sig_off]
Expand Down Expand Up @@ -805,82 +777,6 @@ def test_detrend_detrend_mean_2D_axis0(self):
assert_allclose(res, targ,
atol=1e-08)

def test_demean_2D_default(self):
arri = [self.sig_base,
self.sig_base + self.sig_off,
self.sig_base + self.sig_slope,
self.sig_base + self.sig_off + self.sig_slope]
arrt = [self.sig_base,
self.sig_base,
self.sig_base + self.sig_slope_mean,
self.sig_base + self.sig_slope_mean]
input = np.vstack(arri).T
targ = np.vstack(arrt).T
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input)
assert_allclose(res, targ,
atol=1e-08)

def test_demean_2D_none(self):
arri = [self.sig_off,
self.sig_base + self.sig_off]
arrt = [self.sig_zeros,
self.sig_base]
input = np.vstack(arri)
targ = np.vstack(arrt)
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=None)
assert_allclose(res, targ,
atol=1e-08)

def test_demean_2D_axis0(self):
arri = [self.sig_base,
self.sig_base + self.sig_off,
self.sig_base + self.sig_slope,
self.sig_base + self.sig_off + self.sig_slope]
arrt = [self.sig_base,
self.sig_base,
self.sig_base + self.sig_slope_mean,
self.sig_base + self.sig_slope_mean]
input = np.vstack(arri).T
targ = np.vstack(arrt).T
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=0)
assert_allclose(res, targ,
atol=1e-08)

def test_demean_2D_axis1(self):
arri = [self.sig_base,
self.sig_base + self.sig_off,
self.sig_base + self.sig_slope,
self.sig_base + self.sig_off + self.sig_slope]
arrt = [self.sig_base,
self.sig_base,
self.sig_base + self.sig_slope_mean,
self.sig_base + self.sig_slope_mean]
input = np.vstack(arri)
targ = np.vstack(arrt)
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=1)
assert_allclose(res, targ,
atol=1e-08)

def test_demean_2D_axism1(self):
arri = [self.sig_base,
self.sig_base + self.sig_off,
self.sig_base + self.sig_slope,
self.sig_base + self.sig_off + self.sig_slope]
arrt = [self.sig_base,
self.sig_base,
self.sig_base + self.sig_slope_mean,
self.sig_base + self.sig_slope_mean]
input = np.vstack(arri)
targ = np.vstack(arrt)
with pytest.warns(MatplotlibDeprecationWarning):
res = mlab.demean(input, axis=-1)
assert_allclose(res, targ,
atol=1e-08)

def test_detrend_bad_key_str_ValueError(self):
input = self.sig_slope[np.newaxis]
with pytest.raises(ValueError):
Expand Down Expand Up @@ -911,12 +807,6 @@ def test_detrend_1D_d1_ValueError(self):
with pytest.raises(ValueError):
mlab.detrend(input, axis=1)

def test_demean_1D_d1_ValueError(self):
input = self.sig_slope
with pytest.raises(ValueError), \
pytest.warns(MatplotlibDeprecationWarning):
mlab.demean(input, axis=1)

def test_detrend_mean_2D_d2_ValueError(self):
input = self.sig_slope[np.newaxis]
with pytest.raises(ValueError):
Expand All @@ -927,12 +817,6 @@ def test_detrend_2D_d2_ValueError(self):
with pytest.raises(ValueError):
mlab.detrend(input, axis=2)

def test_demean_2D_d2_ValueError(self):
input = self.sig_slope[np.newaxis]
with pytest.raises(ValueError), \
pytest.warns(MatplotlibDeprecationWarning):
mlab.demean(input, axis=2)

def test_detrend_linear_0D_zeros(self):
input = 0.
targ = 0.
Expand Down