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

Skip to content

Commit 0126cc1

Browse files
committed
Remove API deprecated in 3.1 (part 2)
1 parent 34734a7 commit 0126cc1

25 files changed

+91
-1039
lines changed

doc/api/next_api_changes/removals.rst

Lines changed: 75 additions & 0 deletions
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)
@@ -68,3 +70,76 @@ Classes and methods
6870
- ``colorbar.ColorbarBase.get_clim`` (use ``ScalarMappable.get_clim`` instead)
6971
- ``colorbar.ColorbarBase.set_clim`` (use ``ScalarMappable.set_clim`` instead)
7072
- ``colorbar.ColorbarBase.set_norm`` (use ``ScalarMappable.set_norm`` instead)
73+
74+
- ``dates.seconds()`` (no replacement)
75+
- ``dates.minutes()`` (no replacement)
76+
- ``dates.hours()`` (no replacement)
77+
- ``dates.weeks()`` (no replacement)
78+
79+
- ``font_manager.OSXInstalledFonts()`` (no replacement)
80+
81+
- ``mlab.demean()`` (use ``mlab.detrend_mean()`` instead)
82+
- ``projections.process_projection_requirements()`` (no replacement)
83+
- ``path.get_paths_extents()``
84+
(use ``path.get_path_collection_extents()`` instead)
85+
86+
- ``docstring.Appender`` (no replacement)
87+
- ``docstring.dedent()`` (use ``inspect.getdoc()`` instead)
88+
- ``docstring.copy_dedent()``
89+
(use ``docstring.copy()`` and ``cbook.getdoc()`` instead)
90+
91+
- ``ticker.OldScalarFormatter.pprint_val()`` (no replacement)
92+
- ``ticker.ScalarFormatter.pprint_val()`` (no replacement)
93+
- ``ticker.LogFormatter.pprint_val()`` (no replacement)
94+
- ``ticker.decade_down()`` (no replacement)
95+
- ``ticker.decade_up()`` (no replacement)
96+
97+
- ``scale.LogTransformBase()`` (use ``scale.LogTransform()`` instead)
98+
- ``scale.InvertedLogTransformBase()`` (use ``scale.InvertedLogTransform()`` instead)
99+
- ``scale.Log10TransformBase()`` (use ``scale.LogTransform()`` instead)
100+
- ``scale.InvertedLog10TransformBase()`` (use ``scale.InvertedLogTransform()`` instead)
101+
- ``scale.Log2Transform()`` (use ``scale.LogTransform()`` instead)
102+
- ``scale.InvertedLog2Transform()`` (use ``scale.InvertedLogTransform()`` instead)
103+
- ``scale.NaturalLogTransform()`` (use ``scale.LogTransform()`` instead)
104+
- ``scale.InvertedNaturalLogTransform()`` (use ``scale.InvertedLogTransform()`` instead)
105+
106+
- ``spines.Spine.is_frame_like()`` (no replacement)
107+
- ``text.is_math_text()`` (no replacement)
108+
- ``text.TextWithDash()`` (use ``text.Annotation`` instead)
109+
- ``textpath.TextPath.is_math_text()`` (no replacement)
110+
- ``textpath.TextPath.text_get_vertices_codes()``
111+
(use ``textpath.text_to_path.get_text_path()`` instead)
112+
113+
- ``widgets.SpanSelector.buttonDown`` property (no replacement)
114+
115+
- ``mplot3d.proj3d.line2d()`` (no replacement)
116+
- ``mplot3d.proj3d.line2d_dist()`` (no replacement)
117+
- ``mplot3d.proj3d.line2d_seg_dist()`` (no replacement)
118+
- ``mplot3d.proj3d.mod()`` (use `numpy.linalg.norm`` instead)
119+
- ``mplot3d.proj3d.proj_transform_vec()`` (no replacement)
120+
- ``mplot3d.proj3d.proj_transform_vec_clip()`` (no replacement)
121+
- ``mplot3d.proj3d.vec_pad_ones()`` (no replacement)
122+
- ``mplot3d.proj3d.proj_trans_clip_points()`` (no replacement)
123+
124+
- ``mplot3d.art3d.norm_angle()`` (no replacement)
125+
- ``mplot3d.art3d.norm_text_angle()`` (no replacement)
126+
- ``mplot3d.art3d.path_to_3d_segment()`` (no replacement)
127+
- ``mplot3d.art3d.paths_to_3d_segments()`` (no replacement)
128+
- ``mplot3d.art3d.path_to_3d_segment_with_codes()`` (no replacement)
129+
- ``mplot3d.art3d.paths_to_3d_segments_with_codes()`` (no replacement)
130+
- ``mplot3d.art3d.get_patch_verts()`` (no replacement)
131+
- ``mplot3d.art3d.get_colors()`` (no replacement)
132+
- ``mplot3d.art3d.zalpha()`` (no replacement)
133+
134+
- ``mplot3d.axis3d.get_flip_min_max()`` (no replacement)
135+
- ``mplot3d.axis3d.Axis.get_tick_positions()`` (no replacement)
136+
137+
- ``axisartist.axis_artist.UnimplementedException`` (no replacement)
138+
- ``axisartist.axislines.SimpleChainedObjects`` (no replacement)
139+
- ``axisartist.axislines.Axes.AxisDict`` (no replacement)
140+
141+
- ``testing.decorators.switch_backend()`` (use ``pytest.mark.backend`` instead)
142+
143+
Others
144+
~~~~~~
145+
- The math text command ``\stackrel`` is removed. Use ``\genfrac`` instead.

lib/matplotlib/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
defines classes for drawing polygons
4949
5050
:mod:`matplotlib.text`
51-
defines the :class:`~matplotlib.text.Text`,
52-
:class:`~matplotlib.text.TextWithDash`, and
51+
defines the :class:`~matplotlib.text.Text`, and
5352
:class:`~matplotlib.text.Annotate` classes
5453
5554
:mod:`matplotlib.image`

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,7 @@ def secondary_yaxis(self, location, *, functions=None, **kwargs):
650650
raise ValueError('secondary_yaxis location must be either '
651651
'a float or "left"/"right"')
652652

653-
@cbook._delete_parameter("3.1", "withdash")
654-
def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
653+
def text(self, x, y, s, fontdict=None, **kwargs):
655654
"""
656655
Add text to the axes.
657656
@@ -671,10 +670,6 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
671670
A dictionary to override the default text properties. If fontdict
672671
is None, the defaults are determined by your rc parameters.
673672
674-
withdash : bool, default: False
675-
Creates a `~matplotlib.text.TextWithDash` instance instead of a
676-
`~matplotlib.text.Text` instance.
677-
678673
Returns
679674
-------
680675
text : `.Text`
@@ -718,21 +713,7 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
718713
**fontdict,
719714
**kwargs,
720715
}
721-
722-
# At some point if we feel confident that TextWithDash
723-
# is robust as a drop-in replacement for Text and that
724-
# the performance impact of the heavier-weight class
725-
# isn't too significant, it may make sense to eliminate
726-
# the withdash kwarg and simply delegate whether there's
727-
# a dash to TextWithDash and dashlength.
728-
729-
if (withdash
730-
and withdash is not cbook.deprecation._deprecated_parameter):
731-
t = mtext.TextWithDash(x, y, text=s)
732-
else:
733-
t = mtext.Text(x, y, text=s)
734-
t.update(effective_kwargs)
735-
716+
t = mtext.Text(x, y, text=s, **effective_kwargs)
736717
t.set_clip_path(self.patch)
737718
self._add_text(t)
738719
return t

lib/matplotlib/dates.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,38 +1836,6 @@ def date_ticker_factory(span, tz=None, numticks=5):
18361836
return locator, formatter
18371837

18381838

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-
18711839
class DateConverter(units.ConversionInterface):
18721840
"""
18731841
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: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
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
36-
from matplotlib.text import Text, TextWithDash
35+
from matplotlib.text import Text
3736
from matplotlib.transforms import (Affine2D, Bbox, BboxTransformTo,
3837
TransformedBbox)
3938
import matplotlib._layoutbox as layoutbox
@@ -1821,9 +1820,8 @@ def legend(self, *args, **kwargs):
18211820
self.stale = True
18221821
return l
18231822

1824-
@cbook._delete_parameter("3.1", "withdash")
18251823
@docstring.dedent_interpd
1826-
def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
1824+
def text(self, x, y, s, fontdict=None, **kwargs):
18271825
"""
18281826
Add text to figure.
18291827
@@ -1843,10 +1841,6 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
18431841
passed as *kwargs* override the corresponding ones given in
18441842
*fontdict*.
18451843
1846-
withdash : bool, default: False
1847-
Creates a `~matplotlib.text.TextWithDash` instance instead of a
1848-
`~matplotlib.text.Text` instance.
1849-
18501844
Other Parameters
18511845
----------------
18521846
**kwargs : `~matplotlib.text.Text` properties
@@ -1863,15 +1857,7 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
18631857
.Axes.text
18641858
.pyplot.text
18651859
"""
1866-
default = dict(transform=self.transFigure)
1867-
1868-
if (withdash
1869-
and withdash is not cbook.deprecation._deprecated_parameter):
1870-
text = TextWithDash(x=x, y=y, text=s)
1871-
else:
1872-
text = Text(x=x, y=y, text=s)
1873-
1874-
text.update(default)
1860+
text = Text(x=x, y=y, text=s, transform=self.transFigure)
18751861
if fontdict is not None:
18761862
text.update(fontdict)
18771863
text.update(kwargs)

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
@@ -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
@@ -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: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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())

0 commit comments

Comments
 (0)