当前位置: 首页>>代码示例>>Python>>正文


Python TType.SET属性代码示例

本文整理汇总了Python中thrift.Thrift.TType.SET属性的典型用法代码示例。如果您正苦于以下问题:Python TType.SET属性的具体用法?Python TType.SET怎么用?Python TType.SET使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在thrift.Thrift.TType的用法示例。


在下文中一共展示了TType.SET属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: read

# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import SET [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.SET:
                    self.headers = set()
                    (_etype10, _size7) = iprot.readSetBegin()
                    for _i11 in range(_size7):
                        _elem12 = TIEHeaderWithLifeTime()
                        _elem12.read(iprot)
                        self.headers.add(_elem12)
                    iprot.readSetEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
开发者ID:brunorijsman,项目名称:rift-python,代码行数:26,代码来源:ttypes.py

示例2: write

# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import SET [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('TCountDistinctSetStorage')
        if self.bitmap is not None:
            oprot.writeFieldBegin('bitmap', TType.STRING, 1)
            oprot.writeBinary(self.bitmap)
            oprot.writeFieldEnd()
        if self.sparse_set is not None:
            oprot.writeFieldBegin('sparse_set', TType.SET, 2)
            oprot.writeSetBegin(TType.I64, len(self.sparse_set))
            for iter48 in self.sparse_set:
                oprot.writeI64(iter48)
            oprot.writeSetEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
开发者ID:omnisci,项目名称:pymapd,代码行数:20,代码来源:ttypes.py

示例3: write

# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import SET [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('TIREPacket')
        if self.headers is not None:
            oprot.writeFieldBegin('headers', TType.SET, 1)
            oprot.writeSetBegin(TType.STRUCT, len(self.headers))
            for iter13 in self.headers:
                iter13.write(oprot)
            oprot.writeSetEnd()
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd() 
开发者ID:brunorijsman,项目名称:rift-python,代码行数:16,代码来源:ttypes.py

示例4: read

# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import SET [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.STRING:
                    self.bitmap = iprot.readBinary()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.SET:
                    self.sparse_set = set()
                    (_etype45, _size42) = iprot.readSetBegin()
                    for _i46 in range(_size42):
                        _elem47 = iprot.readI64()
                        self.sparse_set.add(_elem47)
                    iprot.readSetEnd()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd() 
开发者ID:omnisci,项目名称:pymapd,代码行数:30,代码来源:ttypes.py

示例5: field_type_to_str

# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import SET [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) 
开发者ID:pinterest,项目名称:thrift-tools,代码行数:39,代码来源:thrift_struct.py

示例6: fix_spec

# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import SET [as 别名]
def fix_spec(all_structs):
    """Wire up recursive references for all TStruct definitions inside of each thrift_spec."""
    for struc in all_structs:
        spec = struc.thrift_spec
        for thrift_spec in spec:
            if thrift_spec is None:
                continue
            elif thrift_spec[TYPE_IDX] == TType.STRUCT:
                other = thrift_spec[SPEC_ARGS_IDX][SPEC_ARGS_CLASS_REF_IDX].thrift_spec
                thrift_spec[SPEC_ARGS_IDX][SPEC_ARGS_THRIFT_SPEC_IDX] = other
            elif thrift_spec[TYPE_IDX] in (TType.LIST, TType.SET):
                _fix_list_or_set(thrift_spec[SPEC_ARGS_IDX])
            elif thrift_spec[TYPE_IDX] == TType.MAP:
                _fix_map(thrift_spec[SPEC_ARGS_IDX]) 
开发者ID:stya535,项目名称:SOLO,代码行数:16,代码来源:TRecursive.py

示例7: _fix_list_or_set

# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import SET [as 别名]
def _fix_list_or_set(element_type):
    # For a list or set, the thrift_spec entry looks like,
    # (1, TType.LIST, 'lister', (TType.STRUCT, [RecList, None], False), None, ),  # 1
    # so ``element_type`` will be,
    # (TType.STRUCT, [RecList, None], False)
    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]) 
开发者ID:stya535,项目名称:SOLO,代码行数:13,代码来源:TRecursive.py

示例8: _fix_map

# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import SET [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]) 
开发者ID:stya535,项目名称:SOLO,代码行数:31,代码来源:TRecursive.py

示例9: skip

# 需要导入模块: from thrift.Thrift import TType [as 别名]
# 或者: from thrift.Thrift.TType import SET [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 ) 
开发者ID:Aditmadzs,项目名称:Protect4,代码行数:46,代码来源:TProtocol.py


注:本文中的thrift.Thrift.TType.SET属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。