<s> """<STR_LIT>""" <EOL> from nuitka . Options import isShowMemory <EOL> from nuitka . Tracing import printIndented , printLine <EOL> counted_inits = { } <EOL> counted_dels = { } <EOL> def counted_init ( init ) : <EOL> if isShowMemory ( ) : <EOL> def wrapped_init ( self , * args , ** kw ) : <EOL> name = self . __class__ . __name__ <EOL> assert type ( name ) is str <EOL> if name not in counted_inits : <EOL> counted_inits [ name ] = <NUM_LIT:0> <EOL> counted_inits [ name ] += <NUM_LIT:1> <EOL> init ( self , * args , ** kw ) <EOL> return wrapped_init <EOL> else : <EOL> return init <EOL> empty_del = lambda x : <NUM_LIT:0> <EOL> def counted_del ( del_func = empty_del ) : <EOL> if isShowMemory ( ) : <EOL> def wrapped_del ( self ) : <EOL> if counted_dels is None : <EOL> return <EOL> name = self . __class__ . __name__ <EOL> assert type ( name ) is str <EOL> if name not in counted_dels : <EOL> counted_dels [ name ] = <NUM_LIT:0> <EOL> counted_dels [ name ] += <NUM_LIT:1> <EOL> if del_func is not empty_del : <EOL> del_func ( self ) <EOL> return wrapped_del <EOL> else : <EOL> return empty_del <EOL> def printStats ( ) : <EOL> printLine ( "<STR_LIT>" ) <EOL> for name , count in sorted ( counted_inits . items ( ) ) : <EOL> dels = counted_dels . get ( name , <NUM_LIT:0> ) <EOL> printIndented ( <NUM_LIT:1> , name , count , dels , count - dels ) </s>
