From: David Reiss Date: Thu, 30 Aug 2007 03:30:22 +0000 (+0000) Subject: Thrift: Pre-generate reflection_limited for Python. X-Git-Tag: 0.2.0~1237 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=792df0bf78d061ede0af7f12bf92c72254ed12d8;p=common%2Fthrift.git Thrift: Pre-generate reflection_limited for Python. Summary: - Give reflection_limited a nice clean Python module. - if/regen.sh now generates reflection_limited for Python and copies it to src. - Added the generated Python for reflection_limited to version control. - lib/py/setup.py installs reflection_limited. - lib/py/cleanup.sh now removes build (make sure to run as root). - The C++ version of reflection_limited was also updated by regen.sh. Reviewed By: mcslee Test Plan: - Clean build and install. - Look at the installed Python files. - python -c 'from thrift.reflection.limited.ttypes import *' Revert Plan: ok git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665235 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/if/reflection_limited.thrift b/if/reflection_limited.thrift index 77698174..e96416fe 100644 --- a/if/reflection_limited.thrift +++ b/if/reflection_limited.thrift @@ -15,6 +15,7 @@ cpp_namespace facebook.thrift.reflection.limited java_package com.facebook.thrift.reflection.limited +py_module thrift.reflection.limited enum TTypeTag { T_VOID = 1, diff --git a/if/regen.sh b/if/regen.sh index 03dad02a..ed25cc6a 100755 --- a/if/regen.sh +++ b/if/regen.sh @@ -1,5 +1,6 @@ #!/bin/sh cd "`dirname $0`" -../compiler/cpp/thrift -cpp reflection_limited.thrift +../compiler/cpp/thrift -cpp -py reflection_limited.thrift cp gen-cpp/reflection_limited_types.h ../lib/cpp/src/ cp gen-cpp/reflection_limited_types.cpp ../lib/cpp/src/ +cp -r gen-py/thrift/reflection ../lib/py/src diff --git a/lib/cpp/src/reflection_limited_types.cpp b/lib/cpp/src/reflection_limited_types.cpp index d5c61530..c47d982b 100644 --- a/lib/cpp/src/reflection_limited_types.cpp +++ b/lib/cpp/src/reflection_limited_types.cpp @@ -7,6 +7,9 @@ namespace facebook { namespace thrift { namespace reflection { namespace limited { +char* SimpleType::ascii_fingerprint = "19B5240589E680301A7E32DF3971EFBE"; +char SimpleType::binary_fingerprint[16] = {0x19,0xB5,0x24,0x05,0x89,0xE6,0x80,0x30,0x1A,0x7E,0x32,0xDF,0x39,0x71,0xEF,0xBE}; + uint32_t SimpleType::read(facebook::thrift::protocol::TProtocol* iprot) { uint32_t xfer = 0; @@ -71,6 +74,9 @@ uint32_t SimpleType::write(facebook::thrift::protocol::TProtocol* oprot) const { return xfer; } +char* ContainerType::ascii_fingerprint = "654FA6EFFF8242F4C2A604B970686634"; +char ContainerType::binary_fingerprint[16] = {0x65,0x4F,0xA6,0xEF,0xFF,0x82,0x42,0xF4,0xC2,0xA6,0x04,0xB9,0x70,0x68,0x66,0x34}; + uint32_t ContainerType::read(facebook::thrift::protocol::TProtocol* iprot) { uint32_t xfer = 0; @@ -148,6 +154,9 @@ uint32_t ContainerType::write(facebook::thrift::protocol::TProtocol* oprot) cons return xfer; } +char* ThriftType::ascii_fingerprint = "76BC1CC759001D7D85FEE75C4F183062"; +char ThriftType::binary_fingerprint[16] = {0x76,0xBC,0x1C,0xC7,0x59,0x00,0x1D,0x7D,0x85,0xFE,0xE7,0x5C,0x4F,0x18,0x30,0x62}; + uint32_t ThriftType::read(facebook::thrift::protocol::TProtocol* iprot) { uint32_t xfer = 0; @@ -225,6 +234,9 @@ uint32_t ThriftType::write(facebook::thrift::protocol::TProtocol* oprot) const { return xfer; } +char* Argument::ascii_fingerprint = "8C45506BE0EFBB22FB19FA40DDCECB3F"; +char Argument::binary_fingerprint[16] = {0x8C,0x45,0x50,0x6B,0xE0,0xEF,0xBB,0x22,0xFB,0x19,0xFA,0x40,0xDD,0xCE,0xCB,0x3F}; + uint32_t Argument::read(facebook::thrift::protocol::TProtocol* iprot) { uint32_t xfer = 0; @@ -298,6 +310,9 @@ uint32_t Argument::write(facebook::thrift::protocol::TProtocol* oprot) const { return xfer; } +char* Method::ascii_fingerprint = "E6573428C492D24C84A19432D39A17B0"; +char Method::binary_fingerprint[16] = {0xE6,0x57,0x34,0x28,0xC4,0x92,0xD2,0x4C,0x84,0xA1,0x94,0x32,0xD3,0x9A,0x17,0xB0}; + uint32_t Method::read(facebook::thrift::protocol::TProtocol* iprot) { uint32_t xfer = 0; @@ -392,6 +407,9 @@ uint32_t Method::write(facebook::thrift::protocol::TProtocol* oprot) const { return xfer; } +char* Service::ascii_fingerprint = "4673B0777B701D9B02A7A74CEC7908A7"; +char Service::binary_fingerprint[16] = {0x46,0x73,0xB0,0x77,0x7B,0x70,0x1D,0x9B,0x02,0xA7,0xA7,0x4C,0xEC,0x79,0x08,0xA7}; + uint32_t Service::read(facebook::thrift::protocol::TProtocol* iprot) { uint32_t xfer = 0; diff --git a/lib/cpp/src/reflection_limited_types.h b/lib/cpp/src/reflection_limited_types.h index 843c6913..677cb4a9 100644 --- a/lib/cpp/src/reflection_limited_types.h +++ b/lib/cpp/src/reflection_limited_types.h @@ -7,6 +7,7 @@ #define reflection_limited_TYPES_H #include +#include #include #include @@ -34,6 +35,9 @@ enum TTypeTag { class SimpleType { public: + static char* ascii_fingerprint; // = "19B5240589E680301A7E32DF3971EFBE"; + static char binary_fingerprint[16]; // = {0x19,0xB5,0x24,0x05,0x89,0xE6,0x80,0x30,0x1A,0x7E,0x32,0xDF,0x39,0x71,0xEF,0xBE}; + SimpleType() : name("") { } @@ -68,6 +72,9 @@ class SimpleType { class ContainerType { public: + static char* ascii_fingerprint; // = "654FA6EFFF8242F4C2A604B970686634"; + static char binary_fingerprint[16]; // = {0x65,0x4F,0xA6,0xEF,0xFF,0x82,0x42,0xF4,0xC2,0xA6,0x04,0xB9,0x70,0x68,0x66,0x34}; + ContainerType() { } @@ -108,6 +115,9 @@ class ContainerType { class ThriftType { public: + static char* ascii_fingerprint; // = "76BC1CC759001D7D85FEE75C4F183062"; + static char binary_fingerprint[16]; // = {0x76,0xBC,0x1C,0xC7,0x59,0x00,0x1D,0x7D,0x85,0xFE,0xE7,0x5C,0x4F,0x18,0x30,0x62}; + ThriftType() : is_container(0) { } @@ -150,6 +160,9 @@ class ThriftType { class Argument { public: + static char* ascii_fingerprint; // = "8C45506BE0EFBB22FB19FA40DDCECB3F"; + static char binary_fingerprint[16]; // = {0x8C,0x45,0x50,0x6B,0xE0,0xEF,0xBB,0x22,0xFB,0x19,0xFA,0x40,0xDD,0xCE,0xCB,0x3F}; + Argument() : key(0), name("") { } @@ -188,6 +201,9 @@ class Argument { class Method { public: + static char* ascii_fingerprint; // = "E6573428C492D24C84A19432D39A17B0"; + static char binary_fingerprint[16]; // = {0xE6,0x57,0x34,0x28,0xC4,0x92,0xD2,0x4C,0x84,0xA1,0x94,0x32,0xD3,0x9A,0x17,0xB0}; + Method() : name("") { } @@ -226,6 +242,9 @@ class Method { class Service { public: + static char* ascii_fingerprint; // = "4673B0777B701D9B02A7A74CEC7908A7"; + static char binary_fingerprint[16]; // = {0x46,0x73,0xB0,0x77,0x7B,0x70,0x1D,0x9B,0x02,0xA7,0xA7,0x4C,0xEC,0x79,0x08,0xA7}; + Service() : name(""), fully_reflected(0) { } diff --git a/lib/py/cleanup.sh b/lib/py/cleanup.sh index bbbcef5a..fd52c283 100755 --- a/lib/py/cleanup.sh +++ b/lib/py/cleanup.sh @@ -11,6 +11,7 @@ NEWS \ aclocal.m4 \ autom4te.cache \ autoscan.log \ +build \ config.guess \ config.h \ config.hin \ diff --git a/lib/py/setup.py b/lib/py/setup.py index 582a985a..c727db48 100644 --- a/lib/py/setup.py +++ b/lib/py/setup.py @@ -18,7 +18,14 @@ setup(name = 'Thrift', author = ['Mark Slee'], author_email = ['mcslee@facebook.com'], url = 'http://code.facebook.com/thrift', - packages = ['thrift', 'thrift.protocol', 'thrift.transport', 'thrift.server'], + packages = [ + 'thrift', + 'thrift.protocol', + 'thrift.transport', + 'thrift.server', + 'thrift.reflection', + 'thrift.reflection.limited', + ], package_dir = {'thrift' : 'src'}, ext_modules = [fastbinarymod], ) diff --git a/lib/py/src/reflection/__init__.py b/lib/py/src/reflection/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lib/py/src/reflection/limited/__init__.py b/lib/py/src/reflection/limited/__init__.py new file mode 100644 index 00000000..adefd8e5 --- /dev/null +++ b/lib/py/src/reflection/limited/__init__.py @@ -0,0 +1 @@ +__all__ = ['ttypes', 'constants'] diff --git a/lib/py/src/reflection/limited/constants.py b/lib/py/src/reflection/limited/constants.py new file mode 100644 index 00000000..2f17ec34 --- /dev/null +++ b/lib/py/src/reflection/limited/constants.py @@ -0,0 +1,9 @@ +# +# Autogenerated by Thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# + +from thrift.Thrift import * +from ttypes import * + diff --git a/lib/py/src/reflection/limited/ttypes.py b/lib/py/src/reflection/limited/ttypes.py new file mode 100644 index 00000000..9ea8a9f9 --- /dev/null +++ b/lib/py/src/reflection/limited/ttypes.py @@ -0,0 +1,532 @@ +# +# Autogenerated by Thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# + +from thrift.Thrift import * + +from thrift.transport import TTransport +from thrift.protocol import fastbinary +from thrift.protocol import TBinaryProtocol + + +class TTypeTag: + T_VOID = 1 + T_BOOL = 2 + T_BYTE = 3 + T_I16 = 6 + T_I32 = 8 + T_I64 = 10 + T_DOUBLE = 4 + T_STRING = 11 + T_STRUCT = 12 + T_MAP = 13 + T_SET = 14 + T_LIST = 15 + T_ENUM = 101 + T_NOT_REFLECTED = 102 + +class SimpleType: + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'ttype', None, None, ), # 1 + (2, TType.STRING, 'name', None, None, ), # 2 + ) + + def __init__(self, d=None): + self.ttype = None + self.name = None + if isinstance(d, dict): + if 'ttype' in d: + self.ttype = d['ttype'] + if 'name' in d: + self.name = d['name'] + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport): + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.ttype = iprot.readI32(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.name = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('SimpleType') + if self.ttype != None: + oprot.writeFieldBegin('ttype', TType.I32, 1) + oprot.writeI32(self.ttype) + oprot.writeFieldEnd() + if self.name != None: + oprot.writeFieldBegin('name', TType.STRING, 2) + oprot.writeString(self.name) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __str__(self): + return str(self.__dict__) + + def __repr__(self): + return repr(self.__dict__) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class ContainerType: + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'ttype', None, None, ), # 1 + (2, TType.STRUCT, 'subtype1', (SimpleType, SimpleType.thrift_spec), None, ), # 2 + (3, TType.STRUCT, 'subtype2', (SimpleType, SimpleType.thrift_spec), None, ), # 3 + ) + + def __init__(self, d=None): + self.ttype = None + self.subtype1 = None + self.subtype2 = None + if isinstance(d, dict): + if 'ttype' in d: + self.ttype = d['ttype'] + if 'subtype1' in d: + self.subtype1 = d['subtype1'] + if 'subtype2' in d: + self.subtype2 = d['subtype2'] + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport): + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.ttype = iprot.readI32(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.subtype1 = SimpleType() + self.subtype1.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.subtype2 = SimpleType() + self.subtype2.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ContainerType') + if self.ttype != None: + oprot.writeFieldBegin('ttype', TType.I32, 1) + oprot.writeI32(self.ttype) + oprot.writeFieldEnd() + if self.subtype1 != None: + oprot.writeFieldBegin('subtype1', TType.STRUCT, 2) + self.subtype1.write(oprot) + oprot.writeFieldEnd() + if self.subtype2 != None: + oprot.writeFieldBegin('subtype2', TType.STRUCT, 3) + self.subtype2.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __str__(self): + return str(self.__dict__) + + def __repr__(self): + return repr(self.__dict__) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class ThriftType: + + thrift_spec = ( + None, # 0 + (1, TType.BOOL, 'is_container', None, None, ), # 1 + (2, TType.STRUCT, 'simple_type', (SimpleType, SimpleType.thrift_spec), None, ), # 2 + (3, TType.STRUCT, 'container_type', (ContainerType, ContainerType.thrift_spec), None, ), # 3 + ) + + def __init__(self, d=None): + self.is_container = None + self.simple_type = None + self.container_type = None + if isinstance(d, dict): + if 'is_container' in d: + self.is_container = d['is_container'] + if 'simple_type' in d: + self.simple_type = d['simple_type'] + if 'container_type' in d: + self.container_type = d['container_type'] + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport): + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.BOOL: + self.is_container = iprot.readBool(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.simple_type = SimpleType() + self.simple_type.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.container_type = ContainerType() + self.container_type.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ThriftType') + if self.is_container != None: + oprot.writeFieldBegin('is_container', TType.BOOL, 1) + oprot.writeBool(self.is_container) + oprot.writeFieldEnd() + if self.simple_type != None: + oprot.writeFieldBegin('simple_type', TType.STRUCT, 2) + self.simple_type.write(oprot) + oprot.writeFieldEnd() + if self.container_type != None: + oprot.writeFieldBegin('container_type', TType.STRUCT, 3) + self.container_type.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __str__(self): + return str(self.__dict__) + + def __repr__(self): + return repr(self.__dict__) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class Argument: + + thrift_spec = ( + None, # 0 + (1, TType.I16, 'key', None, None, ), # 1 + (2, TType.STRING, 'name', None, None, ), # 2 + (3, TType.STRUCT, 'type', (ThriftType, ThriftType.thrift_spec), None, ), # 3 + ) + + def __init__(self, d=None): + self.key = None + self.name = None + self.type = None + if isinstance(d, dict): + if 'key' in d: + self.key = d['key'] + if 'name' in d: + self.name = d['name'] + if 'type' in d: + self.type = d['type'] + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport): + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I16: + self.key = iprot.readI16(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.name = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.type = ThriftType() + self.type.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('Argument') + if self.key != None: + oprot.writeFieldBegin('key', TType.I16, 1) + oprot.writeI16(self.key) + oprot.writeFieldEnd() + if self.name != None: + oprot.writeFieldBegin('name', TType.STRING, 2) + oprot.writeString(self.name) + oprot.writeFieldEnd() + if self.type != None: + oprot.writeFieldBegin('type', TType.STRUCT, 3) + self.type.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __str__(self): + return str(self.__dict__) + + def __repr__(self): + return repr(self.__dict__) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class Method: + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'name', None, None, ), # 1 + (2, TType.STRUCT, 'return_type', (ThriftType, ThriftType.thrift_spec), None, ), # 2 + (3, TType.LIST, 'arguments', (TType.STRUCT,(Argument, Argument.thrift_spec)), None, ), # 3 + ) + + def __init__(self, d=None): + self.name = None + self.return_type = None + self.arguments = None + if isinstance(d, dict): + if 'name' in d: + self.name = d['name'] + if 'return_type' in d: + self.return_type = d['return_type'] + if 'arguments' in d: + self.arguments = d['arguments'] + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport): + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.name = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.return_type = ThriftType() + self.return_type.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.LIST: + self.arguments = [] + (_etype3, _size0) = iprot.readListBegin() + for _i4 in xrange(_size0): + _elem5 = Argument() + _elem5.read(iprot) + self.arguments.append(_elem5) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('Method') + if self.name != None: + oprot.writeFieldBegin('name', TType.STRING, 1) + oprot.writeString(self.name) + oprot.writeFieldEnd() + if self.return_type != None: + oprot.writeFieldBegin('return_type', TType.STRUCT, 2) + self.return_type.write(oprot) + oprot.writeFieldEnd() + if self.arguments != None: + oprot.writeFieldBegin('arguments', TType.LIST, 3) + oprot.writeListBegin(TType.STRUCT, len(self.arguments)) + for iter6 in self.arguments: + iter6.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __str__(self): + return str(self.__dict__) + + def __repr__(self): + return repr(self.__dict__) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class Service: + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'name', None, None, ), # 1 + (2, TType.LIST, 'methods', (TType.STRUCT,(Method, Method.thrift_spec)), None, ), # 2 + (3, TType.BOOL, 'fully_reflected', None, None, ), # 3 + ) + + def __init__(self, d=None): + self.name = None + self.methods = None + self.fully_reflected = None + if isinstance(d, dict): + if 'name' in d: + self.name = d['name'] + if 'methods' in d: + self.methods = d['methods'] + if 'fully_reflected' in d: + self.fully_reflected = d['fully_reflected'] + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport): + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.name = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.LIST: + self.methods = [] + (_etype10, _size7) = iprot.readListBegin() + for _i11 in xrange(_size7): + _elem12 = Method() + _elem12.read(iprot) + self.methods.append(_elem12) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.BOOL: + self.fully_reflected = iprot.readBool(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('Service') + if self.name != None: + oprot.writeFieldBegin('name', TType.STRING, 1) + oprot.writeString(self.name) + oprot.writeFieldEnd() + if self.methods != None: + oprot.writeFieldBegin('methods', TType.LIST, 2) + oprot.writeListBegin(TType.STRUCT, len(self.methods)) + for iter13 in self.methods: + iter13.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.fully_reflected != None: + oprot.writeFieldBegin('fully_reflected', TType.BOOL, 3) + oprot.writeBool(self.fully_reflected) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __str__(self): + return str(self.__dict__) + + def __repr__(self): + return repr(self.__dict__) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +