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

Skip to content

Remove mplDeprecation #11247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/api/next_api_changes/2018-05-16-TH.rst
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 4 additions & 3 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/cbook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions lib/matplotlib/cbook/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class MatplotlibDeprecationWarning(UserWarning):


mplDeprecation = MatplotlibDeprecationWarning
"""mplDeprecation is deprecated. Use MatplotlibDeprecationWarning instead."""


def _generate_deprecation_message(
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/gridspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/tests/test_cycles.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down