diff --git a/doc/api/next_api_changes/2018-05-16-TH.rst b/doc/api/next_api_changes/2018-05-16-TH.rst new file mode 100644 index 000000000000..3576ab427160 --- /dev/null +++ b/doc/api/next_api_changes/2018-05-16-TH.rst @@ -0,0 +1,7 @@ +``matplotlib.cbook.deprecation.mplDeprecation`` is deprecated +------------------------------------------------------------- + +:class:`matplotlib.cbook.deprecation.mplDeprecation` will be removed in +future versions. It is just an alias for +:class:`matplotlib.cbook.deprecation.MatplotlibDeprecationWarning`. +Please use the :class:`~.MatplotlibDeprecationWarning` directly if neccessary. diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 52205228271e..fc94bca96313 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -140,7 +140,8 @@ # definitions, so it is safe to import from it here. from . import cbook from matplotlib.cbook import ( - mplDeprecation, dedent, get_label, sanitize_sequence) + MatplotlibDeprecationWarning, dedent, get_label, sanitize_sequence) +from matplotlib.cbook import mplDeprecation # deprecated from matplotlib.rcsetup import defaultParams, validate_backend, cycler import numpy @@ -1092,7 +1093,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True): iter_params = defaultParams.items() with warnings.catch_warnings(): - warnings.simplefilter("ignore", mplDeprecation) + warnings.simplefilter("ignore", MatplotlibDeprecationWarning) config = RcParams([(key, default) for key, (default, _) in iter_params if key not in _all_deprecated]) config.update(config_from_file) @@ -1133,7 +1134,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True): rcParamsOrig = rcParams.copy() with warnings.catch_warnings(): - warnings.simplefilter("ignore", mplDeprecation) + warnings.simplefilter("ignore", MatplotlibDeprecationWarning) rcParamsDefault = RcParams([(key, default) for key, (default, converter) in defaultParams.items() if key not in _all_deprecated]) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index b719cc84d4e0..1f7a49b9e477 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -34,7 +34,7 @@ import matplotlib.transforms as mtransforms import matplotlib.tri as mtri from matplotlib.cbook import ( - mplDeprecation, warn_deprecated, STEP_LOOKUP_MAP, iterable, + MatplotlibDeprecationWarning, warn_deprecated, STEP_LOOKUP_MAP, iterable, safe_first_element) from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer from matplotlib.axes._base import _AxesBase, _process_plot_format diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index b25543ea1e20..643206a016ee 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -31,8 +31,8 @@ import numpy as np import matplotlib -from .deprecation import deprecated, warn_deprecated -from .deprecation import mplDeprecation, MatplotlibDeprecationWarning +from .deprecation import ( + mplDeprecation, deprecated, warn_deprecated, MatplotlibDeprecationWarning) @deprecated("3.0") diff --git a/lib/matplotlib/cbook/deprecation.py b/lib/matplotlib/cbook/deprecation.py index 6ba7ba589ec3..2e1ea8d910c4 100644 --- a/lib/matplotlib/cbook/deprecation.py +++ b/lib/matplotlib/cbook/deprecation.py @@ -17,6 +17,7 @@ class MatplotlibDeprecationWarning(UserWarning): mplDeprecation = MatplotlibDeprecationWarning +"""mplDeprecation is deprecated. Use MatplotlibDeprecationWarning instead.""" def _generate_deprecation_message( diff --git a/lib/matplotlib/gridspec.py b/lib/matplotlib/gridspec.py index baaab83a217e..f85f061f0528 100644 --- a/lib/matplotlib/gridspec.py +++ b/lib/matplotlib/gridspec.py @@ -20,7 +20,7 @@ import numpy as np import matplotlib as mpl -from matplotlib import _pylab_helpers, tight_layout, rcParams +from matplotlib import _pylab_helpers, cbook, tight_layout, rcParams from matplotlib.transforms import Bbox import matplotlib._layoutbox as layoutbox diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index cb5f585ce366..3d0906726442 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -2276,9 +2276,9 @@ def plotfile(fname, cols=(0,), plotfuncs=None, if plotfuncs is None: plotfuncs = dict() - from matplotlib.cbook import mplDeprecation + from matplotlib.cbook import MatplotlibDeprecationWarning with warnings.catch_warnings(): - warnings.simplefilter('ignore', mplDeprecation) + warnings.simplefilter('ignore', MatplotlibDeprecationWarning) r = mlab.csv2rec(fname, comments=comments, skiprows=skiprows, checkrows=checkrows, delimiter=delimiter, names=names) diff --git a/lib/matplotlib/tests/test_cycles.py b/lib/matplotlib/tests/test_cycles.py index ac876ee7fa3c..0d1cecfec6eb 100644 --- a/lib/matplotlib/tests/test_cycles.py +++ b/lib/matplotlib/tests/test_cycles.py @@ -1,7 +1,6 @@ import warnings from matplotlib.testing.decorators import image_comparison -from matplotlib.cbook import MatplotlibDeprecationWarning import matplotlib.pyplot as plt import numpy as np import pytest