Skip to content

Commit 71fd4a7

Browse files
committed
Hide the deprecation warning from flake8 users
1 parent 9448e13 commit 71fd4a7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

importlib_metadata/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sys
66
import zipp
77
import email
8+
import inspect
89
import pathlib
910
import operator
1011
import warnings
@@ -191,8 +192,9 @@ def get(self, group, default=None):
191192
"""
192193
For backward compatibility, supply .get
193194
"""
195+
is_flake8 = any('flake8' in str(frame) for frame in inspect.stack())
194196
msg = "GroupedEntryPoints.get is deprecated. Just use __getitem__."
195-
warnings.warn(msg, DeprecationWarning)
197+
is_flake8 or warnings.warn(msg, DeprecationWarning)
196198
return self[group] or default
197199

198200

0 commit comments

Comments
 (0)