#NEWLINE# def _profile( fn , * args , **kw ) : #NEWLINE# #INDENT# filename = ( '%s.prof' % fn . __name__ ) #NEWLINE# def load_stats( ) : #NEWLINE# #INDENT# st = pstats . Stats ( filename ) #NEWLINE# os . unlink ( filename ) #NEWLINE# return st #NEWLINE# #UNINDENT# began = time . time ( ) #NEWLINE# cProfile . runctx ( 'result = fn(*args, **kw)' , globals ( ) , locals ( ) , filename = filename ) #NEWLINE# ended = time . time ( ) #NEWLINE# return ( ( ended - began ) , load_stats , locals ( ) [ 'result' ] )