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

Skip to content

Commit 0a35d2a

Browse files
committed
Remove mplDeprecation which is just an alias to MatplotlibDeprecationWarning
1 parent bf2b799 commit 0a35d2a

File tree

12 files changed

+33
-27
lines changed

12 files changed

+33
-27
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 for
6+
:class:`matplotlib.cbook.deprecation.MatplotlibDeprecationWarning`.
7+
Please use the :class:`~.MatplotlibDeprecationWarning` directly if neccessary.

lib/matplotlib/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
# definitions, so it is safe to import from it here.
143143
from . import cbook
144144
from matplotlib.cbook import (
145-
mplDeprecation, dedent, get_label, sanitize_sequence)
145+
MatplotlibDeprecationWarning, dedent, get_label, sanitize_sequence)
146146
from matplotlib.rcsetup import defaultParams, validate_backend, cycler
147147

148148
import numpy
@@ -858,24 +858,24 @@ def __setitem__(self, key, val):
858858
if key in _deprecated_map:
859859
alt_key, alt_val, inverse_alt = _deprecated_map[key]
860860
warnings.warn(self.msg_depr % (key, alt_key),
861-
mplDeprecation)
861+
MatplotlibDeprecationWarning)
862862
key = alt_key
863863
val = alt_val(val)
864864
elif key in _deprecated_set and val is not None:
865865
if key.startswith('backend'):
866866
warnings.warn(self.msg_backend_obsolete.format(key),
867-
mplDeprecation)
867+
MatplotlibDeprecationWarning)
868868
else:
869869
warnings.warn(self.msg_depr_set % key,
870-
mplDeprecation)
870+
MatplotlibDeprecationWarning)
871871
elif key in _deprecated_ignore_map:
872872
alt = _deprecated_ignore_map[key]
873873
warnings.warn(self.msg_depr_ignore % (key, alt),
874-
mplDeprecation)
874+
MatplotlibDeprecationWarning)
875875
return
876876
elif key in _obsolete_set:
877877
warnings.warn(self.msg_obsolete % (key, ),
878-
mplDeprecation)
878+
MatplotlibDeprecationWarning)
879879
return
880880
try:
881881
cval = self.validate[key](val)
@@ -892,18 +892,18 @@ def __getitem__(self, key):
892892
if key in _deprecated_map:
893893
alt_key, alt_val, inverse_alt = _deprecated_map[key]
894894
warnings.warn(self.msg_depr % (key, alt_key),
895-
mplDeprecation)
895+
MatplotlibDeprecationWarning)
896896
key = alt_key
897897

898898
elif key in _deprecated_ignore_map:
899899
alt = _deprecated_ignore_map[key]
900900
warnings.warn(self.msg_depr_ignore % (key, alt),
901-
mplDeprecation)
901+
MatplotlibDeprecationWarning)
902902
key = alt
903903

904904
elif key in _obsolete_set:
905905
warnings.warn(self.msg_obsolete % (key, ),
906-
mplDeprecation)
906+
MatplotlibDeprecationWarning)
907907
return None
908908

909909
val = dict.__getitem__(self, key)
@@ -1052,7 +1052,7 @@ def _rc_params_in_file(fname, fail_on_error=False):
10521052
elif key in _deprecated_ignore_map:
10531053
warnings.warn('%s is deprecated. Update your matplotlibrc to use '
10541054
'%s instead.' % (key, _deprecated_ignore_map[key]),
1055-
mplDeprecation)
1055+
MatplotlibDeprecationWarning)
10561056

10571057
else:
10581058
print("""
@@ -1087,7 +1087,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
10871087

10881088
iter_params = defaultParams.items()
10891089
with warnings.catch_warnings():
1090-
warnings.simplefilter("ignore", mplDeprecation)
1090+
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
10911091
config = RcParams([(key, default) for key, (default, _) in iter_params
10921092
if key not in _all_deprecated])
10931093
config.update(config_from_file)
@@ -1128,7 +1128,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11281128
rcParamsOrig = rcParams.copy()
11291129

11301130
with warnings.catch_warnings():
1131-
warnings.simplefilter("ignore", mplDeprecation)
1131+
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
11321132
rcParamsDefault = RcParams([(key, default) for key, (default, converter) in
11331133
defaultParams.items()
11341134
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ def set_adjustable(self, adjustable, share=False):
13351335
"""
13361336
if adjustable == 'box-forced':
13371337
warnings.warn("The 'box-forced' keyword argument is deprecated"
1338-
" since 2.2.", cbook.mplDeprecation)
1338+
" since 2.2.", cbook.MatplotlibDeprecationWarning)
13391339
if adjustable not in ('box', 'datalim', 'box-forced'):
13401340
raise ValueError("argument must be 'box', or 'datalim'")
13411341
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+
deprecated, warn_deprecated, MatplotlibDeprecationWarning)
3636

3737

3838
@deprecated("3.0")

lib/matplotlib/cbook/deprecation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class MatplotlibDeprecationWarning(UserWarning):
1818

1919

2020
mplDeprecation = MatplotlibDeprecationWarning
21+
"""mplDeprecation is deprecated. Use MatplotlibDeprecationWarning instead."""
2122

2223

2324
def _generate_deprecation_message(
@@ -100,7 +101,7 @@ def warn_deprecated(
100101
"""
101102
message = _generate_deprecation_message(
102103
since, message, name, alternative, pending, obj_type, removal=removal)
103-
warnings.warn(message, mplDeprecation, stacklevel=2)
104+
warnings.warn(message, MatplotlibDeprecationWarning, stacklevel=2)
104105

105106

106107
def deprecated(since, message='', name='', alternative='', pending=False,
@@ -205,7 +206,7 @@ def finalize(wrapper, new_doc):
205206
removal=removal)
206207

207208
def wrapper(*args, **kwargs):
208-
warnings.warn(message, mplDeprecation, stacklevel=2)
209+
warnings.warn(message, MatplotlibDeprecationWarning, stacklevel=2)
209210
return func(*args, **kwargs)
210211

211212
old_doc = textwrap.dedent(old_doc or '').strip('\n')

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

@@ -266,7 +266,7 @@ def get_subplot_params(self, figure=None, fig=None):
266266
"""
267267
if fig is not None:
268268
warnings.warn("the 'fig' kwarg is deprecated "
269-
"use 'figure' instead", mplDeprecation)
269+
"use 'figure' instead", MatplotlibDeprecationWarning)
270270
if figure is None:
271271
figure = fig
272272

@@ -356,7 +356,7 @@ def get_subplot_params(self, figure=None, fig=None):
356356
"""
357357
if fig is not None:
358358
warnings.warn("the 'fig' kwarg is deprecated "
359-
"use 'figure' instead", mplDeprecation)
359+
"use 'figure' instead", MatplotlibDeprecationWarning)
360360
if figure is None:
361361
figure = fig
362362

lib/matplotlib/pyplot.py

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

21282128
if plotfuncs is None:
21292129
plotfuncs = dict()
2130-
from matplotlib.cbook import mplDeprecation
2130+
from matplotlib.cbook import MatplotlibDeprecationWarning
21312131
with warnings.catch_warnings():
2132-
warnings.simplefilter('ignore', mplDeprecation)
2132+
warnings.simplefilter('ignore', MatplotlibDeprecationWarning)
21332133
r = mlab.csv2rec(fname, comments=comments, skiprows=skiprows,
21342134
checkrows=checkrows, delimiter=delimiter, names=names)
21352135

lib/matplotlib/rcsetup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
import re
2424

2525
from matplotlib import cbook
26-
from matplotlib.cbook import mplDeprecation, deprecated, ls_mapper
26+
from matplotlib.cbook import (
27+
MatplotlibDeprecationWarning, deprecated, ls_mapper)
2728
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
2829
from matplotlib.colors import is_color_like
2930

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

lib/matplotlib/ticker.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@
174174
from matplotlib import rcParams
175175
from matplotlib import cbook
176176
from matplotlib import transforms as mtransforms
177-
from matplotlib.cbook import mplDeprecation
178177

179178
import warnings
180179

0 commit comments

Comments
 (0)