Python thrift.Thrift.TType.BYTE Examples

The following are 28 code examples of thrift.Thrift.TType.BYTE(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module thrift.Thrift.TType , or try the search function .
Example #1
Source File: ttypes.py    From rift-python with Apache License 2.0 6 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('PacketHeader')
        if self.major_version is not None:
            oprot.writeFieldBegin('major_version', TType.BYTE, 1)
            oprot.writeByte(self.major_version)
            oprot.writeFieldEnd()
        if self.minor_version is not None:
            oprot.writeFieldBegin('minor_version', TType.BYTE, 2)
            oprot.writeByte(self.minor_version)
            oprot.writeFieldEnd()
        if self.sender is not None:
            oprot.writeFieldBegin('sender', TType.I64, 3)
            oprot.writeI64(self.sender)
            oprot.writeFieldEnd()
        if self.level is not None:
            oprot.writeFieldBegin('level', TType.BYTE, 4)
            oprot.writeByte(self.level)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #2
Source File: BotService.py    From sb with GNU General Public License v3.0 6 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('sendChatCheckedByWatermark_args')
        if self.seq is not None:
            oprot.writeFieldBegin('seq', TType.I32, 1)
            oprot.writeI32(self.seq)
            oprot.writeFieldEnd()
        if self.mid is not None:
            oprot.writeFieldBegin('mid', TType.STRING, 2)
            oprot.writeString(self.mid.encode('utf-8') if sys.version_info[0] == 2 else self.mid)
            oprot.writeFieldEnd()
        if self.watermark is not None:
            oprot.writeFieldBegin('watermark', TType.I64, 3)
            oprot.writeI64(self.watermark)
            oprot.writeFieldEnd()
        if self.sessionId is not None:
            oprot.writeFieldBegin('sessionId', TType.BYTE, 4)
            oprot.writeByte(self.sessionId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #3
Source File: ttypes.py    From rift-python with Apache License 2.0 6 votes vote down vote up
def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (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.STRUCT:
                    self.timestamp = IEEE802_1ASTimeStampType()
                    self.timestamp.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BYTE:
                    self.transactionid = iprot.readByte()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
Example #4
Source File: ttypes.py    From rift-python with Apache License 2.0 6 votes vote down vote up
def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (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.address = iprot.readBinary()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BYTE:
                    self.prefixlen = iprot.readByte()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
Example #5
Source File: ttypes.py    From rift-python with Apache License 2.0 6 votes vote down vote up
def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (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.address = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BYTE:
                    self.prefixlen = iprot.readByte()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
Example #6
Source File: ttypes.py    From rift-python with Apache License 2.0 6 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('PacketHeader')
        if self.major_version is not None:
            oprot.writeFieldBegin('major_version', TType.BYTE, 1)
            oprot.writeByte(self.major_version)
            oprot.writeFieldEnd()
        if self.minor_version is not None:
            oprot.writeFieldBegin('minor_version', TType.BYTE, 2)
            oprot.writeByte(self.minor_version)
            oprot.writeFieldEnd()
        if self.sender is not None:
            oprot.writeFieldBegin('sender', TType.I64, 3)
            oprot.writeI64(self.sender)
            oprot.writeFieldEnd()
        if self.level is not None:
            oprot.writeFieldBegin('level', TType.BYTE, 4)
            oprot.writeByte(self.level)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #7
Source File: ttypes.py    From rift-python with Apache License 2.0 6 votes vote down vote up
def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (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.address = iprot.readBinary()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BYTE:
                    self.prefixlen = iprot.readByte()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
Example #8
Source File: ttypes.py    From rift-python with Apache License 2.0 6 votes vote down vote up
def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (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.address = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BYTE:
                    self.prefixlen = iprot.readByte()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
Example #9
Source File: ttypes.py    From rift-python with Apache License 2.0 5 votes vote down vote up
def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (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.BYTE:
                    self.major_version = iprot.readByte()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BYTE:
                    self.minor_version = iprot.readByte()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I64:
                    self.sender = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.BYTE:
                    self.level = iprot.readByte()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
Example #10
Source File: ttypes.py    From rift-python with Apache License 2.0 5 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('IPv4PrefixType')
        if self.address is not None:
            oprot.writeFieldBegin('address', TType.I32, 1)
            oprot.writeI32(self.address)
            oprot.writeFieldEnd()
        if self.prefixlen is not None:
            oprot.writeFieldBegin('prefixlen', TType.BYTE, 2)
            oprot.writeByte(self.prefixlen)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #11
Source File: BotService.py    From sb with GNU General Public License v3.0 5 votes vote down vote up
def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [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.seq = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.mid = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I64:
                    self.watermark = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.BYTE:
                    self.sessionId = iprot.readByte()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
Example #12
Source File: thrift_struct.py    From thrift-tools with Apache License 2.0 5 votes vote down vote up
def field_type_to_str(ftype):
        if ftype == TType.STOP:
            return 'stop'
        elif ftype == TType.VOID:
            return 'void'
        elif ftype == TType.BOOL:
            return 'bool'
        elif ftype == TType.BYTE:
            return 'byte'
        elif ftype == TType.I08:
            return 'i08'
        elif ftype == TType.DOUBLE:
            return 'double'
        elif ftype == TType.I16:
            return 'i16'
        elif ftype == TType.I32:
            return 'i32'
        elif ftype == TType.I64:
            return 'i64'
        elif ftype == TType.STRING:
            return 'string'
        elif ftype == TType.UTF7:
            return 'utf7'
        elif ftype == TType.STRUCT:
            return 'struct'
        elif ftype == TType.MAP:
            return 'map'
        elif ftype == TType.SET:
            return 'set'
        elif ftype == TType.LIST:
            return 'list'
        elif ftype == TType.UTF8:
            return 'utf8'
        elif ftype == TType.UTF16:
            return 'utf16'
        else:
            raise ValueError('Unknown type: %s' % ftype) 
Example #13
Source File: ttypes.py    From rift-python with Apache License 2.0 5 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('PrefixSequenceType')
        if self.timestamp is not None:
            oprot.writeFieldBegin('timestamp', TType.STRUCT, 1)
            self.timestamp.write(oprot)
            oprot.writeFieldEnd()
        if self.transactionid is not None:
            oprot.writeFieldBegin('transactionid', TType.BYTE, 2)
            oprot.writeByte(self.transactionid)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #14
Source File: ttypes.py    From rift-python with Apache License 2.0 5 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('LinkIDPair')
        if self.local_id is not None:
            oprot.writeFieldBegin('local_id', TType.I32, 1)
            oprot.writeI32(self.local_id)
            oprot.writeFieldEnd()
        if self.remote_id is not None:
            oprot.writeFieldBegin('remote_id', TType.I32, 2)
            oprot.writeI32(self.remote_id)
            oprot.writeFieldEnd()
        if self.platform_interface_index is not None:
            oprot.writeFieldBegin('platform_interface_index', TType.I32, 10)
            oprot.writeI32(self.platform_interface_index)
            oprot.writeFieldEnd()
        if self.platform_interface_name is not None:
            oprot.writeFieldBegin('platform_interface_name', TType.STRING, 11)
            oprot.writeString(self.platform_interface_name.encode('utf-8') if sys.version_info[0] == 2 else self.platform_interface_name)
            oprot.writeFieldEnd()
        if self.trusted_outer_security_key is not None:
            oprot.writeFieldBegin('trusted_outer_security_key', TType.BYTE, 12)
            oprot.writeByte(self.trusted_outer_security_key)
            oprot.writeFieldEnd()
        if self.bfd_up is not None:
            oprot.writeFieldBegin('bfd_up', TType.BOOL, 13)
            oprot.writeBool(self.bfd_up)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #15
Source File: ttypes.py    From rift-python with Apache License 2.0 5 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('IPv4PrefixType')
        if self.address is not None:
            oprot.writeFieldBegin('address', TType.I32, 1)
            oprot.writeI32(self.address)
            oprot.writeFieldEnd()
        if self.prefixlen is not None:
            oprot.writeFieldBegin('prefixlen', TType.BYTE, 2)
            oprot.writeByte(self.prefixlen)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #16
Source File: ttypes.py    From rift-python with Apache License 2.0 5 votes vote down vote up
def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (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.BYTE:
                    self.level = iprot.readByte()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I32:
                    self.cost = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.SET:
                    self.link_ids = set()
                    (_etype17, _size14) = iprot.readSetBegin()
                    for _i18 in range(_size14):
                        _elem19 = LinkIDPair()
                        _elem19.read(iprot)
                        self.link_ids.add(_elem19)
                    iprot.readSetEnd()
                else:
                    iprot.skip(ftype)
            elif fid == 5:
                if ftype == TType.I32:
                    self.bandwidth = iprot.readI32()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
Example #17
Source File: ttypes.py    From rift-python with Apache License 2.0 5 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('NodeNeighborsTIEElement')
        if self.level is not None:
            oprot.writeFieldBegin('level', TType.BYTE, 1)
            oprot.writeByte(self.level)
            oprot.writeFieldEnd()
        if self.cost is not None:
            oprot.writeFieldBegin('cost', TType.I32, 3)
            oprot.writeI32(self.cost)
            oprot.writeFieldEnd()
        if self.link_ids is not None:
            oprot.writeFieldBegin('link_ids', TType.SET, 4)
            oprot.writeSetBegin(TType.STRUCT, len(self.link_ids))
            for iter20 in self.link_ids:
                iter20.write(oprot)
            oprot.writeSetEnd()
            oprot.writeFieldEnd()
        if self.bandwidth is not None:
            oprot.writeFieldBegin('bandwidth', TType.I32, 5)
            oprot.writeI32(self.bandwidth)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #18
Source File: ttypes.py    From rift-python with Apache License 2.0 5 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('LinkIDPair')
        if self.local_id is not None:
            oprot.writeFieldBegin('local_id', TType.I32, 1)
            oprot.writeI32(self.local_id)
            oprot.writeFieldEnd()
        if self.remote_id is not None:
            oprot.writeFieldBegin('remote_id', TType.I32, 2)
            oprot.writeI32(self.remote_id)
            oprot.writeFieldEnd()
        if self.platform_interface_index is not None:
            oprot.writeFieldBegin('platform_interface_index', TType.I32, 10)
            oprot.writeI32(self.platform_interface_index)
            oprot.writeFieldEnd()
        if self.platform_interface_name is not None:
            oprot.writeFieldBegin('platform_interface_name', TType.STRING, 11)
            oprot.writeString(self.platform_interface_name.encode('utf-8') if sys.version_info[0] == 2 else self.platform_interface_name)
            oprot.writeFieldEnd()
        if self.trusted_outer_security_key is not None:
            oprot.writeFieldBegin('trusted_outer_security_key', TType.BYTE, 12)
            oprot.writeByte(self.trusted_outer_security_key)
            oprot.writeFieldEnd()
        if self.bfd_up is not None:
            oprot.writeFieldBegin('bfd_up', TType.BOOL, 13)
            oprot.writeBool(self.bfd_up)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #19
Source File: ttypes.py    From rift-python with Apache License 2.0 5 votes vote down vote up
def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (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.BYTE:
                    self.major_version = iprot.readByte()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.BYTE:
                    self.minor_version = iprot.readByte()
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.I64:
                    self.sender = iprot.readI64()
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.BYTE:
                    self.level = iprot.readByte()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
Example #20
Source File: ttypes.py    From rift-python with Apache License 2.0 5 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('PrefixSequenceType')
        if self.timestamp is not None:
            oprot.writeFieldBegin('timestamp', TType.STRUCT, 1)
            self.timestamp.write(oprot)
            oprot.writeFieldEnd()
        if self.transactionid is not None:
            oprot.writeFieldBegin('transactionid', TType.BYTE, 2)
            oprot.writeByte(self.transactionid)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #21
Source File: ttypes.py    From rift-python with Apache License 2.0 5 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('IPv6PrefixType')
        if self.address is not None:
            oprot.writeFieldBegin('address', TType.STRING, 1)
            oprot.writeBinary(self.address)
            oprot.writeFieldEnd()
        if self.prefixlen is not None:
            oprot.writeFieldBegin('prefixlen', TType.BYTE, 2)
            oprot.writeByte(self.prefixlen)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #22
Source File: ttypes.py    From rift-python with Apache License 2.0 4 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('NodeTIEElement')
        if self.level is not None:
            oprot.writeFieldBegin('level', TType.BYTE, 1)
            oprot.writeByte(self.level)
            oprot.writeFieldEnd()
        if self.neighbors is not None:
            oprot.writeFieldBegin('neighbors', TType.MAP, 2)
            oprot.writeMapBegin(TType.I64, TType.STRUCT, len(self.neighbors))
            for kiter34, viter35 in self.neighbors.items():
                oprot.writeI64(kiter34)
                viter35.write(oprot)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        if self.capabilities is not None:
            oprot.writeFieldBegin('capabilities', TType.STRUCT, 3)
            self.capabilities.write(oprot)
            oprot.writeFieldEnd()
        if self.flags is not None:
            oprot.writeFieldBegin('flags', TType.STRUCT, 4)
            self.flags.write(oprot)
            oprot.writeFieldEnd()
        if self.name is not None:
            oprot.writeFieldBegin('name', TType.STRING, 5)
            oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name)
            oprot.writeFieldEnd()
        if self.pod is not None:
            oprot.writeFieldBegin('pod', TType.I32, 6)
            oprot.writeI32(self.pod)
            oprot.writeFieldEnd()
        if self.miscabled_links is not None:
            oprot.writeFieldBegin('miscabled_links', TType.SET, 10)
            oprot.writeSetBegin(TType.I32, len(self.miscabled_links))
            for iter36 in self.miscabled_links:
                oprot.writeI32(iter36)
            oprot.writeSetEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #23
Source File: ttypes.py    From rift-python with Apache License 2.0 4 votes vote down vote up
def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (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.local_id = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.remote_id = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 10:
                if ftype == TType.I32:
                    self.platform_interface_index = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 11:
                if ftype == TType.STRING:
                    self.platform_interface_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 12:
                if ftype == TType.BYTE:
                    self.trusted_outer_security_key = iprot.readByte()
                else:
                    iprot.skip(ftype)
            elif fid == 13:
                if ftype == TType.BOOL:
                    self.bfd_up = iprot.readBool()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
Example #24
Source File: ttypes.py    From rift-python with Apache License 2.0 4 votes vote down vote up
def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, (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.local_id = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.I32:
                    self.remote_id = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 10:
                if ftype == TType.I32:
                    self.platform_interface_index = iprot.readI32()
                else:
                    iprot.skip(ftype)
            elif fid == 11:
                if ftype == TType.STRING:
                    self.platform_interface_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 12:
                if ftype == TType.BYTE:
                    self.trusted_outer_security_key = iprot.readByte()
                else:
                    iprot.skip(ftype)
            elif fid == 13:
                if ftype == TType.BOOL:
                    self.bfd_up = iprot.readBool()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
Example #25
Source File: ttypes.py    From rift-python with Apache License 2.0 4 votes vote down vote up
def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
            return
        oprot.writeStructBegin('NodeTIEElement')
        if self.level is not None:
            oprot.writeFieldBegin('level', TType.BYTE, 1)
            oprot.writeByte(self.level)
            oprot.writeFieldEnd()
        if self.neighbors is not None:
            oprot.writeFieldBegin('neighbors', TType.MAP, 2)
            oprot.writeMapBegin(TType.I64, TType.STRUCT, len(self.neighbors))
            for kiter34, viter35 in self.neighbors.items():
                oprot.writeI64(kiter34)
                viter35.write(oprot)
            oprot.writeMapEnd()
            oprot.writeFieldEnd()
        if self.capabilities is not None:
            oprot.writeFieldBegin('capabilities', TType.STRUCT, 3)
            self.capabilities.write(oprot)
            oprot.writeFieldEnd()
        if self.flags is not None:
            oprot.writeFieldBegin('flags', TType.STRUCT, 4)
            self.flags.write(oprot)
            oprot.writeFieldEnd()
        if self.name is not None:
            oprot.writeFieldBegin('name', TType.STRING, 5)
            oprot.writeString(self.name.encode('utf-8') if sys.version_info[0] == 2 else self.name)
            oprot.writeFieldEnd()
        if self.pod is not None:
            oprot.writeFieldBegin('pod', TType.I32, 6)
            oprot.writeI32(self.pod)
            oprot.writeFieldEnd()
        if self.miscabled_links is not None:
            oprot.writeFieldBegin('miscabled_links', TType.SET, 10)
            oprot.writeSetBegin(TType.I32, len(self.miscabled_links))
            for iter36 in self.miscabled_links:
                oprot.writeI32(iter36)
            oprot.writeSetEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
Example #26
Source File: TProtocol.py    From Protect4 with GNU General Public License v3.0 4 votes vote down vote up
def skip(self, ttype):
        if ttype == TType.STOP:
            return
        elif ttype == TType.BOOL:
            self.readBool()
        elif ttype == TType.BYTE:
            self.readByte()
        elif ttype == TType.I16:
            self.readI16()
        elif ttype == TType.I32:
            self.readI32()
        elif ttype == TType.I64:
            self.readI64()
        elif ttype == TType.DOUBLE:
            self.readDouble()
        elif ttype == TType.STRING:
            self.readString()
        elif ttype == TType.STRUCT:
            name = self.readStructBegin()
            while True:
                (name, ttype, id) = self.readFieldBegin()
                if ttype == TType.STOP:
                    break
                self.skip(ttype)
                self.readFieldEnd()
            self.readStructEnd()
        elif ttype == TType.MAP:
            (ktype, vtype, size) = self.readMapBegin()
            for i in range(size):
                self.skip(ktype)
                self.skip(vtype)
            self.readMapEnd()
        elif ttype == TType.SET:
            (etype, size) = self.readSetBegin()
            for i in range(size):
                self.skip(etype)
            self.readSetEnd()
        elif ttype == TType.LIST:
            (etype, size) = self.readListBegin()
            for i in range(size):
                self.skip(etype)
            self.readListEnd()

    # tuple of: ( 'reader method' name, is_container bool, 'writer_method' name ) 
Example #27
Source File: TProtocol.py    From Aditmadzs2 with GNU General Public License v3.0 4 votes vote down vote up
def skip(self, ttype):
        if ttype == TType.STOP:
            return
        elif ttype == TType.BOOL:
            self.readBool()
        elif ttype == TType.BYTE:
            self.readByte()
        elif ttype == TType.I16:
            self.readI16()
        elif ttype == TType.I32:
            self.readI32()
        elif ttype == TType.I64:
            self.readI64()
        elif ttype == TType.DOUBLE:
            self.readDouble()
        elif ttype == TType.STRING:
            self.readString()
        elif ttype == TType.STRUCT:
            name = self.readStructBegin()
            while True:
                (name, ttype, id) = self.readFieldBegin()
                if ttype == TType.STOP:
                    break
                self.skip(ttype)
                self.readFieldEnd()
            self.readStructEnd()
        elif ttype == TType.MAP:
            (ktype, vtype, size) = self.readMapBegin()
            for i in range(size):
                self.skip(ktype)
                self.skip(vtype)
            self.readMapEnd()
        elif ttype == TType.SET:
            (etype, size) = self.readSetBegin()
            for i in range(size):
                self.skip(etype)
            self.readSetEnd()
        elif ttype == TType.LIST:
            (etype, size) = self.readListBegin()
            for i in range(size):
                self.skip(etype)
            self.readListEnd()

    # tuple of: ( 'reader method' name, is_container bool, 'writer_method' name ) 
Example #28
Source File: TProtocol.py    From ajs2 with GNU General Public License v3.0 4 votes vote down vote up
def skip(self, ttype):
        if ttype == TType.STOP:
            return
        elif ttype == TType.BOOL:
            self.readBool()
        elif ttype == TType.BYTE:
            self.readByte()
        elif ttype == TType.I16:
            self.readI16()
        elif ttype == TType.I32:
            self.readI32()
        elif ttype == TType.I64:
            self.readI64()
        elif ttype == TType.DOUBLE:
            self.readDouble()
        elif ttype == TType.STRING:
            self.readString()
        elif ttype == TType.STRUCT:
            name = self.readStructBegin()
            while True:
                (name, ttype, id) = self.readFieldBegin()
                if ttype == TType.STOP:
                    break
                self.skip(ttype)
                self.readFieldEnd()
            self.readStructEnd()
        elif ttype == TType.MAP:
            (ktype, vtype, size) = self.readMapBegin()
            for i in range(size):
                self.skip(ktype)
                self.skip(vtype)
            self.readMapEnd()
        elif ttype == TType.SET:
            (etype, size) = self.readSetBegin()
            for i in range(size):
                self.skip(etype)
            self.readSetEnd()
        elif ttype == TType.LIST:
            (etype, size) = self.readListBegin()
            for i in range(size):
                self.skip(etype)
            self.readListEnd()

    # tuple of: ( 'reader method' name, is_container bool, 'writer_method' name )