本文整理汇总了Python中thrift.Thrift.TType.BYTE属性的典型用法代码示例。如果您正苦于以下问题:Python TType.BYTE属性的具体用法?Python TType.BYTE怎么用?Python TType.BYTE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类thrift.Thrift.TType
的用法示例。
在下文中一共展示了TType.BYTE属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import BYTE [as 别名]
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()
示例2: read
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import BYTE [as 别名]
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()
示例3: write
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import BYTE [as 别名]
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()
示例4: read
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import BYTE [as 别名]
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()
示例5: write
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import BYTE [as 别名]
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()
示例6: field_type_to_str
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import BYTE [as 别名]
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)
示例7: read
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import BYTE [as 别名]
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()
示例8: skip
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import BYTE [as 别名]
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 )