From de69bd82832082d0bb6117258ed2172f064143d1 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sun, 8 Dec 2019 18:54:57 +0100 Subject: [PATCH] Remove API deprecated in 3.1 (part 2) --- doc/api/next_api_changes/removals.rst | 51 ++++++++++- lib/matplotlib/dates.py | 35 +------- lib/matplotlib/docstring.py | 48 ---------- lib/matplotlib/figure.py | 1 - lib/matplotlib/font_manager.py | 10 --- lib/matplotlib/mathtext.py | 10 --- lib/matplotlib/mlab.py | 22 ----- lib/matplotlib/path.py | 20 ----- lib/matplotlib/projections/__init__.py | 7 +- lib/matplotlib/pylab.py | 4 +- lib/matplotlib/scale.py | 85 +----------------- lib/matplotlib/sphinxext/mathmpl.py | 10 --- lib/matplotlib/spines.py | 22 ----- lib/matplotlib/testing/decorators.py | 20 ----- lib/matplotlib/tests/test_mlab.py | 116 ------------------------- lib/matplotlib/tests/test_scale.py | 10 +-- lib/matplotlib/text.py | 24 ----- lib/matplotlib/textpath.py | 33 ------- lib/matplotlib/ticker.py | 64 -------------- lib/matplotlib/widgets.py | 5 -- 20 files changed, 59 insertions(+), 538 deletions(-) diff --git a/doc/api/next_api_changes/removals.rst b/doc/api/next_api_changes/removals.rst index 40bf07a4d421..12bad84e939e 100644 --- a/doc/api/next_api_changes/removals.rst +++ b/doc/api/next_api_changes/removals.rst @@ -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) @@ -71,6 +73,47 @@ Classes and methods - ``text.TextWithDash`` (use ``text.Annotation`` 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) + +- ``docstring.Appender`` (no replacement) +- ``docstring.dedent()`` (use `inspect.getdoc` instead) +- ``docstring.copy_dedent()`` + (use ``docstring.copy()`` and `inspect.getdoc` instead) + +- ``ticker.OldScalarFormatter.pprint_val()`` (no replacement) +- ``ticker.ScalarFormatter.pprint_val()`` (no replacement) +- ``ticker.LogFormatter.pprint_val()`` (no replacement) +- ``ticker.decade_down()`` (no replacement) +- ``ticker.decade_up()`` (no replacement) + +- ``scale.LogTransformBase`` (use ``scale.LogTransform`` instead) +- ``scale.InvertedLogTransformBase`` (use ``scale.InvertedLogTransform`` instead) +- ``scale.Log10TransformBase`` (use ``scale.LogTransform`` instead) +- ``scale.InvertedLog10TransformBase`` (use ``scale.InvertedLogTransform`` instead) +- ``scale.Log2Transform`` (use ``scale.LogTransform`` instead) +- ``scale.InvertedLog2Transform`` (use ``scale.InvertedLogTransform`` instead) +- ``scale.NaturalLogTransform`` (use ``scale.LogTransform`` instead) +- ``scale.InvertedNaturalLogTransform`` (use ``scale.InvertedLogTransform`` instead) + +- ``spines.Spine.is_frame_like()`` (no replacement) +- ``text.is_math_text()`` (use ``cbook.is_math_text()`` instead) +- ``text.TextWithDash()`` (use ``text.Annotation`` instead) +- ``textpath.TextPath.is_math_text()`` (use ``cbook.is_math_text()`` instead) +- ``textpath.TextPath.text_get_vertices_codes()`` + (use ``textpath.text_to_path.get_text_path()`` instead) + +- ``widgets.SpanSelector.buttonDown`` property (no replacement) + - ``mplot3d.proj3d.line2d()`` (no replacement) - ``mplot3d.proj3d.line2d_dist()`` (no replacement) - ``mplot3d.proj3d.line2d_seg_dist()`` (no replacement) @@ -99,7 +142,13 @@ Classes and methods - ``axisartist.axislines.Axes.AxisDict`` (use ``axis_grid1.mpl_axes.Axes.AxisDict`` instead) +- ``testing.decorators.switch_backend()`` (use ``pytest.mark.backend`` instead) + Arguments ~~~~~~~~~ - ``Axes.text()`` / ``pyplot.text()`` do not support the parameter ``withdash`` - anymore. Use ``Axes.annotate()`` and ``pyplot.annotate()`` instead. \ No newline at end of file + anymore. Use ``Axes.annotate()`` and ``pyplot.annotate()`` instead. + +Others +~~~~~~ +- The math text command ``\stackrel`` is removed. Use ``\genfrac`` instead. diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 8c88a6a35c8b..80ee28a0806c 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -162,8 +162,7 @@ 'SecondLocator', 'MicrosecondLocator', 'rrule', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU', 'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY', - 'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta', - 'seconds', 'minutes', 'hours', 'weeks') + 'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta') _log = logging.getLogger(__name__) @@ -1836,38 +1835,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 diff --git a/lib/matplotlib/docstring.py b/lib/matplotlib/docstring.py index 8ac6d8153f11..a7ad075a57e8 100644 --- a/lib/matplotlib/docstring.py +++ b/lib/matplotlib/docstring.py @@ -59,43 +59,6 @@ def from_params(cls, params): return result -@cbook.deprecated("3.1") -class Appender: - r""" - A function decorator that will append an addendum to the docstring - of the target function. - - This decorator should be robust even if func.__doc__ is None - (for example, if -OO was passed to the interpreter). - - Usage: construct a docstring.Appender with a string to be joined to - the original docstring. An optional 'join' parameter may be supplied - which will be used to join the docstring and addendum. e.g. - - add_copyright = Appender("Copyright (c) 2009", join='\n') - - @add_copyright - def my_dog(has='fleas'): - "This docstring will have a copyright below" - pass - """ - def __init__(self, addendum, join=''): - self.addendum = addendum - self.join = join - - def __call__(self, func): - docitems = [func.__doc__, self.addendum] - func.__doc__ = func.__doc__ and self.join.join(docitems) - return func - - -@cbook.deprecated("3.1", alternative="inspect.getdoc()") -def dedent(func): - "Dedent a docstring (if present)" - func.__doc__ = func.__doc__ and cbook.dedent(func.__doc__) - return func - - def copy(source): "Copy a docstring from another source function (if present)" def do_copy(target): @@ -114,14 +77,3 @@ def dedent_interpd(func): """Dedent *func*'s docstring, then interpolate it with ``interpd``.""" func.__doc__ = inspect.getdoc(func) return interpd(func) - - -@cbook.deprecated("3.1", alternative="docstring.copy() and cbook.dedent()") -def copy_dedent(source): - """A decorator that will copy the docstring from the source and - then dedent it""" - # note the following is ugly because "Python is not a functional - # language" - GVR. Perhaps one day, functools.compose will exist. - # or perhaps not. - # http://mail.python.org/pipermail/patches/2007-February/021687.html - return lambda target: dedent(copy(source)(target)) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index c1501f660fac..8b06b7b69051 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -32,7 +32,6 @@ from matplotlib.gridspec import GridSpec import matplotlib.legend as mlegend from matplotlib.patches import Rectangle -from matplotlib.projections import process_projection_requirements from matplotlib.text import Text from matplotlib.transforms import (Affine2D, Bbox, BboxTransformTo, TransformedBbox) diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index 21225c84861e..424658e7b3de 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -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`. diff --git a/lib/matplotlib/mathtext.py b/lib/matplotlib/mathtext.py index bfcff195f13a..280b18e32181 100644 --- a/lib/matplotlib/mathtext.py +++ b/lib/matplotlib/mathtext.py @@ -3169,16 +3169,6 @@ def dfrac(self, s, loc, toks): return self._genfrac('', '', thickness, self._math_style_dict['displaystyle'], num, den) - @cbook.deprecated("3.1", obj_type="mathtext command", - alternative=r"\genfrac") - def stackrel(self, s, loc, toks): - assert len(toks) == 1 - assert len(toks[0]) == 2 - num, den = toks[0] - - return self._genfrac('', '', 0.0, - self._math_style_dict['textstyle'], num, den) - def binom(self, s, loc, toks): assert len(toks) == 1 assert len(toks[0]) == 2 diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index a361f2a3cf77..e2d8fa95c676 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -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). diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index d87c705ce9b0..7908a5366be2 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -989,23 +989,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())) diff --git a/lib/matplotlib/projections/__init__.py b/lib/matplotlib/projections/__init__.py index c13c16972e91..8f854b47d744 100644 --- a/lib/matplotlib/projections/__init__.py +++ b/lib/matplotlib/projections/__init__.py @@ -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 @@ -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()) diff --git a/lib/matplotlib/pylab.py b/lib/matplotlib/pylab.py index 63ffa3e71603..3f93c753b80a 100644 --- a/lib/matplotlib/pylab.py +++ b/lib/matplotlib/pylab.py @@ -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 * diff --git a/lib/matplotlib/scale.py b/lib/matplotlib/scale.py index 4a50a536bddc..6a9558a36dec 100644 --- a/lib/matplotlib/scale.py +++ b/lib/matplotlib/scale.py @@ -200,81 +200,6 @@ def set_default_locators_and_formatters(self, axis): axis.set_minor_locator(NullLocator()) -@cbook.deprecated("3.1", alternative="LogTransform") -class LogTransformBase(Transform): - input_dims = output_dims = 1 - - def __init__(self, nonpos='clip'): - Transform.__init__(self) - self._clip = {"clip": True, "mask": False}[nonpos] - - def transform_non_affine(self, a): - return LogTransform.transform_non_affine(self, a) - - def __str__(self): - return "{}({!r})".format( - type(self).__name__, "clip" if self._clip else "mask") - - -@cbook.deprecated("3.1", alternative="InvertedLogTransform") -class InvertedLogTransformBase(Transform): - input_dims = output_dims = 1 - - def transform_non_affine(self, a): - return ma.power(self.base, a) - - def __str__(self): - return "{}()".format(type(self).__name__) - - -@cbook.deprecated("3.1", alternative="LogTransform") -class Log10Transform(LogTransformBase): - base = 10.0 - - def inverted(self): - return InvertedLog10Transform() - - -@cbook.deprecated("3.1", alternative="InvertedLogTransform") -class InvertedLog10Transform(InvertedLogTransformBase): - base = 10.0 - - def inverted(self): - return Log10Transform() - - -@cbook.deprecated("3.1", alternative="LogTransform") -class Log2Transform(LogTransformBase): - base = 2.0 - - def inverted(self): - return InvertedLog2Transform() - - -@cbook.deprecated("3.1", alternative="InvertedLogTransform") -class InvertedLog2Transform(InvertedLogTransformBase): - base = 2.0 - - def inverted(self): - return Log2Transform() - - -@cbook.deprecated("3.1", alternative="LogTransform") -class NaturalLogTransform(LogTransformBase): - base = np.e - - def inverted(self): - return InvertedNaturalLogTransform() - - -@cbook.deprecated("3.1", alternative="InvertedLogTransform") -class InvertedNaturalLogTransform(InvertedLogTransformBase): - base = np.e - - def inverted(self): - return NaturalLogTransform() - - class LogTransform(Transform): input_dims = output_dims = 1 @@ -313,7 +238,7 @@ def inverted(self): return InvertedLogTransform(self.base) -class InvertedLogTransform(InvertedLogTransformBase): +class InvertedLogTransform(Transform): input_dims = output_dims = 1 def __init__(self, base): @@ -336,14 +261,6 @@ class LogScale(ScaleBase): """ name = 'log' - # compatibility shim - LogTransformBase = LogTransformBase - Log10Transform = Log10Transform - InvertedLog10Transform = InvertedLog10Transform - Log2Transform = Log2Transform - InvertedLog2Transform = InvertedLog2Transform - NaturalLogTransform = NaturalLogTransform - InvertedNaturalLogTransform = InvertedNaturalLogTransform LogTransform = LogTransform InvertedLogTransform = InvertedLogTransform diff --git a/lib/matplotlib/sphinxext/mathmpl.py b/lib/matplotlib/sphinxext/mathmpl.py index 4ba446e4eff8..6c3b1c1087ab 100644 --- a/lib/matplotlib/sphinxext/mathmpl.py +++ b/lib/matplotlib/sphinxext/mathmpl.py @@ -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 diff --git a/lib/matplotlib/spines.py b/lib/matplotlib/spines.py index b0b61a81ceb5..74059231eb09 100644 --- a/lib/matplotlib/spines.py +++ b/lib/matplotlib/spines.py @@ -241,28 +241,6 @@ def cla(self): if self.axis is not None: self.axis.cla() - @cbook.deprecated("3.1") - def is_frame_like(self): - """Return True if directly on axes frame. - - This is useful for determining if a spine is the edge of an - old style MPL plot. If so, this function will return True. - """ - self._ensure_position_is_set() - position = self._position - if isinstance(position, str): - if position == 'center': - position = ('axes', 0.5) - elif position == 'zero': - position = ('data', 0) - if len(position) != 2: - raise ValueError("position should be 2-tuple") - position_type, amount = position - if position_type == 'outward' and amount == 0: - return True - else: - return False - def _adjust_location(self): """Automatically set spine bounds to the view interval.""" diff --git a/lib/matplotlib/testing/decorators.py b/lib/matplotlib/testing/decorators.py index 1fdefa378110..481d24bd48e6 100644 --- a/lib/matplotlib/testing/decorators.py +++ b/lib/matplotlib/testing/decorators.py @@ -439,23 +439,3 @@ def _image_directories(func): result_dir = Path().resolve() / "result_images" / module_path.stem result_dir.mkdir(parents=True, exist_ok=True) return baseline_dir, result_dir - - -@cbook.deprecated("3.1", alternative="pytest.mark.backend") -def switch_backend(backend): - - def switch_backend_decorator(func): - - @functools.wraps(func) - def backend_switcher(*args, **kwargs): - try: - prev_backend = mpl.get_backend() - matplotlib.testing.setup() - plt.switch_backend(backend) - return func(*args, **kwargs) - finally: - plt.switch_backend(prev_backend) - - return backend_switcher - - return switch_backend_decorator diff --git a/lib/matplotlib/tests/test_mlab.py b/lib/matplotlib/tests/test_mlab.py index bbe9ac8bafaf..7d791eb9cce3 100644 --- a/lib/matplotlib/tests/test_mlab.py +++ b/lib/matplotlib/tests/test_mlab.py @@ -620,34 +620,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] @@ -801,82 +773,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): @@ -907,12 +803,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): @@ -923,12 +813,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. diff --git a/lib/matplotlib/tests/test_scale.py b/lib/matplotlib/tests/test_scale.py index 0acc89e8b1aa..4936a0224e15 100644 --- a/lib/matplotlib/tests/test_scale.py +++ b/lib/matplotlib/tests/test_scale.py @@ -1,7 +1,7 @@ from matplotlib.cbook import MatplotlibDeprecationWarning import matplotlib.pyplot as plt -from matplotlib.scale import (Log10Transform, InvertedLog10Transform, - SymmetricalLogTransform) +from matplotlib.scale import ( + LogTransform, InvertedLogTransform, SymmetricalLogTransform) from matplotlib.testing.decorators import check_figures_equal, image_comparison import numpy as np @@ -127,8 +127,7 @@ def test_logscale_invert_transform(): tform = (ax.transAxes + ax.transData.inverted()).inverted() # direct test of log transform inversion - with pytest.warns(MatplotlibDeprecationWarning): - assert isinstance(Log10Transform().inverted(), InvertedLog10Transform) + assert isinstance(LogTransform(base=10).inverted(), InvertedLogTransform) def test_logscale_transform_repr(): @@ -137,8 +136,7 @@ def test_logscale_transform_repr(): repr(ax.transData) # check that repr of log transform succeeds # check that repr of log transform succeeds - with pytest.warns(MatplotlibDeprecationWarning): - repr(Log10Transform(nonpos='clip')) + repr(LogTransform(base=10, nonpos='clip')) @image_comparison(['logscale_nonpos_values.png'], diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index e6a2378ce9bf..932824bb00f8 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -1163,30 +1163,6 @@ def set_text(self, s): self._text = str(s) self.stale = True - @staticmethod - @cbook.deprecated("3.1") - def is_math_text(s, usetex=None): - """ - Returns a cleaned string and a boolean flag. - The flag indicates if the given string *s* contains any mathtext, - determined by counting unescaped dollar signs. If no mathtext - is present, the cleaned string has its dollar signs unescaped. - If usetex is on, the flag always has the value "TeX". - """ - # Did we find an even number of non-escaped dollar signs? - # If so, treat is as math text. - if usetex is None: - usetex = rcParams['text.usetex'] - if usetex: - if s == ' ': - s = r'\ ' - return s, 'TeX' - - if cbook.is_math_text(s): - return s, True - else: - return s.replace(r'\$', '$'), False - def _preprocess_math(self, s): """ Return the string *s* after mathtext preprocessing, and the kind of diff --git a/lib/matplotlib/textpath.py b/lib/matplotlib/textpath.py index 5494a6400062..190bd12e6859 100644 --- a/lib/matplotlib/textpath.py +++ b/lib/matplotlib/textpath.py @@ -457,36 +457,3 @@ def _revalidate_path(self): .translate(*self._xy)) self._cached_vertices = tr.transform(self._vertices) self._invalid = False - - @cbook.deprecated("3.1") - def is_math_text(self, s): - """ - Returns True if the given string *s* contains any mathtext. - """ - # copied from Text.is_math_text -JJL - - # Did we find an even number of non-escaped dollar signs? - # If so, treat is as math text. - dollar_count = s.count(r'$') - s.count(r'\$') - even_dollars = (dollar_count > 0 and dollar_count % 2 == 0) - - if rcParams['text.usetex']: - return s, 'TeX' - - if even_dollars: - return s, True - else: - return s.replace(r'\$', '$'), False - - @cbook.deprecated("3.1", alternative="TextPath") - def text_get_vertices_codes(self, prop, s, usetex): - """ - Convert string *s* to a (vertices, codes) pair using font property - *prop*. - """ - # Mostly copied from backend_svg.py. - if usetex: - return text_to_path.get_text_path(prop, s, usetex=True) - else: - clean_line, ismath = self.is_math_text(s) - return text_to_path.get_text_path(prop, clean_line, ismath=ismath) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 842f506eb55d..35172a636c62 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -462,38 +462,6 @@ def __call__(self, x, pos=None): s = s.rstrip('0').rstrip('.') return s - @cbook.deprecated("3.1") - def pprint_val(self, x, d): - """ - Formats the value *x* based on the size of the axis range *d*. - """ - # If the number is not too big and it's an int, format it as an int. - if abs(x) < 1e4 and x == int(x): - return '%d' % x - - if d < 1e-2: - fmt = '%1.3e' - elif d < 1e-1: - fmt = '%1.3f' - elif d > 1e5: - fmt = '%1.1e' - elif d > 10: - fmt = '%1.1f' - elif d > 1: - fmt = '%1.2f' - else: - fmt = '%1.3f' - s = fmt % x - tup = s.split('e') - if len(tup) == 2: - mantissa = tup[0].rstrip('0').rstrip('.') - sign = tup[1][0].replace('+', '') - exponent = tup[1][1:].lstrip('0') - s = '%se%s%s' % (mantissa, sign, exponent) - else: - s = s.rstrip('0').rstrip('.') - return s - class ScalarFormatter(Formatter): """ @@ -779,16 +747,6 @@ def _set_format(self): if self._usetex or self._useMathText: self.format = r'$\mathdefault{%s}$' % self.format - @cbook.deprecated("3.1") - def pprint_val(self, x): - xp = (x - self.offset) / (10. ** self.orderOfMagnitude) - if abs(xp) < 1e-8: - xp = 0 - if self._useLocale: - return locale.format_string(self.format, (xp,)) - else: - return self.format % xp - def _formatSciNotation(self, s): # transform 1e+004 into 1e4, for example if self._useLocale: @@ -1019,10 +977,6 @@ def format_data_short(self, value): # docstring inherited return '%-12g' % value - @cbook.deprecated("3.1") - def pprint_val(self, *args, **kwargs): - return self._pprint_val(*args, **kwargs) - def _pprint_val(self, x, d): # If the number is not too big and it's an int, format it as an int. if abs(x) < 1e4 and x == int(x): @@ -2215,24 +2169,6 @@ def view_limits(self, dmin, dmax): return dmin, dmax -@cbook.deprecated("3.1") -def decade_down(x, base=10): - """Floor x to the nearest lower decade.""" - if x == 0.0: - return -base - lx = np.floor(np.log(x) / np.log(base)) - return base ** lx - - -@cbook.deprecated("3.1") -def decade_up(x, base=10): - """Ceil x to the nearest higher decade.""" - if x == 0.0: - return base - lx = np.ceil(np.log(x) / np.log(base)) - return base ** lx - - def is_decade(x, base=10, *, rtol=1e-10): if not np.isfinite(x): return False diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 52ed9dbedadd..06bb0d67800d 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -1821,11 +1821,6 @@ def _release(self, event): self.pressv = None return False - @cbook.deprecated("3.1") - @property - def buttonDown(self): - return False - def _onmove(self, event): """on motion notify event""" if self.pressv is None: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy