Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf5dbacd

Browse files
committed
Remove mplDeprecation which is just an alias to MatplotlibDeprecationWarning
1 parent6ec80ea commitf5dbacd

File tree

10 files changed

+32
-25
lines changed

10 files changed

+32
-25
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: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
# definitions, so it is safe to import from it here.
141141
from .importcbook
142142
frommatplotlib.cbookimport (
143-
mplDeprecation,dedent,get_label,sanitize_sequence)
143+
MatplotlibDeprecationWarning,dedent,get_label,sanitize_sequence)
144144
frommatplotlib.rcsetupimportdefaultParams,validate_backend,cycler
145145

146146
importnumpy
@@ -851,24 +851,24 @@ def __setitem__(self, key, val):
851851
ifkeyin_deprecated_map:
852852
alt_key,alt_val,inverse_alt=_deprecated_map[key]
853853
warnings.warn(self.msg_depr% (key,alt_key),
854-
mplDeprecation)
854+
MatplotlibDeprecationWarning)
855855
key=alt_key
856856
val=alt_val(val)
857857
elifkeyin_deprecated_setandvalisnotNone:
858858
ifkey.startswith('backend'):
859859
warnings.warn(self.msg_backend_obsolete.format(key),
860-
mplDeprecation)
860+
MatplotlibDeprecationWarning)
861861
else:
862862
warnings.warn(self.msg_depr_set%key,
863-
mplDeprecation)
863+
MatplotlibDeprecationWarning)
864864
elifkeyin_deprecated_ignore_map:
865865
alt=_deprecated_ignore_map[key]
866866
warnings.warn(self.msg_depr_ignore% (key,alt),
867-
mplDeprecation)
867+
MatplotlibDeprecationWarning)
868868
return
869869
elifkeyin_obsolete_set:
870870
warnings.warn(self.msg_obsolete% (key, ),
871-
mplDeprecation)
871+
MatplotlibDeprecationWarning)
872872
return
873873
try:
874874
cval=self.validate[key](val)
@@ -885,18 +885,18 @@ def __getitem__(self, key):
885885
ifkeyin_deprecated_map:
886886
alt_key,alt_val,inverse_alt=_deprecated_map[key]
887887
warnings.warn(self.msg_depr% (key,alt_key),
888-
mplDeprecation)
888+
MatplotlibDeprecationWarning)
889889
key=alt_key
890890

891891
elifkeyin_deprecated_ignore_map:
892892
alt=_deprecated_ignore_map[key]
893893
warnings.warn(self.msg_depr_ignore% (key,alt),
894-
mplDeprecation)
894+
MatplotlibDeprecationWarning)
895895
key=alt
896896

897897
elifkeyin_obsolete_set:
898898
warnings.warn(self.msg_obsolete% (key, ),
899-
mplDeprecation)
899+
MatplotlibDeprecationWarning)
900900
returnNone
901901

902902
val=dict.__getitem__(self,key)
@@ -1045,7 +1045,7 @@ def _rc_params_in_file(fname, fail_on_error=False):
10451045
elifkeyin_deprecated_ignore_map:
10461046
warnings.warn('%s is deprecated. Update your matplotlibrc to use '
10471047
'%s instead.'% (key,_deprecated_ignore_map[key]),
1048-
mplDeprecation)
1048+
MatplotlibDeprecationWarning)
10491049

10501050
else:
10511051
print("""
@@ -1080,7 +1080,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
10801080

10811081
iter_params=defaultParams.items()
10821082
withwarnings.catch_warnings():
1083-
warnings.simplefilter("ignore",mplDeprecation)
1083+
warnings.simplefilter("ignore",MatplotlibDeprecationWarning)
10841084
config=RcParams([(key,default)forkey, (default,_)initer_params
10851085
ifkeynotin_all_deprecated])
10861086
config.update(config_from_file)
@@ -1121,7 +1121,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11211121
rcParamsOrig=rcParams.copy()
11221122

11231123
withwarnings.catch_warnings():
1124-
warnings.simplefilter("ignore",mplDeprecation)
1124+
warnings.simplefilter("ignore",MatplotlibDeprecationWarning)
11251125
rcParamsDefault=RcParams([(key,default)forkey, (default,converter)in
11261126
defaultParams.items()
11271127
ifkeynotin_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
importmatplotlib.transformsasmtransforms
3535
importmatplotlib.triasmtri
3636
frommatplotlib.cbookimport (
37-
mplDeprecation,warn_deprecated,STEP_LOOKUP_MAP,iterable,
37+
MatplotlibDeprecationWarning,warn_deprecated,STEP_LOOKUP_MAP,iterable,
3838
safe_first_element)
3939
frommatplotlib.containerimportBarContainer,ErrorbarContainer,StemContainer
4040
frommatplotlib.axes._baseimport_AxesBase,_process_plot_format

‎lib/matplotlib/axes/_base.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,8 @@ def set_adjustable(self, adjustable, share=False):
13251325
"""
13261326
ifadjustable=='box-forced':
13271327
warnings.warn("The 'box-forced' keyword argument is deprecated"
1328-
" since 2.2.",cbook.mplDeprecation,stacklevel=2)
1328+
" since 2.2.",cbook.MatplotlibDeprecationWarning,
1329+
stacklevel=2)
13291330
ifadjustablenotin ('box','datalim','box-forced'):
13301331
raiseValueError("argument must be 'box', or 'datalim'")
13311332
ifshare:

‎lib/matplotlib/axes/_subplots.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
frommatplotlibimportdocstring
55
importmatplotlib.artistasmartist
66
frommatplotlib.axes._axesimportAxes
7-
frommatplotlib.cbookimportmplDeprecation
87
frommatplotlib.gridspecimportGridSpec,SubplotSpec
98
importmatplotlib._layoutboxaslayoutbox
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
importnumpyasnp
3232

3333
importmatplotlib
34-
from .deprecationimportdeprecated,warn_deprecated
35-
from .deprecationimportmplDeprecation,MatplotlibDeprecationWarning
34+
from .deprecationimport(
35+
mplDeprecation,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
defdeprecated(since,message='',name='',alternative='',pending=False,
@@ -205,7 +206,7 @@ def finalize(wrapper, new_doc):
205206
removal=removal)
206207

207208
defwrapper(*args,**kwargs):
208-
warnings.warn(message,mplDeprecation,stacklevel=2)
209+
warnings.warn(message,MatplotlibDeprecationWarning,stacklevel=2)
209210
returnfunc(*args,**kwargs)
210211

211212
old_doc=textwrap.dedent(old_docor'').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
frommatplotlibimport_pylab_helpers,tight_layout,rcParams
2424
frommatplotlib.transformsimportBbox
2525
importmatplotlib._layoutboxaslayoutbox
26-
frommatplotlib.cbookimportmplDeprecation
26+
frommatplotlib.cbookimportMatplotlibDeprecationWarning
2727

2828
_log=logging.getLogger(__name__)
2929

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

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

‎lib/matplotlib/pyplot.py‎

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

21362136
ifplotfuncsisNone:
21372137
plotfuncs=dict()
2138-
frommatplotlib.cbookimportmplDeprecation
2138+
frommatplotlib.cbookimportMatplotlibDeprecationWarning
21392139
withwarnings.catch_warnings():
2140-
warnings.simplefilter('ignore',mplDeprecation)
2140+
warnings.simplefilter('ignore',MatplotlibDeprecationWarning)
21412141
r=mlab.csv2rec(fname,comments=comments,skiprows=skiprows,
21422142
checkrows=checkrows,delimiter=delimiter,names=names)
21432143

‎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
importwarnings
22

33
frommatplotlib.testing.decoratorsimportimage_comparison
4-
frommatplotlib.cbookimportMatplotlibDeprecationWarning
54
importmatplotlib.pyplotasplt
65
importnumpyasnp
76
importpytest

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp