8000 Suppress some more rc deprecation warnings. · matplotlib/matplotlib@a76eaba · GitHub
[go: up one dir, main page]

Skip to content

Commit a76eaba

Browse files
committed
Suppress some more rc deprecation warnings.
1 parent 8bd36fd commit a76eaba

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

lib/matplotlib/__init__.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,21 +1220,33 @@ def rcdefaults():
12201220
Use a specific style file. Call ``style.use('default')`` to restore
12211221
the default style.
12221222
"""
1223-
rcParams.clear()
1224-
rcParams.update(rcParamsDefault)
1223+
# Deprecation warnings were already handled when creating rcParamsDefault,
1224+
# no need to reemit them here.
1225+
with warnings.catch_warnings():
1226+
warnings.simplefilter("ignore", mplDeprecation)
1227+
rcParams.clear()
1228+
rcParams.update(rcParamsDefault)
12251229

12261230

12271231
def rc_file_defaults():
12281232
"""Restore the rc params from the original rc file loaded by Matplotlib.
12291233
"""
1230-
rcParams.update(rcParamsOrig)
1234+
# Deprecation warnings were already handled when creating rcParamsOrig, no
1235+
# need to reemit them here.
1236+
with warnings.catch_warnings():
1237+
warnings.simplefilter("ignore", mplDeprecation)
1238+
rcParams.update(rcParamsOrig)
12311239

12321240

12331241
def rc_file(fname):
12341242
"""
12351243
Update rc params from file.
12361244
"""
1237-
rcParams.update(rc_params_from_file(fname))
1245+
# Deprecation warnings were already handled in rc_params_from_file, no need
1246+
# to reemit them here.
1247+
with warnings.catch_warnings():
1248+
warnings.simplefilter("ignore", mplDeprecation)
1249+
rcParams.update(rc_params_from_file(fname))
12381250

12391251

12401252
class rc_context:

0 commit comments

Comments
 (0)
0