#NEWLINE# def __init__( self , **property_values ) : #NEWLINE# #INDENT# self . _he_handlers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . _he_props_being_set = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# ( handlers , emitters , properties ) = ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# for name in dir ( self . __class__ ) : #NEWLINE# #INDENT# if name . startswith ( '__' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# val = getattr ( self . __class__ , name ) #NEWLINE# if isinstance ( val , BaseEmitter ) : #NEWLINE# #INDENT# setattr ( self , ( ( '_' + name ) + '_func' ) , val . _func ) #NEWLINE# if isinstance ( val , Property ) : #NEWLINE# #INDENT# properties [ name ] = val #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# emitters [ name ] = val #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( val , HandlerDescriptor ) : #NEWLINE# #INDENT# handlers [ name ] = val #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( name . startswith ( 'on_' ) and callable ( val ) ) : #NEWLINE# #INDENT# self . _he_handlers . setdefault ( val [ 3 : ] , [ ] ) #NEWLINE# Handler ( val , [ name [ 3 : ] ] , self ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . __handlers__ = [ name for name in sorted ( handlers . keys ( ) ) ] #NEWLINE# self . __emitters__ = [ name for name in sorted ( emitters . keys ( ) ) ] #NEWLINE# self . __properties__ = [ name for name in sorted ( properties . keys ( ) ) ] #NEWLINE# for name in self . __handlers__ : #NEWLINE# #INDENT# getattr ( self , name ) #NEWLINE# #UNINDENT# for name in self . __emitters__ : #NEWLINE# #INDENT# self . _he_handlers . setdefault ( name , [ ] ) #NEWLINE# #UNINDENT# for name in self . __properties__ : #NEWLINE# #INDENT# self . _he_handlers . setdefault ( name , [ ] ) #NEWLINE# self . _init_prop ( name ) #NEWLINE# #UNINDENT# for ( name , value ) in property_values . items ( ) : #NEWLINE# #INDENT# if ( name in self . __properties__ ) : #NEWLINE# #INDENT# setattr ( self , name , value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cname = self . __class__ . __name__ #NEWLINE# raise AttributeError ( ( '%s does not have a property %r' % ( cname , name ) ) )