# # Autogenerated by Thrift # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @generated # from __future__ import absolute_import import sys from thrift.util.Recursive import fix_spec from thrift.Thrift import TType, TMessageType, TPriority, TRequestContext, TProcessorEventHandler, TServerInterface, TProcessor, TException, TApplicationException, UnimplementedTypedef from thrift.protocol.TProtocol import TProtocolException from .ttypes import UTF8STRINGS, Fiery, Serious, ComplexFieldNames, CustomFieldNames, ExceptionWithPrimitiveField, ExceptionWithStructuredAnnotation, Banal from thrift.Thrift import TProcessor import pprint import warnings from thrift import Thrift from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from thrift.protocol import TCompactProtocol from thrift.protocol import THeaderProtocol fastproto = None try: from thrift.protocol import fastproto except ImportError: pass def __EXPAND_THRIFT_SPEC(spec): next_id = 0 for item in spec: if next_id >= 0 and item[0] < 0: next_id = item[0] if item[0] != next_id: for _ in range(next_id, item[0]): yield None yield item next_id = item[0] + 1 class ThriftEnumWrapper(int): def __new__(cls, enum_class, value): return super().__new__(cls, value) def __init__(self, enum_class, value): self.enum_class = enum_class def __repr__(self): return self.enum_class.__name__ + '.' + self.enum_class._VALUES_TO_NAMES[self] all_structs = [] UTF8STRINGS = bool(0) or sys.version_info.major >= 3 from thrift.util.Decorators import ( future_process_main, future_process_method, process_main as thrift_process_main, process_method as thrift_process_method, should_run_on_thread, write_results_after_future, ) class Iface: def doBland(self, ): pass def doRaise(self, ): pass def get200(self, ): pass def get500(self, ): pass class ContextIface: def doBland(self, handler_ctx, ): pass def doRaise(self, handler_ctx, ): pass def get200(self, handler_ctx, ): pass def get500(self, handler_ctx, ): pass # HELPER FUNCTIONS AND STRUCTURES class doBland_args: thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('doBland_args') oprot.writeFieldStop() oprot.writeStructEnd() def __repr__(self): L = [] padding = ' ' * 4 return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( ) __hash__ = object.__hash__ all_structs.append(doBland_args) doBland_args.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( ))) doBland_args.thrift_struct_annotations = { } doBland_args.thrift_field_annotations = { } class doBland_result: thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('doBland_result') oprot.writeFieldStop() oprot.writeStructEnd() def __repr__(self): L = [] padding = ' ' * 4 return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( ) __hash__ = object.__hash__ all_structs.append(doBland_result) doBland_result.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( ))) doBland_result.thrift_struct_annotations = { } doBland_result.thrift_field_annotations = { } class doRaise_args: thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('doRaise_args') oprot.writeFieldStop() oprot.writeStructEnd() def __repr__(self): L = [] padding = ' ' * 4 return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( ) __hash__ = object.__hash__ all_structs.append(doRaise_args) doRaise_args.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( ))) doRaise_args.thrift_struct_annotations = { } doRaise_args.thrift_field_annotations = { } class doRaise_result: r""" Attributes: - b - f - s """ thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None __init__ = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break if fid == 1: if ftype == TType.STRUCT: self.b = Banal() self.b.read(iprot) else: iprot.skip(ftype) elif fid == 2: if ftype == TType.STRUCT: self.f = Fiery() self.f.read(iprot) else: iprot.skip(ftype) elif fid == 3: if ftype == TType.STRUCT: self.s = Serious() self.s.read(iprot) else: iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('doRaise_result') if self.b != None: oprot.writeFieldBegin('b', TType.STRUCT, 1) self.b.write(oprot) oprot.writeFieldEnd() if self.f != None: oprot.writeFieldBegin('f', TType.STRUCT, 2) self.f.write(oprot) oprot.writeFieldEnd() if self.s != None: oprot.writeFieldBegin('s', TType.STRUCT, 3) self.s.write(oprot) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def __repr__(self): L = [] padding = ' ' * 4 if self.b is not None: value = pprint.pformat(self.b, indent=0) value = padding.join(value.splitlines(True)) L.append(' b=%s' % (value)) if self.f is not None: value = pprint.pformat(self.f, indent=0) value = padding.join(value.splitlines(True)) L.append(' f=%s' % (value)) if self.s is not None: value = pprint.pformat(self.s, indent=0) value = padding.join(value.splitlines(True)) L.append(' s=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( 'b', 'f', 's', ) __hash__ = object.__hash__ all_structs.append(doRaise_result) doRaise_result.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( (1, TType.STRUCT, 'b', [Banal, Banal.thrift_spec, False], None, 2, ), # 1 (2, TType.STRUCT, 'f', [Fiery, Fiery.thrift_spec, False], None, 2, ), # 2 (3, TType.STRUCT, 's', [Serious, Serious.thrift_spec, False], None, 2, ), # 3 ))) doRaise_result.thrift_struct_annotations = { } doRaise_result.thrift_field_annotations = { } def doRaise_result__init__(self, b=None, f=None, s=None,): self.b = b self.f = f self.s = s doRaise_result.__init__ = doRaise_result__init__ def doRaise_result__setstate__(self, state): state.setdefault('b', None) state.setdefault('f', None) state.setdefault('s', None) self.__dict__ = state doRaise_result.__getstate__ = lambda self: self.__dict__.copy() doRaise_result.__setstate__ = doRaise_result__setstate__ class get200_args: thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('get200_args') oprot.writeFieldStop() oprot.writeStructEnd() def __repr__(self): L = [] padding = ' ' * 4 return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( ) __hash__ = object.__hash__ all_structs.append(get200_args) get200_args.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( ))) get200_args.thrift_struct_annotations = { } get200_args.thrift_field_annotations = { } class get200_result: r""" Attributes: - success """ thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None __init__ = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break if fid == 0: if ftype == TType.STRING: self.success = iprot.readString().decode('utf-8') if UTF8STRINGS else iprot.readString() else: iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('get200_result') if self.success != None: oprot.writeFieldBegin('success', TType.STRING, 0) oprot.writeString(self.success.encode('utf-8')) if UTF8STRINGS and not isinstance(self.success, bytes) else oprot.writeString(self.success) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def __repr__(self): L = [] padding = ' ' * 4 if self.success is not None: value = pprint.pformat(self.success, indent=0) value = padding.join(value.splitlines(True)) L.append(' success=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( 'success', ) __hash__ = object.__hash__ all_structs.append(get200_result) get200_result.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( (0, TType.STRING, 'success', True, None, 2, ), # 0 ))) get200_result.thrift_struct_annotations = { } get200_result.thrift_field_annotations = { } def get200_result__init__(self, success=None,): self.success = success get200_result.__init__ = get200_result__init__ def get200_result__setstate__(self, state): state.setdefault('success', None) self.__dict__ = state get200_result.__getstate__ = lambda self: self.__dict__.copy() get200_result.__setstate__ = get200_result__setstate__ class get500_args: thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('get500_args') oprot.writeFieldStop() oprot.writeStructEnd() def __repr__(self): L = [] padding = ' ' * 4 return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( ) __hash__ = object.__hash__ all_structs.append(get500_args) get500_args.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( ))) get500_args.thrift_struct_annotations = { } get500_args.thrift_field_annotations = { } class get500_result: r""" Attributes: - success - f - b - s """ thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None __init__ = None @staticmethod def isUnion(): return False def read(self, iprot): if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) return if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break if fid == 0: if ftype == TType.STRING: self.success = iprot.readString().decode('utf-8') if UTF8STRINGS else iprot.readString() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: self.f = Fiery() self.f.read(iprot) else: iprot.skip(ftype) elif fid == 2: if ftype == TType.STRUCT: self.b = Banal() self.b.read(iprot) else: iprot.skip(ftype) elif fid == 3: if ftype == TType.STRUCT: self.s = Serious() self.s.read(iprot) else: iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() def write(self, oprot): if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) return if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return oprot.writeStructBegin('get500_result') if self.success != None: oprot.writeFieldBegin('success', TType.STRING, 0) oprot.writeString(self.success.encode('utf-8')) if UTF8STRINGS and not isinstance(self.success, bytes) else oprot.writeString(self.success) oprot.writeFieldEnd() if self.f != None: oprot.writeFieldBegin('f', TType.STRUCT, 1) self.f.write(oprot) oprot.writeFieldEnd() if self.b != None: oprot.writeFieldBegin('b', TType.STRUCT, 2) self.b.write(oprot) oprot.writeFieldEnd() if self.s != None: oprot.writeFieldBegin('s', TType.STRUCT, 3) self.s.write(oprot) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def __repr__(self): L = [] padding = ' ' * 4 if self.success is not None: value = pprint.pformat(self.success, indent=0) value = padding.join(value.splitlines(True)) L.append(' success=%s' % (value)) if self.f is not None: value = pprint.pformat(self.f, indent=0) value = padding.join(value.splitlines(True)) L.append(' f=%s' % (value)) if self.b is not None: value = pprint.pformat(self.b, indent=0) value = padding.join(value.splitlines(True)) L.append(' b=%s' % (value)) if self.s is not None: value = pprint.pformat(self.s, indent=0) value = padding.join(value.splitlines(True)) L.append(' s=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ def __ne__(self, other): return not (self == other) def __dir__(self): return ( 'success', 'f', 'b', 's', ) __hash__ = object.__hash__ all_structs.append(get500_result) get500_result.thrift_spec = tuple(__EXPAND_THRIFT_SPEC(( (0, TType.STRING, 'success', True, None, 2, ), # 0 (1, TType.STRUCT, 'f', [Fiery, Fiery.thrift_spec, False], None, 2, ), # 1 (2, TType.STRUCT, 'b', [Banal, Banal.thrift_spec, False], None, 2, ), # 2 (3, TType.STRUCT, 's', [Serious, Serious.thrift_spec, False], None, 2, ), # 3 ))) get500_result.thrift_struct_annotations = { } get500_result.thrift_field_annotations = { } def get500_result__init__(self, success=None, f=None, b=None, s=None,): self.success = success self.f = f self.b = b self.s = s get500_result.__init__ = get500_result__init__ def get500_result__setstate__(self, state): state.setdefault('success', None) state.setdefault('f', None) state.setdefault('b', None) state.setdefault('s', None) self.__dict__ = state get500_result.__getstate__ = lambda self: self.__dict__.copy() get500_result.__setstate__ = get500_result__setstate__ class Client(Iface): _fbthrift_force_cpp_transport = False def __enter__(self): if self._fbthrift_cpp_transport: self._fbthrift_cpp_transport.__enter__() return self def __exit__(self, type, value, tb): if self._fbthrift_cpp_transport: self._fbthrift_cpp_transport.__exit__(type, value, tb) if self._iprot: self._iprot.trans.close() if self._oprot and self._iprot is not self._oprot: self._oprot.trans.close() def __init__(self, iprot=None, oprot=None, cpp_transport=None): self._iprot = self._oprot = iprot if oprot != None: self._oprot = oprot self._seqid = 0 self._fbthrift_cpp_transport = cpp_transport def set_persistent_header(self, key, value): if self._fbthrift_cpp_transport: self._fbthrift_cpp_transport.set_persistent_header(key, value) else: try: self._oprot.trans.set_persistent_header(key, value) except AttributeError: pass def get_persistent_headers(self): if self._fbthrift_cpp_transport: return self._fbthrift_cpp_transport.get_persistent_headers() try: return self._oprot.trans.get_write_persistent_headers() except AttributeError: return {} def clear_persistent_headers(self): if self._fbthrift_cpp_transport: self._fbthrift_cpp_transport.clear_persistent_headers() else: try: self._oprot.trans.clear_persistent_headers() except AttributeError: pass def set_onetime_header(self, key, value): if self._fbthrift_cpp_transport: self._fbthrift_cpp_transport.set_onetime_header(key, value) else: try: self._oprot.trans.set_header(key, value) except AttributeError: pass def get_last_response_headers(self): if self._fbthrift_cpp_transport: return self._fbthrift_cpp_transport.get_last_response_headers() try: return self._iprot.trans.get_headers() except AttributeError: return {} def set_max_frame_size(self, size): if self._fbthrift_cpp_transport: pass else: try: self._oprot.trans.set_max_frame_size(size) except AttributeError: pass def doBland(self, ): if (self._fbthrift_cpp_transport): args = doBland_args() result = self._fbthrift_cpp_transport._send_request("Raiser", "doBland", args, doBland_result) return None self.send_doBland() self.recv_doBland() def send_doBland(self, ): self._oprot.writeMessageBegin('doBland', TMessageType.CALL, self._seqid) args = doBland_args() args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() def recv_doBland(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x result = doBland_result() result.read(self._iprot) self._iprot.readMessageEnd() return def doRaise(self, ): if (self._fbthrift_cpp_transport): args = doRaise_args() result = self._fbthrift_cpp_transport._send_request("Raiser", "doRaise", args, doRaise_result) if result.b is not None: raise result.b if result.f is not None: raise result.f if result.s is not None: raise result.s return None self.send_doRaise() self.recv_doRaise() def send_doRaise(self, ): self._oprot.writeMessageBegin('doRaise', TMessageType.CALL, self._seqid) args = doRaise_args() args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() def recv_doRaise(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x result = doRaise_result() result.read(self._iprot) self._iprot.readMessageEnd() if result.b != None: raise result.b if result.f != None: raise result.f if result.s != None: raise result.s return def get200(self, ): if (self._fbthrift_cpp_transport): args = get200_args() result = self._fbthrift_cpp_transport._send_request("Raiser", "get200", args, get200_result) if result.success is not None: return result.success raise TApplicationException(TApplicationException.MISSING_RESULT) self.send_get200() return self.recv_get200() def send_get200(self, ): self._oprot.writeMessageBegin('get200', TMessageType.CALL, self._seqid) args = get200_args() args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() def recv_get200(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x result = get200_result() result.read(self._iprot) self._iprot.readMessageEnd() if result.success != None: return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "get200 failed: unknown result"); def get500(self, ): if (self._fbthrift_cpp_transport): args = get500_args() result = self._fbthrift_cpp_transport._send_request("Raiser", "get500", args, get500_result) if result.success is not None: return result.success if result.f is not None: raise result.f if result.b is not None: raise result.b if result.s is not None: raise result.s raise TApplicationException(TApplicationException.MISSING_RESULT) self.send_get500() return self.recv_get500() def send_get500(self, ): self._oprot.writeMessageBegin('get500', TMessageType.CALL, self._seqid) args = get500_args() args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() def recv_get500(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x result = get500_result() result.read(self._iprot) self._iprot.readMessageEnd() if result.success != None: return result.success if result.f != None: raise result.f if result.b != None: raise result.b if result.s != None: raise result.s raise TApplicationException(TApplicationException.MISSING_RESULT, "get500 failed: unknown result"); class Processor(Iface, TProcessor): _onewayMethods = () def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["doBland"] = Processor.process_doBland self._priorityMap["doBland"] = TPriority.NORMAL self._processMap["doRaise"] = Processor.process_doRaise self._priorityMap["doRaise"] = TPriority.NORMAL self._processMap["get200"] = Processor.process_get200 self._priorityMap["get200"] = TPriority.NORMAL self._processMap["get500"] = Processor.process_get500 self._priorityMap["get500"] = TPriority.NORMAL def onewayMethods(self): l = [] l.extend(Processor._onewayMethods) return tuple(l) @thrift_process_main() def process(self,): pass @thrift_process_method(doBland_args, oneway=False) def process_doBland(self, args, handler_ctx): result = doBland_result() try: self._handler.doBland() except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'doBland', ex) result = Thrift.TApplicationException(message=repr(ex)) return result @thrift_process_method(doRaise_args, oneway=False) def process_doRaise(self, args, handler_ctx): result = doRaise_result() try: self._handler.doRaise() except Banal as exc0: self._event_handler.handlerException(handler_ctx, 'doRaise', exc0) result.b = exc0 except Fiery as exc1: self._event_handler.handlerException(handler_ctx, 'doRaise', exc1) result.f = exc1 except Serious as exc2: self._event_handler.handlerException(handler_ctx, 'doRaise', exc2) result.s = exc2 except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'doRaise', ex) result = Thrift.TApplicationException(message=repr(ex)) return result @thrift_process_method(get200_args, oneway=False) def process_get200(self, args, handler_ctx): result = get200_result() try: result.success = self._handler.get200() except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'get200', ex) result = Thrift.TApplicationException(message=repr(ex)) return result @thrift_process_method(get500_args, oneway=False) def process_get500(self, args, handler_ctx): result = get500_result() try: result.success = self._handler.get500() except Fiery as exc0: self._event_handler.handlerException(handler_ctx, 'get500', exc0) result.f = exc0 except Banal as exc1: self._event_handler.handlerException(handler_ctx, 'get500', exc1) result.b = exc1 except Serious as exc2: self._event_handler.handlerException(handler_ctx, 'get500', exc2) result.s = exc2 except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'get500', ex) result = Thrift.TApplicationException(message=repr(ex)) return result Iface._processor_type = Processor class ContextProcessor(ContextIface, TProcessor): _onewayMethods = () def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["doBland"] = ContextProcessor.process_doBland self._priorityMap["doBland"] = TPriority.NORMAL self._processMap["doRaise"] = ContextProcessor.process_doRaise self._priorityMap["doRaise"] = TPriority.NORMAL self._processMap["get200"] = ContextProcessor.process_get200 self._priorityMap["get200"] = TPriority.NORMAL self._processMap["get500"] = ContextProcessor.process_get500 self._priorityMap["get500"] = TPriority.NORMAL def onewayMethods(self): l = [] l.extend(ContextProcessor._onewayMethods) return tuple(l) @thrift_process_main() def process(self,): pass @thrift_process_method(doBland_args, oneway=False) def process_doBland(self, args, handler_ctx): result = doBland_result() try: self._handler.doBland(handler_ctx) except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'doBland', ex) result = Thrift.TApplicationException(message=repr(ex)) return result @thrift_process_method(doRaise_args, oneway=False) def process_doRaise(self, args, handler_ctx): result = doRaise_result() try: self._handler.doRaise(handler_ctx) except Banal as exc0: self._event_handler.handlerException(handler_ctx, 'doRaise', exc0) result.b = exc0 except Fiery as exc1: self._event_handler.handlerException(handler_ctx, 'doRaise', exc1) result.f = exc1 except Serious as exc2: self._event_handler.handlerException(handler_ctx, 'doRaise', exc2) result.s = exc2 except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'doRaise', ex) result = Thrift.TApplicationException(message=repr(ex)) return result @thrift_process_method(get200_args, oneway=False) def process_get200(self, args, handler_ctx): result = get200_result() try: result.success = self._handler.get200(handler_ctx) except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'get200', ex) result = Thrift.TApplicationException(message=repr(ex)) return result @thrift_process_method(get500_args, oneway=False) def process_get500(self, args, handler_ctx): result = get500_result() try: result.success = self._handler.get500(handler_ctx) except Fiery as exc0: self._event_handler.handlerException(handler_ctx, 'get500', exc0) result.f = exc0 except Banal as exc1: self._event_handler.handlerException(handler_ctx, 'get500', exc1) result.b = exc1 except Serious as exc2: self._event_handler.handlerException(handler_ctx, 'get500', exc2) result.s = exc2 except: ex = sys.exc_info()[1] self._event_handler.handlerError(handler_ctx, 'get500', ex) result = Thrift.TApplicationException(message=repr(ex)) return result ContextIface._processor_type = ContextProcessor fix_spec(all_structs) del all_structs