Ejemplo n.º 1
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('MyStruct')
   if self.MyIntField != None:
     oprot.writeFieldBegin('MyIntField', TType.I64, 1)
     oprot.writeI64(self.MyIntField)
     oprot.writeFieldEnd()
   if self.MyStringField != None:
     oprot.writeFieldBegin('MyStringField', TType.STRING, 2)
     oprot.writeString(self.MyStringField.encode('utf-8')) if UTF8STRINGS and not isinstance(self.MyStringField, bytes) else oprot.writeString(self.MyStringField)
     oprot.writeFieldEnd()
   if self.MyDataField != None:
     oprot.writeFieldBegin('MyDataField', TType.STRUCT, 3)
     self.MyDataField.write(oprot)
     oprot.writeFieldEnd()
   if self.major != None:
     oprot.writeFieldBegin('major', TType.I64, 4)
     oprot.writeI64(self.major)
     oprot.writeFieldEnd()
   if self.myEnum != None:
     oprot.writeFieldBegin('myEnum', TType.I32, 5)
     oprot.writeI32(self.myEnum)
     oprot.writeFieldEnd()
   if self.package != None:
     oprot.writeFieldBegin('package', TType.STRING, 6)
     oprot.writeString(self.package.encode('utf-8')) if UTF8STRINGS and not isinstance(self.package, bytes) else oprot.writeString(self.package)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 2
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('Foo')
   if self.mymap != None:
     oprot.writeFieldBegin('mymap', TType.MAP, 1)
     oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.mymap))
     sorted18 = self.mymap.items()
     sorted18 = sorted(sorted18, key=lambda tuple19: tuple19[0])
     for kiter16,viter17 in sorted18:
       oprot.writeString(kiter16.encode('utf-8')) if UTF8STRINGS and not isinstance(kiter16, bytes) else oprot.writeString(kiter16)
       oprot.writeString(viter17.encode('utf-8')) if UTF8STRINGS and not isinstance(viter17, bytes) else oprot.writeString(viter17)
     oprot.writeMapEnd()
     oprot.writeFieldEnd()
   if self.myset != None:
     oprot.writeFieldBegin('myset', TType.SET, 2)
     oprot.writeSetBegin(TType.STRING, len(self.myset))
     for iter20 in sorted(self.myset):
       oprot.writeString(iter20.encode('utf-8')) if UTF8STRINGS and not isinstance(iter20, bytes) else oprot.writeString(iter20)
     oprot.writeSetEnd()
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 3
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastbinary is not None:
     oprot.trans.write(fastbinary.encode_binary(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS))
     return
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('Internship')
   if self.weeks != None:
     oprot.writeFieldBegin('weeks', TType.I32, 1)
     oprot.writeI32(self.weeks)
     oprot.writeFieldEnd()
   if self.title != None:
     oprot.writeFieldBegin('title', TType.STRING, 2)
     oprot.writeString(self.title.encode('utf-8')) if UTF8STRINGS and not isinstance(self.title, bytes) else oprot.writeString(self.title)
     oprot.writeFieldEnd()
   if self.employer != None:
     oprot.writeFieldBegin('employer', TType.I32, 3)
     oprot.writeI32(self.employer)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 4
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeStructBegin('echo_result')
     if self.success != None:
         oprot.writeFieldBegin('success', TType.STRING, 0)
         oprot.writeString(self.success.encode(
             'utf-8')) if UTF8STRINGS and not isinstance(
                 self.success, bytes) else oprot.writeString(self.success)
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 5
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeStructBegin('NewStructureNested')
     if self.lst != None:
         oprot.writeFieldBegin('lst', TType.LIST, 1)
         oprot.writeListBegin(TType.MAP, len(self.lst))
         for iter110 in self.lst:
             oprot.writeMapBegin(TType.I16, TType.FLOAT, len(iter110))
             for kiter111, viter112 in iter110.items():
                 oprot.writeI16(kiter111)
                 oprot.writeFloat(viter112)
             oprot.writeMapEnd()
         oprot.writeListEnd()
         oprot.writeFieldEnd()
     if self.mp != None:
         oprot.writeFieldBegin('mp', TType.MAP, 2)
         oprot.writeMapBegin(TType.I16, TType.MAP, len(self.mp))
         for kiter113, viter114 in self.mp.items():
             oprot.writeI16(kiter113)
             oprot.writeMapBegin(TType.I16, TType.FLOAT, len(viter114))
             for kiter115, viter116 in viter114.items():
                 oprot.writeI16(kiter115)
                 oprot.writeFloat(viter116)
             oprot.writeMapEnd()
         oprot.writeMapEnd()
         oprot.writeFieldEnd()
     if self.s != None:
         oprot.writeFieldBegin('s', TType.SET, 3)
         oprot.writeSetBegin(TType.MAP, len(self.s))
         for iter117 in self.s:
             oprot.writeMapBegin(TType.I16, TType.FLOAT, len(iter117))
             for kiter118, viter119 in iter117.items():
                 oprot.writeI16(kiter118)
                 oprot.writeFloat(viter119)
             oprot.writeMapEnd()
         oprot.writeSetEnd()
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 6
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeStructBegin('has_arg_docs_result')
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 7
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, True], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, True], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeUnionBegin('union2')
   if self.field == 1:
     oprot.writeFieldBegin('i', TType.I32, 1)
     i = self.value
     oprot.writeI32(i)
     oprot.writeFieldEnd()
   if self.field == 2:
     oprot.writeFieldBegin('d', TType.DOUBLE, 2)
     d = self.value
     oprot.writeDouble(d)
     oprot.writeFieldEnd()
   if self.field == 3:
     oprot.writeFieldBegin('s', TType.STRUCT, 3)
     s = self.value
     s.write(oprot)
     oprot.writeFieldEnd()
   if self.field == 4:
     oprot.writeFieldBegin('u', TType.STRUCT, 4)
     u = self.value
     u.write(oprot)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeUnionEnd()
Ejemplo n.º 8
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeStructBegin('NewStructure2')
     if self.features != None:
         oprot.writeFieldBegin('features', TType.MAP, 1)
         oprot.writeMapBegin(TType.I16, TType.FLOAT, len(self.features))
         for kiter31, viter32 in self.features.items():
             oprot.writeI16(kiter31)
             oprot.writeFloat(viter32)
         oprot.writeMapEnd()
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 9
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('get500_result')
   if self.success != None:
     oprot.writeFieldBegin('success', TType.STRING, 0)
     oprot.writeString(self.success.encode('utf-8')) if UTF8STRINGS and not isinstance(self.success, bytes) else oprot.writeString(self.success)
     oprot.writeFieldEnd()
   if self.f != None:
     oprot.writeFieldBegin('f', TType.STRUCT, 1)
     self.f.write(oprot)
     oprot.writeFieldEnd()
   if self.b != None:
     oprot.writeFieldBegin('b', TType.STRUCT, 2)
     self.b.write(oprot)
     oprot.writeFieldEnd()
   if self.s != None:
     oprot.writeFieldBegin('s', TType.STRUCT, 3)
     self.s.write(oprot)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 10
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('struct2')
   if self.a != None:
     oprot.writeFieldBegin('a', TType.I32, 1)
     oprot.writeI32(self.a)
     oprot.writeFieldEnd()
   if self.b != None:
     oprot.writeFieldBegin('b', TType.STRING, 2)
     oprot.writeString(self.b.encode('utf-8')) if UTF8STRINGS and not isinstance(self.b, bytes) else oprot.writeString(self.b)
     oprot.writeFieldEnd()
   if self.c != None:
     oprot.writeFieldBegin('c', TType.STRUCT, 3)
     self.c.write(oprot)
     oprot.writeFieldEnd()
   if self.d != None:
     oprot.writeFieldBegin('d', TType.LIST, 4)
     oprot.writeListBegin(TType.I32, len(self.d))
     for iter7 in self.d:
       oprot.writeI32(iter7)
     oprot.writeListEnd()
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 11
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, True],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, True],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeUnionBegin('UnionToBeRenamed')
     if self.field == 1:
         oprot.writeFieldBegin('reserved_field', TType.I32, 1)
         reserved_field = self.value
         oprot.writeI32(reserved_field)
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeUnionEnd()
Ejemplo n.º 12
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('MyStruct')
   if self.major != None:
     oprot.writeFieldBegin('major', TType.I64, 1)
     oprot.writeI64(self.major)
     oprot.writeFieldEnd()
   if self.package != None:
     oprot.writeFieldBegin('package', TType.STRING, 2)
     oprot.writeString(self.package.encode('utf-8')) if UTF8STRINGS and not isinstance(self.package, bytes) else oprot.writeString(self.package)
     oprot.writeFieldEnd()
   if self.annotation_with_quote != None:
     oprot.writeFieldBegin('annotation_with_quote', TType.STRING, 3)
     oprot.writeString(self.annotation_with_quote.encode('utf-8')) if UTF8STRINGS and not isinstance(self.annotation_with_quote, bytes) else oprot.writeString(self.annotation_with_quote)
     oprot.writeFieldEnd()
   if self.class_ != None:
     oprot.writeFieldBegin('class_', TType.STRING, 4)
     oprot.writeString(self.class_.encode('utf-8')) if UTF8STRINGS and not isinstance(self.class_, bytes) else oprot.writeString(self.class_)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 13
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeStructBegin('global_PY_RESERVED_KEYWORD_result')
     if self.success != None:
         oprot.writeFieldBegin('success', TType.BOOL, 0)
         oprot.writeBool(self.success)
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 14
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocol)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocol)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeStructBegin('MyStruct')
     if self.MyIncludedField != None:
         oprot.writeFieldBegin('MyIncludedField', TType.STRUCT, 1)
         self.MyIncludedField.write(oprot)
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 15
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('Foo')
   if self.mymap != None:
     oprot.writeFieldBegin('mymap', TType.MAP, 1)
     oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.mymap))
     sorted18 = self.mymap.items()
     sorted18 = sorted(sorted18, key=lambda tuple19: tuple19[0])
     for kiter16,viter17 in sorted18:
       oprot.writeString(kiter16.encode('utf-8')) if UTF8STRINGS and not isinstance(kiter16, bytes) else oprot.writeString(kiter16)
       oprot.writeString(viter17.encode('utf-8')) if UTF8STRINGS and not isinstance(viter17, bytes) else oprot.writeString(viter17)
     oprot.writeMapEnd()
     oprot.writeFieldEnd()
   if self.myset != None:
     oprot.writeFieldBegin('myset', TType.SET, 2)
     oprot.writeSetBegin(TType.STRING, len(self.myset))
     for iter20 in sorted(self.myset):
       oprot.writeString(iter20.encode('utf-8')) if UTF8STRINGS and not isinstance(iter20, bytes) else oprot.writeString(iter20)
     oprot.writeSetEnd()
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 16
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeStructBegin('SinkException2')
     if self.reason != None:
         oprot.writeFieldBegin('reason', TType.I64, 1)
         oprot.writeI64(self.reason)
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 17
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, True], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, True], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeUnionBegin('union2')
   if self.field == 1:
     oprot.writeFieldBegin('i', TType.I32, 1)
     i = self.value
     oprot.writeI32(i)
     oprot.writeFieldEnd()
   if self.field == 2:
     oprot.writeFieldBegin('d', TType.DOUBLE, 2)
     d = self.value
     oprot.writeDouble(d)
     oprot.writeFieldEnd()
   if self.field == 3:
     oprot.writeFieldBegin('s', TType.STRUCT, 3)
     s = self.value
     s.write(oprot)
     oprot.writeFieldEnd()
   if self.field == 4:
     oprot.writeFieldBegin('u', TType.STRUCT, 4)
     u = self.value
     u.write(oprot)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeUnionEnd()
Ejemplo n.º 18
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('struct2')
   if self.a != None:
     oprot.writeFieldBegin('a', TType.I32, 1)
     oprot.writeI32(self.a)
     oprot.writeFieldEnd()
   if self.b != None:
     oprot.writeFieldBegin('b', TType.STRING, 2)
     oprot.writeString(self.b.encode('utf-8')) if UTF8STRINGS and not isinstance(self.b, bytes) else oprot.writeString(self.b)
     oprot.writeFieldEnd()
   if self.c != None:
     oprot.writeFieldBegin('c', TType.STRUCT, 3)
     self.c.write(oprot)
     oprot.writeFieldEnd()
   if self.d != None:
     oprot.writeFieldBegin('d', TType.LIST, 4)
     oprot.writeListBegin(TType.I32, len(self.d))
     for iter7 in self.d:
       oprot.writeI32(iter7)
     oprot.writeListEnd()
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 19
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('Foo')
   if self.intField != None:
     oprot.writeFieldBegin('intField', TType.I32, 1)
     oprot.writeI32(self.intField)
     oprot.writeFieldEnd()
   if self.optionalIntField != None:
     oprot.writeFieldBegin('optionalIntField', TType.I32, 2)
     oprot.writeI32(self.optionalIntField)
     oprot.writeFieldEnd()
   if self.intFieldWithDefault != None:
     oprot.writeFieldBegin('intFieldWithDefault', TType.I32, 3)
     oprot.writeI32(self.intFieldWithDefault)
     oprot.writeFieldEnd()
   if self.setField != None:
     oprot.writeFieldBegin('setField', TType.SET, 4)
     oprot.writeSetBegin(TType.STRING, len(self.setField))
     for iter60 in self.setField:
       oprot.writeString(iter60.encode('utf-8')) if UTF8STRINGS and not isinstance(iter60, bytes) else oprot.writeString(iter60)
     oprot.writeSetEnd()
     oprot.writeFieldEnd()
   if self.optionalSetField != None:
     oprot.writeFieldBegin('optionalSetField', TType.SET, 5)
     oprot.writeSetBegin(TType.STRING, len(self.optionalSetField))
     for iter61 in self.optionalSetField:
       oprot.writeString(iter61.encode('utf-8')) if UTF8STRINGS and not isinstance(iter61, bytes) else oprot.writeString(iter61)
     oprot.writeSetEnd()
     oprot.writeFieldEnd()
   if self.mapField != None:
     oprot.writeFieldBegin('mapField', TType.MAP, 6)
     oprot.writeMapBegin(TType.STRING, TType.LIST, len(self.mapField))
     for kiter62,viter63 in self.mapField.items():
       oprot.writeString(kiter62.encode('utf-8')) if UTF8STRINGS and not isinstance(kiter62, bytes) else oprot.writeString(kiter62)
       oprot.writeListBegin(TType.STRING, len(viter63))
       for iter64 in viter63:
         oprot.writeString(iter64.encode('utf-8')) if UTF8STRINGS and not isinstance(iter64, bytes) else oprot.writeString(iter64)
       oprot.writeListEnd()
     oprot.writeMapEnd()
     oprot.writeFieldEnd()
   if self.optionalMapField != None:
     oprot.writeFieldBegin('optionalMapField', TType.MAP, 7)
     oprot.writeMapBegin(TType.STRING, TType.LIST, len(self.optionalMapField))
     for kiter65,viter66 in self.optionalMapField.items():
       oprot.writeString(kiter65.encode('utf-8')) if UTF8STRINGS and not isinstance(kiter65, bytes) else oprot.writeString(kiter65)
       oprot.writeListBegin(TType.STRING, len(viter66))
       for iter67 in viter66:
         oprot.writeString(iter67.encode('utf-8')) if UTF8STRINGS and not isinstance(iter67, bytes) else oprot.writeString(iter67)
       oprot.writeListEnd()
     oprot.writeMapEnd()
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 20
0
 def write(self, oprot):
   if (oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated or (oprot.__class__ == THeaderProtocol.THeaderProtocol and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastbinary is not None:
     oprot.trans.write(fastbinary.encode_binary(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS))
     return
   if (oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated or (oprot.__class__ == THeaderProtocol.THeaderProtocol and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (oprot.__class__ == TCompactProtocol.TCompactProtocolAccelerated or (oprot.__class__ == THeaderProtocol.THeaderProtocol and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('init_args')
   if self.int1 != None:
     oprot.writeFieldBegin('int1', TType.I64, 1)
     oprot.writeI64(self.int1)
     oprot.writeFieldEnd()
   if self.int2 != None:
     oprot.writeFieldBegin('int2', TType.I64, 2)
     oprot.writeI64(self.int2)
     oprot.writeFieldEnd()
   if self.int3 != None:
     oprot.writeFieldBegin('int3', TType.I64, 3)
     oprot.writeI64(self.int3)
     oprot.writeFieldEnd()
   if self.int4 != None:
     oprot.writeFieldBegin('int4', TType.I64, 4)
     oprot.writeI64(self.int4)
     oprot.writeFieldEnd()
   if self.int5 != None:
     oprot.writeFieldBegin('int5', TType.I64, 5)
     oprot.writeI64(self.int5)
     oprot.writeFieldEnd()
   if self.int6 != None:
     oprot.writeFieldBegin('int6', TType.I64, 6)
     oprot.writeI64(self.int6)
     oprot.writeFieldEnd()
   if self.int7 != None:
     oprot.writeFieldBegin('int7', TType.I64, 7)
     oprot.writeI64(self.int7)
     oprot.writeFieldEnd()
   if self.int8 != None:
     oprot.writeFieldBegin('int8', TType.I64, 8)
     oprot.writeI64(self.int8)
     oprot.writeFieldEnd()
   if self.int9 != None:
     oprot.writeFieldBegin('int9', TType.I64, 9)
     oprot.writeI64(self.int9)
     oprot.writeFieldEnd()
   if self.int10 != None:
     oprot.writeFieldBegin('int10', TType.I64, 10)
     oprot.writeI64(self.int10)
     oprot.writeFieldEnd()
   if self.int11 != None:
     oprot.writeFieldBegin('int11', TType.I64, 11)
     oprot.writeI64(self.int11)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 21
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('getResult_args')
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 22
0
 def write(self, oprot):
     if (
         (
             oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated
             or (
                 oprot.__class__ == THeaderProtocol.THeaderProtocol
                 and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL
             )
         )
         and self.thrift_spec is not None
         and fastbinary is not None
     ):
         oprot.trans.write(
             fastbinary.encode_binary(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS)
         )
         return
     if (
         (
             oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated
             or (
                 oprot.__class__ == THeaderProtocol.THeaderProtocol
                 and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL
             )
         )
         and self.thrift_spec is not None
         and fastproto is not None
     ):
         oprot.trans.write(
             fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)
         )
         return
     if (
         (
             oprot.__class__ == TCompactProtocol.TCompactProtocolAccelerated
             or (
                 oprot.__class__ == THeaderProtocol.THeaderProtocol
                 and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL
             )
         )
         and self.thrift_spec is not None
         and fastproto is not None
     ):
         oprot.trans.write(
             fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)
         )
         return
     oprot.writeStructBegin("init_result")
     if self.success != None:
         oprot.writeFieldBegin("success", TType.I64, 0)
         oprot.writeI64(self.success)
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 23
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeStructBegin('Fields')
     if self.injected_field != None:
         oprot.writeFieldBegin('injected_field', TType.STRING, 100)
         oprot.writeString(self.injected_field.encode(
             'utf-8')) if UTF8STRINGS and not isinstance(
                 self.injected_field, bytes) else oprot.writeString(
                     self.injected_field)
         oprot.writeFieldEnd()
     if self.injected_structured_annotation_field != None:
         oprot.writeFieldBegin('injected_structured_annotation_field',
                               TType.STRING, 101)
         oprot.writeString(
             self.injected_structured_annotation_field.encode(
                 'utf-8')) if UTF8STRINGS and not isinstance(
                     self.injected_structured_annotation_field,
                     bytes) else oprot.writeString(
                         self.injected_structured_annotation_field)
         oprot.writeFieldEnd()
     if self.injected_unstructured_annotation_field != None:
         oprot.writeFieldBegin('injected_unstructured_annotation_field',
                               TType.STRING, 102)
         oprot.writeString(
             self.injected_unstructured_annotation_field.encode(
                 'utf-8')) if UTF8STRINGS and not isinstance(
                     self.injected_unstructured_annotation_field,
                     bytes) else oprot.writeString(
                         self.injected_unstructured_annotation_field)
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 24
0
 def write(self, oprot):
     if (oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated or
         (oprot.__class__ == THeaderProtocol.THeaderProtocol
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastbinary is not None:
         oprot.trans.write(
             fastbinary.encode_binary(
                 self, [self.__class__, self.thrift_spec, False],
                 utf8strings=UTF8STRINGS))
         return
     if (oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated or
         (oprot.__class__ == THeaderProtocol.THeaderProtocol
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (oprot.__class__ == TCompactProtocol.TCompactProtocolAccelerated or
         (oprot.__class__ == THeaderProtocol.THeaderProtocol
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeStructBegin('Internship')
     if self.weeks != None:
         oprot.writeFieldBegin('weeks', TType.I32, 1)
         oprot.writeI32(self.weeks)
         oprot.writeFieldEnd()
     if self.title != None:
         oprot.writeFieldBegin('title', TType.STRING, 2)
         oprot.writeString(
             self.title.encode('utf-8')) if UTF8STRINGS and not isinstance(
                 self.title, bytes) else oprot.writeString(self.title)
         oprot.writeFieldEnd()
     if self.employer != None:
         oprot.writeFieldBegin('employer', TType.I32, 3)
         oprot.writeI32(self.employer)
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 25
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('simple_rpc_args')
   if self.int_parameter != None:
     oprot.writeFieldBegin('int_parameter', TType.I32, 1)
     oprot.writeI32(self.int_parameter)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 26
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('isPrime_result')
   if self.success != None:
     oprot.writeFieldBegin('success', TType.BOOL, 0)
     oprot.writeBool(self.success)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 27
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, True],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, True],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeUnionBegin('MyUnion')
     if self.field == 1:
         oprot.writeFieldBegin('myEnum', TType.I32, 1)
         myEnum = self.value
         oprot.writeI32(myEnum)
         oprot.writeFieldEnd()
     if self.field == 2:
         oprot.writeFieldBegin('myStruct', TType.STRUCT, 2)
         myStruct = self.value
         myStruct.write(oprot)
         oprot.writeFieldEnd()
     if self.field == 3:
         oprot.writeFieldBegin('myDataItem', TType.STRUCT, 3)
         myDataItem = self.value
         myDataItem.write(oprot)
         oprot.writeFieldEnd()
     if self.field == 4:
         oprot.writeFieldBegin('floatSet', TType.SET, 4)
         floatSet = self.value
         oprot.writeSetBegin(TType.FLOAT, len(floatSet))
         for iter16 in floatSet:
             oprot.writeFloat(iter16)
         oprot.writeSetEnd()
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeUnionEnd()
Ejemplo n.º 28
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, True],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, True],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeUnionBegin('Value')
     if self.field == 1:
         oprot.writeFieldBegin('int_value', TType.I64, 1)
         int_value = self.value
         oprot.writeI64(int_value)
         oprot.writeFieldEnd()
     if self.field == 2:
         oprot.writeFieldBegin('bool_value', TType.BOOL, 2)
         bool_value = self.value
         oprot.writeBool(bool_value)
         oprot.writeFieldEnd()
     if self.field == 3:
         oprot.writeFieldBegin('double_value', TType.DOUBLE, 3)
         double_value = self.value
         oprot.writeDouble(double_value)
         oprot.writeFieldEnd()
     if self.field == 4:
         oprot.writeFieldBegin('string_value', TType.STRING, 4)
         string_value = self.value
         oprot.writeString(string_value.encode(
             'utf-8')) if UTF8STRINGS and not isinstance(
                 string_value, bytes) else oprot.writeString(string_value)
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeUnionEnd()
Ejemplo n.º 29
0
def memory_usage_fastproto():
    hp = hpy()
    trans = TDevNullTransport()
    global ooe
    for pid in (0, 2):
        before = hp.heap()
        for i in range(iters):
            buf = fastproto.encode(ooe,
                                   [OneOfEach, OneOfEach.thrift_spec, False],
                                   utf8strings=0,
                                   protoid=pid)
            trans.write(buf)
        gc.collect()
        after = hp.heap()
        leftover = after - before
        print("Memory leftover after running fastproto.encode with "
              "protocol id {0} for {1} times".format(pid, iters))
        print(leftover)

    for pid in (0, 2):
        before = hp.heap()
        for i in range(iters):
            trans = TTransport.TMemoryBuffer(binary_buf if pid ==
                                             0 else compact_buf)
            ooe_local = OneOfEach()
            fastproto.decode(ooe_local,
                             trans, [OneOfEach, OneOfEach.thrift_spec, False],
                             utf8strings=0,
                             protoid=pid)
        gc.collect()
        after = hp.heap()
        leftover = after - before
        print("Memory leftover after running fastproto.decode with "
              "protocol id {0} for {1} times".format(pid, iters))
        print(leftover)
Ejemplo n.º 30
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('Bar')
   if self.structField != None:
     oprot.writeFieldBegin('structField', TType.STRUCT, 1)
     adpt134 = my.Adapter1.to_thrift(self.structField)
     adpt134.write(oprot)
     oprot.writeFieldEnd()
   if self.optionalStructField != None:
     oprot.writeFieldBegin('optionalStructField', TType.STRUCT, 2)
     adpt135 = my.Adapter1.to_thrift(self.optionalStructField)
     adpt135.write(oprot)
     oprot.writeFieldEnd()
   if self.structListField != None:
     oprot.writeFieldBegin('structListField', TType.LIST, 3)
     oprot.writeListBegin(TType.STRUCT, len(self.structListField))
     for iter136 in self.structListField:
       adpt137 = my.Adapter1.to_thrift(iter136)
       adpt137.write(oprot)
     oprot.writeListEnd()
     oprot.writeFieldEnd()
   if self.optionalStructListField != None:
     oprot.writeFieldBegin('optionalStructListField', TType.LIST, 4)
     oprot.writeListBegin(TType.STRUCT, len(self.optionalStructListField))
     for iter138 in self.optionalStructListField:
       adpt139 = my.Adapter1.to_thrift(iter138)
       adpt139.write(oprot)
     oprot.writeListEnd()
     oprot.writeFieldEnd()
   if self.unionField != None:
     oprot.writeFieldBegin('unionField', TType.STRUCT, 5)
     adpt140 = my.Adapter1.to_thrift(self.unionField)
     adpt140.write(oprot)
     oprot.writeFieldEnd()
   if self.optionalUnionField != None:
     oprot.writeFieldBegin('optionalUnionField', TType.STRUCT, 6)
     adpt141 = my.Adapter1.to_thrift(self.optionalUnionField)
     adpt141.write(oprot)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 31
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastbinary is not None:
     oprot.trans.write(fastbinary.encode_binary(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS))
     return
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('count_activity_args')
   if self.context_id != None:
     oprot.writeFieldBegin('context_id', TType.STRING, 1)
     oprot.writeString(self.context_id.encode('utf-8')) if UTF8STRINGS and not isinstance(self.context_id, bytes) else oprot.writeString(self.context_id)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 32
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastbinary is not None:
     oprot.trans.write(fastbinary.encode_binary(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS))
     return
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('Included')
   if self.MyIntField != None:
     oprot.writeFieldBegin('MyIntField', TType.I64, 1)
     oprot.writeI64(self.MyIntField)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 33
0
 def write(self, oprot):
   if (oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated or (oprot.__class__ == THeaderProtocol.THeaderProtocol and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastbinary is not None:
     oprot.trans.write(fastbinary.encode_binary(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS))
     return
   if (oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated or (oprot.__class__ == THeaderProtocol.THeaderProtocol and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (oprot.__class__ == TCompactProtocol.TCompactProtocolAccelerated or (oprot.__class__ == THeaderProtocol.THeaderProtocol and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('init_result')
   if self.success != None:
     oprot.writeFieldBegin('success', TType.I64, 0)
     oprot.writeI64(self.success)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 34
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('UnionEnumAttributes')
   if self.attributes != None:
     oprot.writeFieldBegin('attributes', TType.LIST, 1)
     oprot.writeListBegin(TType.STRING, len(self.attributes))
     for iter7 in self.attributes:
       oprot.writeString(iter7.encode('utf-8')) if UTF8STRINGS and not isinstance(iter7, bytes) else oprot.writeString(iter7)
     oprot.writeListEnd()
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 35
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeStructBegin('MyStructAnnotation')
     if self.count != None:
         oprot.writeFieldBegin('count', TType.I64, 1)
         oprot.writeI64(self.count)
         oprot.writeFieldEnd()
     if self.name != None:
         oprot.writeFieldBegin('name', TType.STRING, 2)
         oprot.writeString(
             self.name.encode('utf-8')) if UTF8STRINGS and not isinstance(
                 self.name, bytes) else oprot.writeString(self.name)
         oprot.writeFieldEnd()
     if self.extra != None:
         oprot.writeFieldBegin('extra', TType.STRING, 3)
         oprot.writeString(
             self.extra.encode('utf-8')) if UTF8STRINGS and not isinstance(
                 self.extra, bytes) else oprot.writeString(self.extra)
         oprot.writeFieldEnd()
     if self.nest != None:
         oprot.writeFieldBegin('nest', TType.STRUCT, 4)
         self.nest.write(oprot)
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 36
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('Range')
   if self.min != None:
     oprot.writeFieldBegin('min', TType.I32, 1)
     oprot.writeI32(self.min)
     oprot.writeFieldEnd()
   if self.max != None:
     oprot.writeFieldBegin('max', TType.I32, 2)
     oprot.writeI32(self.max)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 37
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('OldStructure')
   if self.features != None:
     oprot.writeFieldBegin('features', TType.MAP, 1)
     oprot.writeMapBegin(TType.I16, TType.DOUBLE, len(self.features))
     for kiter9,viter10 in self.features.items():
       oprot.writeI16(kiter9)
       oprot.writeDouble(viter10)
     oprot.writeMapEnd()
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 38
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('CustomFieldNames')
   if self.error_message != None:
     oprot.writeFieldBegin('error_message', TType.STRING, 1)
     oprot.writeString(self.error_message.encode('utf-8')) if UTF8STRINGS and not isinstance(self.error_message, bytes) else oprot.writeString(self.error_message)
     oprot.writeFieldEnd()
   if self.internal_error_message != None:
     oprot.writeFieldBegin('internal_error_message', TType.STRING, 2)
     oprot.writeString(self.internal_error_message.encode('utf-8')) if UTF8STRINGS and not isinstance(self.internal_error_message, bytes) else oprot.writeString(self.internal_error_message)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 39
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('authenticate_args')
   if self.username != None:
     oprot.writeFieldBegin('username', TType.STRING, 1)
     oprot.writeString(self.username.encode('utf-8')) if UTF8STRINGS and not isinstance(self.username, bytes) else oprot.writeString(self.username)
     oprot.writeFieldEnd()
   if self.password != None:
     oprot.writeFieldBegin('password', TType.STRING, 2)
     oprot.writeString(self.password.encode('utf-8')) if UTF8STRINGS and not isinstance(self.password, bytes) else oprot.writeString(self.password)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 40
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('TestStruct')
   if self.aLong != None:
     oprot.writeFieldBegin('aLong', TType.I64, 1)
     oprot.writeI64(self.aLong)
     oprot.writeFieldEnd()
   if self.aString != None:
     oprot.writeFieldBegin('aString', TType.STRING, 2)
     oprot.writeString(self.aString.encode('utf-8')) if UTF8STRINGS and not isinstance(self.aString, bytes) else oprot.writeString(self.aString)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 41
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('NewStructureNested')
   if self.lst != None:
     oprot.writeFieldBegin('lst', TType.LIST, 1)
     oprot.writeListBegin(TType.MAP, len(self.lst))
     for iter110 in self.lst:
       oprot.writeMapBegin(TType.I16, TType.FLOAT, len(iter110))
       for kiter111,viter112 in iter110.items():
         oprot.writeI16(kiter111)
         oprot.writeFloat(viter112)
       oprot.writeMapEnd()
     oprot.writeListEnd()
     oprot.writeFieldEnd()
   if self.mp != None:
     oprot.writeFieldBegin('mp', TType.MAP, 2)
     oprot.writeMapBegin(TType.I16, TType.MAP, len(self.mp))
     for kiter113,viter114 in self.mp.items():
       oprot.writeI16(kiter113)
       oprot.writeMapBegin(TType.I16, TType.FLOAT, len(viter114))
       for kiter115,viter116 in viter114.items():
         oprot.writeI16(kiter115)
         oprot.writeFloat(viter116)
       oprot.writeMapEnd()
     oprot.writeMapEnd()
     oprot.writeFieldEnd()
   if self.s != None:
     oprot.writeFieldBegin('s', TType.SET, 3)
     oprot.writeSetBegin(TType.MAP, len(self.s))
     for iter117 in self.s:
       oprot.writeMapBegin(TType.I16, TType.FLOAT, len(iter117))
       for kiter118,viter119 in iter117.items():
         oprot.writeI16(kiter118)
         oprot.writeFloat(viter119)
       oprot.writeMapEnd()
     oprot.writeSetEnd()
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 42
0
 def write(self, oprot):
     if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=0))
         return
     if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or
         (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate)
          and oprot.get_protocol_id()
          == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)
         ) and self.thrift_spec is not None and fastproto is not None:
         oprot.trans.write(
             fastproto.encode(self,
                              [self.__class__, self.thrift_spec, False],
                              utf8strings=UTF8STRINGS,
                              protoid=2))
         return
     oprot.writeStructBegin('func_args')
     if self.arg1 != None:
         oprot.writeFieldBegin('arg1', TType.STRING, 1)
         oprot.writeString(
             self.arg1.encode('utf-8')) if UTF8STRINGS and not isinstance(
                 self.arg1, bytes) else oprot.writeString(self.arg1)
         oprot.writeFieldEnd()
     if self.arg2 != None:
         oprot.writeFieldBegin('arg2', TType.STRING, 2)
         oprot.writeString(
             self.arg2.encode('utf-8')) if UTF8STRINGS and not isinstance(
                 self.arg2, bytes) else oprot.writeString(self.arg2)
         oprot.writeFieldEnd()
     if self.arg3 != None:
         oprot.writeFieldBegin('arg3', TType.STRUCT, 3)
         self.arg3.write(oprot)
         oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
Ejemplo n.º 43
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('Device')
   if self.hostname != None:
     oprot.writeFieldBegin('hostname', TType.STRING, 1)
     oprot.writeString(self.hostname.encode('utf-8')) if UTF8STRINGS and not isinstance(self.hostname, bytes) else oprot.writeString(self.hostname)
     oprot.writeFieldEnd()
   if self.username != None:
     oprot.writeFieldBegin('username', TType.STRING, 10)
     oprot.writeString(self.username.encode('utf-8')) if UTF8STRINGS and not isinstance(self.username, bytes) else oprot.writeString(self.username)
     oprot.writeFieldEnd()
   if self.password != None:
     oprot.writeFieldBegin('password', TType.STRING, 11)
     oprot.writeString(self.password.encode('utf-8')) if UTF8STRINGS and not isinstance(self.password, bytes) else oprot.writeString(self.password)
     oprot.writeFieldEnd()
   if self.console != None and self.console != self.thrift_spec[13][4]:
     oprot.writeFieldBegin('console', TType.STRING, 13)
     oprot.writeString(self.console.encode('utf-8')) if UTF8STRINGS and not isinstance(self.console, bytes) else oprot.writeString(self.console)
     oprot.writeFieldEnd()
   if self.mgmt_ip != None and self.mgmt_ip != self.thrift_spec[14][4]:
     oprot.writeFieldBegin('mgmt_ip', TType.BOOL, 14)
     oprot.writeBool(self.mgmt_ip)
     oprot.writeFieldEnd()
   if self.command_prompts != None:
     oprot.writeFieldBegin('command_prompts', TType.MAP, 15)
     oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.command_prompts))
     for kiter9,viter10 in self.command_prompts.items():
       oprot.writeString(kiter9.encode('utf-8')) if UTF8STRINGS and not isinstance(kiter9, bytes) else oprot.writeString(kiter9)
       oprot.writeString(viter10.encode('utf-8')) if UTF8STRINGS and not isinstance(viter10, bytes) else oprot.writeString(viter10)
     oprot.writeMapEnd()
     oprot.writeFieldEnd()
   if self.ip_address != None:
     oprot.writeFieldBegin('ip_address', TType.STRING, 16)
     oprot.writeString(self.ip_address.encode('utf-8')) if UTF8STRINGS and not isinstance(self.ip_address, bytes) else oprot.writeString(self.ip_address)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 44
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastbinary is not None:
     oprot.trans.write(fastbinary.encode_binary(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS))
     return
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('ActivityInfo')
   if self.count != None:
     oprot.writeFieldBegin('count', TType.I32, 1)
     oprot.writeI32(self.count)
     oprot.writeFieldEnd()
   if self.is_fuzzed != None:
     oprot.writeFieldBegin('is_fuzzed', TType.BOOL, 2)
     oprot.writeBool(self.is_fuzzed)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 45
0
 def write(self, oprot):
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastbinary is not None:
     oprot.trans.write(fastbinary.encode_binary(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS))
     return
   if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0))
     return
   if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocol) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None:
     oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2))
     return
   oprot.writeStructBegin('count_activity_result')
   if self.success != None:
     oprot.writeFieldBegin('success', TType.STRUCT, 0)
     self.success.write(oprot)
     oprot.writeFieldEnd()
   if self.invalid_context_id != None:
     oprot.writeFieldBegin('invalid_context_id', TType.STRUCT, 1)
     self.invalid_context_id.write(oprot)
     oprot.writeFieldEnd()
   oprot.writeFieldStop()
   oprot.writeStructEnd()
Ejemplo n.º 46
0
    def encode_helper(self, obj):
        buf = fastproto.encode(obj, [obj.__class__, obj.thrift_spec, obj.isUnion()], utf8strings=0, protoid=self.PROTO)

        trans = TMemoryBuffer(buf)
        if self.PROTO == 0:
            proto = TBinaryProtocol.TBinaryProtocol(trans)
        else:
            proto = TCompactProtocol.TCompactProtocol(trans)

        obj_new = obj.__class__()
        obj_new.read(proto)
        self.assertEqual(obj, obj_new)
Ejemplo n.º 47
0
def fastproto_encode(q, protoid):
    hp = hpy()
    trans = TDevNullTransport()
    p = psutil.Process(os.getpid())

    global ooe
    before = hp.heap()
    for i in range(iters):
        buf = fastproto.encode(
                ooe,
                [OneOfEach, OneOfEach.thrift_spec, False],
                utf8strings=0,
                protoid=protoid)
        trans.write(buf)
        if (i + 1) % 100000 == 0:
            q.put((i + 1, p.memory_info()))

    gc.collect()
    after = hp.heap()
    leftover = after - before
    q.put("Memory leftover in Python after {} times: {}".format(
        iters, leftover))
Ejemplo n.º 48
0
def memory_usage_fastproto():
    hp = hpy()
    trans = TDevNullTransport()
    global ooe
    for pid in (0, 2):
        before = hp.heap()
        for i in range(iters):
            buf = fastproto.encode(
                    ooe,
                    [OneOfEach, OneOfEach.thrift_spec, False],
                    utf8strings=0,
                    protoid=pid)
            trans.write(buf)
        gc.collect()
        after = hp.heap()
        leftover = after - before
        print("Memory leftover after running fastproto.encode with "
                "protocol id {0} for {1} times".format(pid, iters))
        print(leftover)

    for pid in (0, 2):
        before = hp.heap()
        for i in range(iters):
            trans = TTransport.TMemoryBuffer(
                    binary_buf if pid == 0 else compact_buf)
            ooe_local = OneOfEach()
            fastproto.decode(
                    ooe_local,
                    trans,
                    [OneOfEach, OneOfEach.thrift_spec, False],
                    utf8strings=0,
                    protoid=pid)
        gc.collect()
        after = hp.heap()
        leftover = after - before
        print("Memory leftover after running fastproto.decode with "
                "protocol id {0} for {1} times".format(pid, iters))
        print(leftover)