Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
with this approach is YFuncStats has an internal list which complicates:
- delete() operation because list deletions are O(n)
- sort() and pop() operations currently work on sorted list and they hold the
list as sorted.
To preserve above behaviour and have a delete() method, we can use an OrderedDict()
maybe, but simply that is not worth the effort for an extra filter() call. Maybe
in the future.
"""
tag = filter.get('tag', tag)
ctx_id = filter.get('ctx_id', tag)
# multiple invocation pause/resume is allowed. This is needed because
# not only get() is executed here.
_yappi._pause()
try:
stats = YFuncStats().get(filter=filter, filter_callback=filter_callback)
finally:
_yappi._resume()
return stats