本文整理汇总了Python中thrift.Thrift.TType.I16属性的典型用法代码示例。如果您正苦于以下问题:Python TType.I16属性的具体用法?Python TType.I16怎么用?Python TType.I16使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类thrift.Thrift.TType
的用法示例。
在下文中一共展示了TType.I16属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [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('NodeCapabilities')
if self.protocol_minor_version is not None:
oprot.writeFieldBegin('protocol_minor_version', TType.I16, 1)
oprot.writeI16(self.protocol_minor_version)
oprot.writeFieldEnd()
if self.flood_reduction is not None:
oprot.writeFieldBegin('flood_reduction', TType.BOOL, 2)
oprot.writeBool(self.flood_reduction)
oprot.writeFieldEnd()
if self.hierarchy_indications is not None:
oprot.writeFieldBegin('hierarchy_indications', TType.I32, 3)
oprot.writeI32(self.hierarchy_indications)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
示例2: write
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [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('TIEHeader')
if self.tieid is not None:
oprot.writeFieldBegin('tieid', TType.STRUCT, 2)
self.tieid.write(oprot)
oprot.writeFieldEnd()
if self.seq_nr is not None:
oprot.writeFieldBegin('seq_nr', TType.I16, 3)
oprot.writeI16(self.seq_nr)
oprot.writeFieldEnd()
if self.origination_time is not None:
oprot.writeFieldBegin('origination_time', TType.STRUCT, 10)
self.origination_time.write(oprot)
oprot.writeFieldEnd()
if self.origination_lifetime is not None:
oprot.writeFieldBegin('origination_lifetime', TType.I32, 12)
oprot.writeI32(self.origination_lifetime)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
示例3: write
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [as 别名]
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('DatumMapRecord')
if self.data is not None:
oprot.writeFieldBegin('data', TType.MAP, 1)
oprot.writeMapBegin(TType.I16, TType.STRUCT, len(self.data))
for kiter46,viter47 in self.data.items():
oprot.writeI16(kiter46)
viter47.write(oprot)
oprot.writeMapEnd()
oprot.writeFieldEnd()
if self.keyIdMap is not None:
oprot.writeFieldBegin('keyIdMap', TType.MAP, 2)
oprot.writeMapBegin(TType.I16, TType.STRING, len(self.keyIdMap))
for kiter48,viter49 in self.keyIdMap.items():
oprot.writeI16(kiter48)
oprot.writeString(viter49)
oprot.writeMapEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
示例4: read
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [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 == 0:
if ftype == TType.I16:
self.success = iprot.readI16()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
示例5: read
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [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.I16:
self.code = iprot.readI16()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.message = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
示例6: read
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [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.I16:
self.padded = iprot.readI16()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I16:
self.logical = iprot.readI16()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
示例7: write
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [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('Endpoint')
if self.ipv4 is not None:
oprot.writeFieldBegin('ipv4', TType.I32, 1)
oprot.writeI32(self.ipv4)
oprot.writeFieldEnd()
if self.port is not None:
oprot.writeFieldBegin('port', TType.I16, 2)
oprot.writeI16(self.port)
oprot.writeFieldEnd()
if self.service_name is not None:
oprot.writeFieldBegin('service_name', TType.STRING, 3)
oprot.writeString(self.service_name.encode('utf-8') if sys.version_info[0] == 2 else self.service_name)
oprot.writeFieldEnd()
if self.ipv6 is not None:
oprot.writeFieldBegin('ipv6', TType.STRING, 4)
oprot.writeBinary(self.ipv6)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
示例8: write
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [as 别名]
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Endpoint')
if self.ipv4 is not None:
oprot.writeFieldBegin('ipv4', TType.I32, 1)
oprot.writeI32(self.ipv4)
oprot.writeFieldEnd()
if self.port is not None:
oprot.writeFieldBegin('port', TType.I16, 2)
oprot.writeI16(self.port)
oprot.writeFieldEnd()
if self.service_name is not None:
oprot.writeFieldBegin('service_name', TType.STRING, 3)
oprot.writeString(self.service_name)
oprot.writeFieldEnd()
if self.ipv6 is not None:
oprot.writeFieldBegin('ipv6', TType.STRING, 4)
oprot.writeString(self.ipv6)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
示例9: read
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [as 别名]
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
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.maxTracesPerSecond = iprot.readI16()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
示例10: read
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [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.I16:
self.protocol_minor_version = iprot.readI16()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.BOOL:
self.flood_reduction = iprot.readBool()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.hierarchy_indications = iprot.readI32()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
示例11: write
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [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('ping_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.I16, 0)
oprot.writeI16(self.success)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
示例12: write
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [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('TSlotSize')
if self.padded is not None:
oprot.writeFieldBegin('padded', TType.I16, 1)
oprot.writeI16(self.padded)
oprot.writeFieldEnd()
if self.logical is not None:
oprot.writeFieldBegin('logical', TType.I16, 2)
oprot.writeI16(self.logical)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
示例13: read
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [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.ipv4 = iprot.readI32()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I16:
self.port = iprot.readI16()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.service_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.ipv6 = iprot.readBinary()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
示例14: field_type_to_str
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [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)
示例15: _fix_map
# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import I16 [as 别名]
def _fix_map(element_type):
# For a map of key -> value type, ``element_type`` will be,
# (TType.I16, None, TType.STRUCT, [RecMapBasic, None], False), None, )
# which is just a normal struct definition.
#
# For a map of key -> list / set, ``element_type`` will be,
# (TType.I16, None, TType.LIST, (TType.STRUCT, [RecMapList, None], False), False)
# and we need to process the 3rd element as a list.
#
# For a map of key -> map, ``element_type`` will be,
# (TType.I16, None, TType.MAP, (TType.I16, None, TType.STRUCT,
# [RecMapMap, None], False), False)
# and need to process 3rd element as a map.
# Is the map key a struct?
if element_type[0] == TType.STRUCT:
element_type[1][1] = element_type[1][0].thrift_spec
elif element_type[0] in (TType.LIST, TType.SET):
_fix_list_or_set(element_type[1])
elif element_type[0] == TType.MAP:
_fix_map(element_type[1])
# Is the map value a struct?
if element_type[2] == TType.STRUCT:
element_type[3][1] = element_type[3][0].thrift_spec
elif element_type[2] in (TType.LIST, TType.SET):
_fix_list_or_set(element_type[3])
elif element_type[2] == TType.MAP:
_fix_map(element_type[3])