<s> class RemoteMethod ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , names , request_encoder , transport , response_decoder ) : <EOL> self . names = names <EOL> self . request_encoder = request_encoder <EOL> self . transport = transport <EOL> self . response_decoder = response_decoder <EOL> def __call__ ( self , * args , ** kwargs ) : <EOL> method = '<STR_LIT:.>' . join ( self . names ) <EOL> request = self . request_encoder ( method , * args , ** kwargs ) <EOL> raw_response = self . transport ( request ) <EOL> return self . response_decoder ( raw_response ) <EOL> def __getattr__ ( self , name ) : <EOL> return RemoteMethod ( <EOL> self . names + [ name ] , <EOL> self . request_encoder , <EOL> self . transport , <EOL> self . response_decoder <EOL> ) <EOL> class FailedRequest ( Exception ) : <EOL> def __init__ ( self , error ) : <EOL> self . error = error <EOL> def __str__ ( self ) : <EOL> return repr ( self . error ) <EOL> class Client ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , request_encoder , transport , response_decoder ) : <EOL> self . request_encoder = request_encoder <EOL> self . transport = transport <EOL> self . response_decoder = response_decoder <EOL> def __getattr__ ( self , name ) : <EOL> return RemoteMethod ( <EOL> [ name ] , <EOL> self . request_encoder , <EOL> self . transport , <EOL> self . response_decoder <EOL> ) </s>
