Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, *args, **kwargs):
super(EventFrame, self).__init__(*args, **kwargs)
self.time = 0
def frame_for_stack(stack):
if len(stack) == 0:
return self._root_frame
parent = frame_for_stack(stack[:-1])
frame_name = stack[-1]
if not frame_name in parent.children:
parent.children[frame_name] = EventFrame(frame_name, parent)
return parent.children[frame_name]
def root_frame(self):
"""
Returns the parsed results in the form of a tree of Frame objects
"""
if not hasattr(self, '_root_frame'):
self._root_frame = EventFrame()
# define a recursive function that builds the heirarchy of frames given the
# stack of frame identifiers
def frame_for_stack(stack):
if len(stack) == 0:
return self._root_frame
parent = frame_for_stack(stack[:-1])
frame_name = stack[-1]
if not frame_name in parent.children:
parent.children[frame_name] = EventFrame(frame_name, parent)
return parent.children[frame_name]
for stack_frame in self.stack_time.iteritems():