#NEWLINE# def patch_class_one( self , clazz , function , name ) : #NEWLINE# #INDENT# ' return replacement class with one function wrapped ' #NEWLINE# if hasattr ( clazz , '_monkey_timer_patched' ) : #NEWLINE# #INDENT# raise Exception ( 'can only patch once with patch_class' ) #NEWLINE# #UNINDENT# timer = self #NEWLINE# class _ProxyClass ( clazz ) : #NEWLINE# #INDENT# def __init__( self , * a , **b ) : #NEWLINE# #INDENT# orig = clazz . __dict__ [ function . __name__ ] #NEWLINE# self . __dict__ [ function . __name__ ] = MethodType ( timer . patch_function ( orig , name ) , self , _ProxyClass ) #NEWLINE# clazz . __init__ ( self , * a , ** b ) #NEWLINE# #UNINDENT# #UNINDENT# _ProxyClass . _monkey_timer_patched = True #NEWLINE# return _ProxyClass