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

Skip to content

Commit 1209037

Browse files
authored
Merge pull request #11247 from timhoffm/cleanup-mplDeprecation
API: Deprecate mplDeprecation
2 parents 3d19f94 + a1419cc commit 1209037

7 files changed

Lines changed: 17 additions & 9 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
``matplotlib.cbook.deprecation.mplDeprecation`` is deprecated
2+
-------------------------------------------------------------
3+
4+
:class:`matplotlib.cbook.deprecation.mplDeprecation` will be removed in
5+
future versions. It is just an alias for
6+
:class:`matplotlib.cbook.deprecation.MatplotlibDeprecationWarning`.
7+
Please use the :class:`~.MatplotlibDeprecationWarning` directly if neccessary.

lib/matplotlib/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@
140140
# definitions, so it is safe to import from it here.
141141
from . import cbook
142142
from matplotlib.cbook import (
143-
mplDeprecation, dedent, get_label, sanitize_sequence)
143+
MatplotlibDeprecationWarning, dedent, get_label, sanitize_sequence)
144+
from matplotlib.cbook import mplDeprecation # deprecated
144145
from matplotlib.rcsetup import defaultParams, validate_backend, cycler
145146

146147
import numpy
@@ -1101,7 +1102,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11011102

11021103
iter_params = defaultParams.items()
11031104
with warnings.catch_warnings():
1104-
warnings.simplefilter("ignore", mplDeprecation)
1105+
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
11051106
config = RcParams([(key, default) for key, (default, _) in iter_params
11061107
if key not in _all_deprecated])
11071108
config.update(config_from_file)
@@ -1143,7 +1144,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11431144
rcParamsOrig = rcParams.copy()
11441145

11451146
with warnings.catch_warnings():
1146-
warnings.simplefilter("ignore", mplDeprecation)
1147+
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
11471148
rcParamsDefault = RcParams([(key, default) for key, (default, converter) in
11481149
defaultParams.items()
11491150
if key not in _all_deprecated])

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import matplotlib.transforms as mtransforms
3535
import matplotlib.tri as mtri
3636
from matplotlib.cbook import (
37-
mplDeprecation, warn_deprecated, STEP_LOOKUP_MAP, iterable,
37+
MatplotlibDeprecationWarning, warn_deprecated, STEP_LOOKUP_MAP, iterable,
3838
safe_first_element)
3939
from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer
4040
from matplotlib.axes._base import _AxesBase, _process_plot_format

lib/matplotlib/cbook/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
import numpy as np
3232

3333
import matplotlib
34-
from .deprecation import deprecated, warn_deprecated
35-
from .deprecation import mplDeprecation, MatplotlibDeprecationWarning
34+
from .deprecation import (
35+
mplDeprecation, deprecated, warn_deprecated, MatplotlibDeprecationWarning)
3636

3737

3838
@deprecated("3.0")

lib/matplotlib/cbook/deprecation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class MatplotlibDeprecationWarning(UserWarning):
1717

1818

1919
mplDeprecation = MatplotlibDeprecationWarning
20+
"""mplDeprecation is deprecated. Use MatplotlibDeprecationWarning instead."""
2021

2122

2223
def _generate_deprecation_message(

lib/matplotlib/pyplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,9 +2286,9 @@ def plotfile(fname, cols=(0,), plotfuncs=None,
22862286

22872287
if plotfuncs is None:
22882288
plotfuncs = dict()
2289-
from matplotlib.cbook import mplDeprecation
2289+
from matplotlib.cbook import MatplotlibDeprecationWarning
22902290
with warnings.catch_warnings():
2291-
warnings.simplefilter('ignore', mplDeprecation)
2291+
warnings.simplefilter('ignore', MatplotlibDeprecationWarning)
22922292
r = mlab.csv2rec(fname, comments=comments, skiprows=skiprows,
22932293
checkrows=checkrows, delimiter=delimiter, names=names)
22942294

lib/matplotlib/tests/test_cycles.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import warnings
22

33
from matplotlib.testing.decorators import image_comparison
4-
from matplotlib.cbook import MatplotlibDeprecationWarning
54
import matplotlib.pyplot as plt
65
import numpy as np
76
import pytest

0 commit comments

Comments
 (0)