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

Skip to content

Commit c0c33cd

Browse files
committed
Remove mplDeprecation which is just an alias to MatplotlibDeprecationWarning
1 parent df2c7a9 commit c0c33cd

File tree

10 files changed

+32
-23
lines changed

10 files changed

+32
-23
lines changed
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: 13 additions & 12 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
@@ -851,24 +852,24 @@ def __setitem__(self, key, val):
851852
if key in _deprecated_map:
852853
alt_key, alt_val, inverse_alt = _deprecated_map[key]
853854
warnings.warn(self.msg_depr % (key, alt_key),
854-
mplDeprecation)
855+
MatplotlibDeprecationWarning)
855856
key = alt_key
856857
val = alt_val(val)
857858
elif key in _deprecated_set and val is not None:
858859
if key.startswith('backend'):
859860
warnings.warn(self.msg_backend_obsolete.format(key),
860-
mplDeprecation)
861+
MatplotlibDeprecationWarning)
861862
else:
862863
warnings.warn(self.msg_depr_set % key,
863-
mplDeprecation)
864+
MatplotlibDeprecationWarning)
864865
elif key in _deprecated_ignore_map:
865866
alt = _deprecated_ignore_map[key]
866867
warnings.warn(self.msg_depr_ignore % (key, alt),
867-
mplDeprecation)
868+
MatplotlibDeprecationWarning)
868869
return
869870
elif key in _obsolete_set:
870871
warnings.warn(self.msg_obsolete % (key, ),
871-
mplDeprecation)
872+
MatplotlibDeprecationWarning)
872873
return
873874
try:
874875
cval = self.validate[key](val)
@@ -885,18 +886,18 @@ def __getitem__(self, key):
885886
if key in _deprecated_map:
886887
alt_key, alt_val, inverse_alt = _deprecated_map[key]
887888
warnings.warn(self.msg_depr % (key, alt_key),
888-
mplDeprecation)
889+
MatplotlibDeprecationWarning)
889890
key = alt_key
890891

891892
elif key in _deprecated_ignore_map:
892893
alt = _deprecated_ignore_map[key]
893894
warnings.warn(self.msg_depr_ignore % (key, alt),
894-
mplDeprecation)
895+
MatplotlibDeprecationWarning)
895896
key = alt
896897

897898
elif key in _obsolete_set:
898899
warnings.warn(self.msg_obsolete % (key, ),
899-
mplDeprecation)
900+
MatplotlibDeprecationWarning)
900901
return None
901902

902903
val = dict.__getitem__(self, key)
@@ -1045,7 +1046,7 @@ def _rc_params_in_file(fname, fail_on_error=False):
10451046
elif key in _deprecated_ignore_map:
10461047
warnings.warn('%s is deprecated. Update your matplotlibrc to use '
10471048
'%s instead.' % (key, _deprecated_ignore_map[key]),
1048-
mplDeprecation)
1049+
MatplotlibDeprecationWarning)
10491050

10501051
else:
10511052
print("""
@@ -1080,7 +1081,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
10801081

10811082
iter_params = defaultParams.items()
10821083
with warnings.catch_warnings():
1083-
warnings.simplefilter("ignore", mplDeprecation)
1084+
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
10841085
config = RcParams([(key, default) for key, (default, _) in iter_params
10851086
if key not in _all_deprecated])
10861087
config.update(config_from_file)
@@ -1121,7 +1122,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11211122
rcParamsOrig = rcParams.copy()
11221123

11231124
with warnings.catch_warnings():
1124-
warnings.simplefilter("ignore", mplDeprecation)
1125+
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
11251126
rcParamsDefault = RcParams([(key, default) for key, (default, converter) in
11261127
defaultParams.items()
11271128
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/axes/_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,8 @@ def set_adjustable(self, adjustable, share=False):
13111311
"""
13121312
if adjustable == 'box-forced':
13131313
warnings.warn("The 'box-forced' keyword argument is deprecated"
1314-
" since 2.2.", cbook.mplDeprecation, stacklevel=2)
1314+
" since 2.2.", cbook.MatplotlibDeprecationWarning,
1315+
stacklevel=2)
13151316
if adjustable not in ('box', 'datalim', 'box-forced'):
13161317
raise ValueError("argument must be 'box', or 'datalim'")
13171318
if share:

lib/matplotlib/axes/_subplots.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from matplotlib import docstring
55
import matplotlib.artist as martist
66
from matplotlib.axes._axes import Axes
7-
from matplotlib.cbook import mplDeprecation
87
from matplotlib.gridspec import GridSpec, SubplotSpec
98
import matplotlib._layoutbox as layoutbox
109

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/gridspec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from matplotlib import _pylab_helpers, tight_layout, rcParams
2424
from matplotlib.transforms import Bbox
2525
import matplotlib._layoutbox as layoutbox
26-
from matplotlib.cbook import mplDeprecation
26+
from matplotlib.cbook import MatplotlibDeprecationWarning
2727

2828
_log = logging.getLogger(__name__)
2929

@@ -278,7 +278,7 @@ def get_subplot_params(self, figure=None, fig=None):
278278
"""
279279
if fig is not None:
280280
warnings.warn("the 'fig' kwarg is deprecated "
281-
"use 'figure' instead", mplDeprecation)
281+
"use 'figure' instead", MatplotlibDeprecationWarning)
282282
if figure is None:
283283
figure = fig
284284

@@ -368,7 +368,7 @@ def get_subplot_params(self, figure=None, fig=None):
368368
"""
369369
if fig is not None:
370370
warnings.warn("the 'fig' kwarg is deprecated "
371-
"use 'figure' instead", mplDeprecation)
371+
"use 'figure' instead", MatplotlibDeprecationWarning)
372372
if figure is None:
373373
figure = fig
374374

lib/matplotlib/pyplot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from matplotlib import _pylab_helpers, interactive
3434
from matplotlib.cbook import (
3535
dedent, deprecated, silent_list, warn_deprecated, _string_to_bool)
36+
from matplotlib.cbook import mplDeprecation # deprecated
3637
from matplotlib import docstring
3738
from matplotlib.backend_bases import FigureCanvasBase
3839
from matplotlib.figure import Figure, figaspect
@@ -2276,9 +2277,9 @@ def plotfile(fname, cols=(0,), plotfuncs=None,
22762277

22772278
if plotfuncs is None:
22782279
plotfuncs = dict()
2279-
from matplotlib.cbook import mplDeprecation
2280+
from matplotlib.cbook import MatplotlibDeprecationWarning
22802281
with warnings.catch_warnings():
2281-
warnings.simplefilter('ignore', mplDeprecation)
2282+
warnings.simplefilter('ignore', MatplotlibDeprecationWarning)
22822283
r = mlab.csv2rec(fname, comments=comments, skiprows=skiprows,
22832284
checkrows=checkrows, delimiter=delimiter, names=names)
22842285

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)