From 2dd6fae24f070bcd76cdabbbb89ab6e4d38f5954 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sun, 28 Oct 2018 19:58:24 +0100 Subject: [PATCH] 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 8990602577bd..b73d7f7f48f4 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -885,7 +885,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) @@ -907,8 +909,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):