#NEWLINE# def __new__( meta , name , bases , dct ) : #NEWLINE# #INDENT# actions = dct . pop ( 'ACTIONS' , [ ] ) #NEWLINE# for ( on_action , actioned , disconnect ) in actions : #NEWLINE# #INDENT# def on_f( self , f , args = None , kw = None ) : #NEWLINE# #INDENT# args = ( args if ( args is not None ) else tuple ( ) ) #NEWLINE# kw = ( kw if ( kw is not None ) else dict ( ) ) #NEWLINE# cid = self . cid #NEWLINE# self . _callbacks [ on_action ] [ cid ] = ( f , args , kw ) #NEWLINE# self . cid += 1 #NEWLINE# return cid #NEWLINE# #UNINDENT# on_f . __doc__ = on_f_docstring . format ( actioned = actioned ) #NEWLINE# on_f . __name__ = on_action #NEWLINE# dct [ on_action ] = on_f #NEWLINE# def fed( self ) : #NEWLINE# #INDENT# for ( f , args , kw ) in self . _callbacks [ on_action ] . values ( ) : #NEWLINE# #INDENT# f ( * args , ** kw ) #NEWLINE# #UNINDENT# #UNINDENT# fed . __doc__ = fed_docstring . format ( on_action = on_action ) #NEWLINE# fed . __name__ = actioned #NEWLINE# dct [ actioned ] = fed #NEWLINE# def disf( self , cid ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# del self . _callbacks [ on_action ] [ cid ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# disf . __doc__ = disf_docstring . format ( on_action = on_action ) #NEWLINE# disf . __name__ = disconnect #NEWLINE# dct [ disconnect ] = disf #NEWLINE# #UNINDENT# return super ( ActionableMeta , meta ) . __new__ ( meta , name , bases , dct )