<s> from ib . lib . overloading import overloaded <EOL> from ib . opt . message import wrapperMethods <EOL> def messageMethod ( name , parameters ) : <EOL> """<STR_LIT>""" <EOL> def dispatchMethod ( self , * arguments ) : <EOL> self . dispatcher ( name , dict ( zip ( parameters , arguments ) ) ) <EOL> dispatchMethod . __name__ = name <EOL> return dispatchMethod <EOL> class ReceiverType ( type ) : <EOL> """<STR_LIT>""" <EOL> def __new__ ( cls , name , bases , namespace ) : <EOL> """<STR_LIT>""" <EOL> for methodName , methodArgs in wrapperMethods : <EOL> namespace [ methodName ] = messageMethod ( methodName , methodArgs ) <EOL> return type ( name , bases , namespace ) <EOL> class Receiver ( object ) : <EOL> """<STR_LIT>""" <EOL> __metaclass__ = ReceiverType <EOL> def __init__ ( self , dispatcher ) : <EOL> """<STR_LIT>""" <EOL> self . dispatcher = dispatcher <EOL> @ overloaded <EOL> def error ( self , e ) : <EOL> """<STR_LIT>""" <EOL> self . dispatcher ( '<STR_LIT:error>' , dict ( errorMsg = e ) ) <EOL> @ error . register ( object , str ) <EOL> def error_0 ( self , strval ) : <EOL> """<STR_LIT>""" <EOL> self . dispatcher ( '<STR_LIT:error>' , dict ( errorMsg = strval ) ) <EOL> @ error . register ( object , int , int , str ) <EOL> def error_1 ( self , id , errorCode , errorMsg ) : <EOL> """<STR_LIT>""" <EOL> params = dict ( id = id , errorCode = errorCode , errorMsg = errorMsg ) <EOL> self . dispatcher ( '<STR_LIT:error>' , params ) </s>
