Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_node(self, typ):
frame = inspect.currentframe().f_back.f_back
Source.lazycache(frame)
node = Source.executing(frame).node
assert isinstance(node, typ), (node, typ)
return node
def get_node(self, typ):
frame = inspect.currentframe().f_back.f_back
Source.lazycache(frame)
node = Source.executing(frame).node
assert isinstance(node, typ), (node, typ)
return node
def trace_func(frame, event, _arg):
filename = frame.f_code.co_filename
if event == "call":
if include_file(filename):
return trace_func
elif event == "line":
lineno = frame.f_lineno
queues[filename].append(lineno)
totals[filename][lineno] += 1
Source.lazycache(frame)