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

Skip to content

Commit de69bd8

Browse files
committed
Remove API deprecated in 3.1 (part 2)
1 parent c041352 commit de69bd8

20 files changed

+59
-538
lines changed

doc/api/next_api_changes/removals.rst

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Classes and methods
5151

5252
- ``sphinxext.plot_directive.plot_directive()``
5353
(use the class ``PlotDirective`` instead)
54+
- ``sphinxext.mathmpl.math_directive()``
55+
(use the class ``MathDirective`` instead)
5456

5557
- ``Artist.aname`` property (no replacement)
5658
- ``Axis.iter_ticks`` (no replacement)
@@ -71,6 +73,47 @@ Classes and methods
7173

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

76+
- ``dates.seconds()`` (no replacement)
77+
- ``dates.minutes()`` (no replacement)
78+
- ``dates.hours()`` (no replacement)
79+
- ``dates.weeks()`` (no replacement)
80+
81+
- ``font_manager.OSXInstalledFonts()`` (no replacement)
82+
83+
- ``mlab.demean()`` (use ``mlab.detrend_mean()`` instead)
84+
- ``projections.process_projection_requirements()`` (no replacement)
85+
- ``path.get_paths_extents()``
86+
(use ``path.get_path_collection_extents()`` instead)
87+
88+
- ``docstring.Appender`` (no replacement)
89+
- ``docstring.dedent()`` (use `inspect.getdoc` instead)
90+
- ``docstring.copy_dedent()``
91+
(use ``docstring.copy()`` and `inspect.getdoc` instead)
92+
93+
- ``ticker.OldScalarFormatter.pprint_val()`` (no replacement)
94+
- ``ticker.ScalarFormatter.pprint_val()`` (no replacement)
95+
- ``ticker.LogFormatter.pprint_val()`` (no replacement)
96+
- ``ticker.decade_down()`` (no replacement)
97+
- ``ticker.decade_up()`` (no replacement)
98+
99+
- ``scale.LogTransformBase`` (use ``scale.LogTransform`` instead)
100+
- ``scale.InvertedLogTransformBase`` (use ``scale.InvertedLogTransform`` instead)
101+
- ``scale.Log10TransformBase`` (use ``scale.LogTransform`` instead)
102+
- ``scale.InvertedLog10TransformBase`` (use ``scale.InvertedLogTransform`` instead)
103+
- ``scale.Log2Transform`` (use ``scale.LogTransform`` instead)
104+
- ``scale.InvertedLog2Transform`` (use ``scale.InvertedLogTransform`` instead)
105+
- ``scale.NaturalLogTransform`` (use ``scale.LogTransform`` instead)
106+
- ``scale.InvertedNaturalLogTransform`` (use ``scale.InvertedLogTransform`` instead)
107+
108+
- ``spines.Spine.is_frame_like()`` (no replacement)
109+
- ``text.is_math_text()`` (use ``cbook.is_math_text()`` instead)
110+
- ``text.TextWithDash()`` (use ``text.Annotation`` instead)
111+
- ``textpath.TextPath.is_math_text()`` (use ``cbook.is_math_text()`` instead)
112+
- ``textpath.TextPath.text_get_vertices_codes()``
113+
(use ``textpath.text_to_path.get_text_path()`` instead)
114+
115+
- ``widgets.SpanSelector.buttonDown`` property (no replacement)
116+
74117
- ``mplot3d.proj3d.line2d()`` (no replacement)
75118
- ``mplot3d.proj3d.line2d_dist()`` (no replacement)
76119
- ``mplot3d.proj3d.line2d_seg_dist()`` (no replacement)
@@ -99,7 +142,13 @@ Classes and methods
99142
- ``axisartist.axislines.Axes.AxisDict``
100143
(use ``axis_grid1.mpl_axes.Axes.AxisDict`` instead)
101144

145+
- ``testing.decorators.switch_backend()`` (use ``pytest.mark.backend`` instead)
146+
102147
Arguments
103148
~~~~~~~~~
104149
- ``Axes.text()`` / ``pyplot.text()`` do not support the parameter ``withdash``
105-
anymore. Use ``Axes.annotate()`` and ``pyplot.annotate()`` instead.
150+
anymore. Use ``Axes.annotate()`` and ``pyplot.annotate()`` instead.
151+
152+
Others
153+
~~~~~~
154+
- The math text command ``\stackrel`` is removed. Use ``\genfrac`` instead.

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/docstring.py

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -59,43 +59,6 @@ def from_params(cls, params):
5959
return result
6060

6161

62-
@cbook.deprecated("3.1")
63-
class Appender:
64-
r"""
65-
A function decorator that will append an addendum to the docstring
66-
of the target function.
67-
68-
This decorator should be robust even if func.__doc__ is None
69-
(for example, if -OO was passed to the interpreter).
70-
71-
Usage: construct a docstring.Appender with a string to be joined to
72-
the original docstring. An optional 'join' parameter may be supplied
73-
which will be used to join the docstring and addendum. e.g.
74-
75-
add_copyright = Appender("Copyright (c) 2009", join='\n')
76-
77-
@add_copyright
78-
def my_dog(has='fleas'):
79-
"This docstring will have a copyright below"
80-
pass
81-
"""
82-
def __init__(self, addendum, join=''):
83-
self.addendum = addendum
84-
self.join = join
85-
86-
def __call__(self, func):
87-
docitems = [func.__doc__, self.addendum]
88-
func.__doc__ = func.__doc__ and self.join.join(docitems)
89-
return func
90-
91-
92-
@cbook.deprecated("3.1", alternative="inspect.getdoc()")
93-
def dedent(func):
94-
"Dedent a docstring (if present)"
95-
func.__doc__ = func.__doc__ and cbook.dedent(func.__doc__)
96-
return func
97-
98-
9962
def copy(source):
10063
"Copy a docstring from another source function (if present)"
10164
def do_copy(target):
@@ -114,14 +77,3 @@ def dedent_interpd(func):
11477
"""Dedent *func*'s docstring, then interpolate it with ``interpd``."""
11578
func.__doc__ = inspect.getdoc(func)
11679
return interpd(func)
117-
118-
119-
@cbook.deprecated("3.1", alternative="docstring.copy() and cbook.dedent()")
120-
def copy_dedent(source):
121-
"""A decorator that will copy the docstring from the source and
122-
then dedent it"""
123-
# note the following is ugly because "Python is not a functional
124-
# language" - GVR. Perhaps one day, functools.compose will exist.
125-
# or perhaps not.
126-
# http://mail.python.org/pipermail/patches/2007-February/021687.html
127-
return lambda target: dedent(copy(source)(target))

lib/matplotlib/figure.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
from matplotlib.gridspec import GridSpec
3333
import matplotlib.legend as mlegend
3434
from matplotlib.patches import Rectangle
35-
from matplotlib.projections import process_projection_requirements
3635
from matplotlib.text import Text
3736
from matplotlib.transforms import (Affine2D, Bbox, BboxTransformTo,
3837
TransformedBbox)

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/mathtext.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3169,16 +3169,6 @@ def dfrac(self, s, loc, toks):
31693169
return self._genfrac('', '', thickness,
31703170
self._math_style_dict['displaystyle'], num, den)
31713171

3172-
@cbook.deprecated("3.1", obj_type="mathtext command",
3173-
alternative=r"\genfrac")
3174-
def stackrel(self, s, loc, toks):
3175-
assert len(toks) == 1
3176-
assert len(toks[0]) == 2
3177-
num, den = toks[0]
3178-
3179-
return self._genfrac('', '', 0.0,
3180-
self._math_style_dict['textstyle'], num, den)
3181-
31823172
def binom(self, s, loc, toks):
31833173
assert len(toks) == 1
31843174
assert len(toks[0]) == 2

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/pylab.py

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

231231
from matplotlib.mlab import (
232-
demean, detrend, detrend_linear, detrend_mean, detrend_none,
233-
window_hanning, window_none)
232+
detrend, detrend_linear, detrend_mean, detrend_none, window_hanning,
233+
window_none)
234234

235235
from matplotlib import cbook, mlab, pyplot as plt
236236
from matplotlib.pyplot import *

0 commit comments

Comments
 (0)