From 46f199504bdab960153629a5d0aad70e53e95440 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Mon, 29 Oct 2018 09:39:33 -0700 Subject: [PATCH] Backport PR #12658: Do not warn-depreacted when iterating over rcParams --- lib/matplotlib/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 2f2d442c02e0..308b56ec518c 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -906,7 +906,9 @@ def __str__(self): def __iter__(self): """Yield sorted list of keys.""" - yield from sorted(dict.__iter__(self)) + with warnings.catch_warnings(): + warnings.simplefilter('ignore', MatplotlibDeprecationWarning) + yield from sorted(dict.__iter__(self)) def __len__(self): return dict.__len__(self) @@ -928,8 +930,7 @@ def find_all(self, pattern): if pattern_re.search(key)) def copy(self): - return {k: dict.__getitem__(self, k) - for k in self} + return {k: dict.__getitem__(self, k) for k in self} def rc_params(fail_on_error=False):