File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 55import sys
66import zipp
77import email
8+ import inspect
89import pathlib
910import operator
1011import warnings
1112import functools
1213import itertools
1314import posixpath
15+ import contextlib
1416import collections .abc
1517
1618from ._compat import (
@@ -227,6 +229,13 @@ def select(self, **params):
227229 return self ._all .select (** params )
228230
229231
232+ class Flake8Bypass (warnings .catch_warnings , contextlib .ContextDecorator ):
233+ def __enter__ (self ):
234+ super ().__enter__ ()
235+ is_flake8 = any ('flake8' in str (frame ) for frame in inspect .stack ())
236+ is_flake8 and warnings .simplefilter ('ignore' , DeprecationWarning )
237+
238+
230239class DeprecatedDict (dict ):
231240 """
232241 Compatibility wrapper around dict to indicate that
@@ -252,6 +261,7 @@ def __getitem__(self, name):
252261 self ._warn ()
253262 return super ().__getitem__ (name )
254263
264+ @Flake8Bypass ()
255265 def get (self , name , default = None ):
256266 self ._warn ()
257267 return super ().get (name , default )
You can’t perform that action at this time.
0 commit comments