2 # Autogenerated by Thrift Compiler (0.9.3)
4 # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
9 from thrift.Thrift import TType, TMessageType, TException, TApplicationException
12 from thrift.Thrift import TProcessor
13 from thrift.transport import TTransport
14 from thrift.protocol import TBinaryProtocol, TProtocol
16 from thrift.protocol import fastbinary
31 def __init__(self, iprot, oprot=None):
32 self._iprot = self._oprot = iprot
43 return self.recv_d_CLI()
45 def send_d_CLI(self, msg):
46 self._oprot.writeMessageBegin('d_CLI', TMessageType.CALL, self._seqid)
49 args.write(self._oprot)
50 self._oprot.writeMessageEnd()
51 self._oprot.trans.flush()
55 (fname, mtype, rseqid) = iprot.readMessageBegin()
56 if mtype == TMessageType.EXCEPTION:
57 x = TApplicationException()
59 iprot.readMessageEnd()
61 result = d_CLI_result()
63 iprot.readMessageEnd()
64 if result.success is not None:
66 raise TApplicationException(TApplicationException.MISSING_RESULT, "d_CLI failed: unknown result")
69 class Processor(Iface, TProcessor):
70 def __init__(self, handler):
71 self._handler = handler
73 self._processMap["d_CLI"] = Processor.process_d_CLI
75 def process(self, iprot, oprot):
76 (name, type, seqid) = iprot.readMessageBegin()
77 if name not in self._processMap:
78 iprot.skip(TType.STRUCT)
79 iprot.readMessageEnd()
80 x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
81 oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
83 oprot.writeMessageEnd()
87 self._processMap[name](self, seqid, iprot, oprot)
90 def process_d_CLI(self, seqid, iprot, oprot):
93 iprot.readMessageEnd()
94 result = d_CLI_result()
96 result.success = self._handler.d_CLI(args.msg)
97 msg_type = TMessageType.REPLY
98 except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
100 except Exception as ex:
101 msg_type = TMessageType.EXCEPTION
102 logging.exception(ex)
103 result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
104 oprot.writeMessageBegin("d_CLI", msg_type, seqid)
106 oprot.writeMessageEnd()
110 # HELPER FUNCTIONS AND STRUCTURES
120 (1, TType.STRUCT, 'msg', (CLIMessage, CLIMessage.thrift_spec), None, ), # 1
123 def __init__(self, msg=None,):
126 def read(self, iprot):
127 if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
128 fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
130 iprot.readStructBegin()
132 (fname, ftype, fid) = iprot.readFieldBegin()
133 if ftype == TType.STOP:
136 if ftype == TType.STRUCT:
137 self.msg = CLIMessage()
144 iprot.readStructEnd()
146 def write(self, oprot):
147 if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
148 oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
150 oprot.writeStructBegin('d_CLI_args')
151 if self.msg is not None:
152 oprot.writeFieldBegin('msg', TType.STRUCT, 1)
153 self.msg.write(oprot)
154 oprot.writeFieldEnd()
155 oprot.writeFieldStop()
156 oprot.writeStructEnd()
164 value = (value * 31) ^ hash(self.msg)
168 L = ['%s=%r' % (key, value)
169 for key, value in self.__dict__.iteritems()]
170 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
172 def __eq__(self, other):
173 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
175 def __ne__(self, other):
176 return not (self == other)
185 (0, TType.STRUCT, 'success', (CLIResponse, CLIResponse.thrift_spec), None, ), # 0
188 def __init__(self, success=None,):
189 self.success = success
191 def read(self, iprot):
192 if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
193 fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
195 iprot.readStructBegin()
197 (fname, ftype, fid) = iprot.readFieldBegin()
198 if ftype == TType.STOP:
201 if ftype == TType.STRUCT:
202 self.success = CLIResponse()
203 self.success.read(iprot)
209 iprot.readStructEnd()
211 def write(self, oprot):
212 if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
213 oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
215 oprot.writeStructBegin('d_CLI_result')
216 if self.success is not None:
217 oprot.writeFieldBegin('success', TType.STRUCT, 0)
218 self.success.write(oprot)
219 oprot.writeFieldEnd()
220 oprot.writeFieldStop()
221 oprot.writeStructEnd()
229 value = (value * 31) ^ hash(self.success)
233 L = ['%s=%r' % (key, value)
234 for key, value in self.__dict__.iteritems()]
235 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
237 def __eq__(self, other):
238 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
240 def __ne__(self, other):
241 return not (self == other)