File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 55import sys
66import zipp
77import email
8- import inspect
98import pathlib
109import operator
1110import warnings
@@ -228,23 +227,33 @@ def select(self, **params):
228227 return self ._all .select (** params )
229228
230229
231- class DeprecatedDict (dict ): # pragma: nocover
230+ class DeprecatedDict (dict ):
232231 """
233232 Compatibility wrapper around dict to indicate that
234233 Mapping behavior is deprecated.
234+
235+ >>> recwarn = getfixture('recwarn')
236+ >>> dd = DeprecatedDict(foo='bar')
237+ >>> dd.get('baz', None)
238+ >>> dd['foo']
239+ 'bar'
240+ >>> len(recwarn)
241+ 1
235242 """
236243
237- def _warn (self ):
238- msg = "SelectableGroups dict interface is deprecated. Use select."
239- warnings .warn (msg , DeprecationWarning , stacklevel = 3 )
244+ _warn = functools .partial (
245+ warnings .warn ,
246+ "SelectableGroups dict interface is deprecated. Use select." ,
247+ DeprecationWarning ,
248+ stacklevel = 3 ,
249+ )
240250
241251 def __getitem__ (self , name ):
242252 self ._warn ()
243253 return super ().__getitem__ (name )
244254
245255 def get (self , name , default = None ):
246- is_flake8 = any ('flake8' in str (frame ) for frame in inspect .stack ())
247- is_flake8 or self ._warn ()
256+ self ._warn ()
248257 return super ().get (name , default )
249258
250259
You can’t perform that action at this time.
0 commit comments