<s> __author__ = """<STR_LIT>""" <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from os import getcwd <EOL> from os import sys <EOL> sys . path . append ( getcwd ( ) ) <EOL> from MOAL . helpers . display import Section <EOL> from MOAL . data_structures . abstract . stack import Stack <EOL> class StackFrame : <EOL> def __init__ ( self , func , ** kwargs ) : <EOL> self . func = func <EOL> self . data = kwargs <EOL> class StackTrace ( Stack ) : <EOL> def __init__ ( self ) : <EOL> super ( StackTrace , self ) . __init__ ( ) <EOL> def call ( self , func , ** kwargs ) : <EOL> frame = StackFrame ( func , ** kwargs ) <EOL> print ( '<STR_LIT>' . format ( frame ) ) <EOL> self . push ( frame ) <EOL> def view ( self ) : <EOL> items = super ( StackTrace , self ) . view ( ) <EOL> for k , item in enumerate ( items ) : <EOL> print ( '<STR_LIT>' . format ( ( '<STR_LIT:->' * k ) + '<STR_LIT:+>' , item . func , item . data ) ) <EOL> def init ( ) : <EOL> def foo ( ) : <EOL> print ( '<STR_LIT>' ) <EOL> def foo2 ( ) : <EOL> print ( '<STR_LIT>' ) <EOL> def bar ( ) : <EOL> print ( '<STR_LIT>' ) <EOL> foo ( ) <EOL> def bim ( ) : <EOL> print ( '<STR_LIT>' ) <EOL> foo2 ( ) <EOL> tracer = StackTrace ( ) <EOL> for name , func in locals ( ) . iteritems ( ) : <EOL> if name is not '<STR_LIT>' : <EOL> func ( ) <EOL> tracer . call ( func , name = name ) <EOL> with Section ( '<STR_LIT>' ) : <EOL> tracer . view ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> with Section ( '<STR_LIT>' ) : <EOL> init ( ) </s>
