MCPcopy Create free account
hub / github.com/ActiveState/code / Cycle

Class Cycle

recipes/Python/578138_gprof2dotpy/recipe-578138.py:236–252  ·  view source on GitHub ↗

A cycle made from recursive function calls.

Source from the content-addressed store, hash-verified

234
235
236class Cycle(Object):
237 """A cycle made from recursive function calls."""
238
239 def __init__(self):
240 Object.__init__(self)
241 # XXX: Do cycles need an id?
242 self.functions = set()
243
244 def add_function(self, function):
245 assert function not in self.functions
246 self.functions.add(function)
247 # XXX: Aggregate events?
248 if function.cycle is not None:
249 for other in function.cycle.functions:
250 if function not in self.functions:
251 self.add_function(other)
252 function.cycle = self
253
254
255class Profile(Object):

Callers 2

_tarjanMethod · 0.85
parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected