Skip to content

Commit 99635c3

Browse files
committed
Remove API deprecated in 3.1 (part 2)
1 parent 0abeab1 commit 99635c3

File tree

21 files changed

+75
-982
lines changed

21 files changed

+75
-982
lines changed

doc/api/next_api_changes/removals.rst

+75
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.Log10Transform()`` instead)
100+
- ``scale.InvertedLog10TransformBase()`` (use ``scale.InvertedLog10Transform()`` 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()`` (no replacement)
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 ``\tackrel`` is removed. Use ``\genfrac`` instead.

lib/matplotlib/dates.py

-32
Original file line numberDiff line numberDiff line change
@@ -1835,38 +1835,6 @@ def date_ticker_factory(span, tz=None, numticks=5):
18351835
return locator, formatter
18361836

18371837

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

lib/matplotlib/docstring.py

-48
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/font_manager.py

-10
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

-10
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

-22
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 : integer
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

-20
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

-5
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())

lib/matplotlib/scale.py

-75
Original file line numberDiff line numberDiff line change
@@ -200,81 +200,6 @@ def set_default_locators_and_formatters(self, axis):
200200
axis.set_minor_locator(NullLocator())
201201

202202

203-
@cbook.deprecated("3.1", alternative="LogTransform")
204-
class LogTransformBase(Transform):
205-
input_dims = output_dims = 1
206-
207-
def __init__(self, nonpos='clip'):
208-
Transform.__init__(self)
209-
self._clip = {"clip": True, "mask": False}[nonpos]
210-
211-
def transform_non_affine(self, a):
212-
return LogTransform.transform_non_affine(self, a)
213-
214-
def __str__(self):
215-
return "{}({!r})".format(
216-
type(self).__name__, "clip" if self._clip else "mask")
217-
218-
219-
@cbook.deprecated("3.1", alternative="InvertedLogTransform")
220-
class InvertedLogTransformBase(Transform):
221-
input_dims = output_dims = 1
222-
223-
def transform_non_affine(self, a):
224-
return ma.power(self.base, a)
225-
226-
def __str__(self):
227-
return "{}()".format(type(self).__name__)
228-
229-
230-
@cbook.deprecated("3.1", alternative="LogTransform")
231-
class Log10Transform(LogTransformBase):
232-
base = 10.0
233-
234-
def inverted(self):
235-
return InvertedLog10Transform()
236-
237-
238-
@cbook.deprecated("3.1", alternative="InvertedLogTransform")
239-
class InvertedLog10Transform(InvertedLogTransformBase):
240-
base = 10.0
241-
242-
def inverted(self):
243-
return Log10Transform()
244-
245-
246-
@cbook.deprecated("3.1", alternative="LogTransform")
247-
class Log2Transform(LogTransformBase):
248-
base = 2.0
249-
250-
def inverted(self):
251-
return InvertedLog2Transform()
252-
253-
254-
@cbook.deprecated("3.1", alternative="InvertedLogTransform")
255-
class InvertedLog2Transform(InvertedLogTransformBase):
256-
base = 2.0
257-
258-
def inverted(self):
259-
return Log2Transform()
260-
261-
262-
@cbook.deprecated("3.1", alternative="LogTransform")
263-
class NaturalLogTransform(LogTransformBase):
264-
base = np.e
265-
266-
def inverted(self):
267-
return InvertedNaturalLogTransform()
268-
269-
270-
@cbook.deprecated("3.1", alternative="InvertedLogTransform")
271-
class InvertedNaturalLogTransform(InvertedLogTransformBase):
272-
base = np.e
273-
274-
def inverted(self):
275-
return NaturalLogTransform()
276-
277-
278203
class LogTransform(Transform):
279204
input_dims = output_dims = 1
280205

lib/matplotlib/sphinxext/mathmpl.py

-10
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

0 commit comments

Comments
 (0)