def __init__(self, contents=None): self.attachments_ = MessageSet() self.has_attachments_ = 0 if contents is not None: self.MergeFromString(contents)
class DocAttachments(ProtocolBuffer.ProtocolMessage): def __init__(self, contents=None): self.attachments_ = MessageSet() self.has_attachments_ = 0 if contents is not None: self.MergeFromString(contents) def attachments(self): return self.attachments_ def mutable_attachments(self): self.has_attachments_ = 1; return self.attachments_ def clear_attachments(self):self.has_attachments_ = 0; self.attachments_.Clear() def has_attachments(self): return self.has_attachments_ def MergeFrom(self, x): assert x is not self if (x.has_attachments()): self.mutable_attachments().MergeFrom(x.attachments()) def _CMergeFromString(self, s): _net_proto___parse__python.MergeFromString(self, 'DocAttachments', s) def _CEncode(self): return _net_proto___parse__python.Encode(self, 'DocAttachments') def _CToASCII(self, output_format): return _net_proto___parse__python.ToASCII(self, 'DocAttachments', output_format) def ParseASCII(self, s): _net_proto___parse__python.ParseASCII(self, 'DocAttachments', s) def ParseASCIIIgnoreUnknown(self, s): _net_proto___parse__python.ParseASCIIIgnoreUnknown(self, 'DocAttachments', s) def Equals(self, x): if x is self: return 1 if self.has_attachments_ != x.has_attachments_: return 0 if self.has_attachments_ and self.attachments_ != x.attachments_: return 0 return 1 def __eq__(self, other): return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) def __ne__(self, other): return not (self == other) def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_attachments_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: attachments not set.') elif not self.attachments_.IsInitialized(debug_strs): initialized = 0 return initialized def ByteSize(self): n = 0 n += self.lengthString(self.attachments_.ByteSize()) return n + 1 def Clear(self): self.clear_attachments() def OutputUnchecked(self, out): out.putVarInt32(10) out.putVarInt32(self.attachments_.ByteSize()) self.attachments_.OutputUnchecked(out) def TryMerge(self, d): while d.avail() > 0: tt = d.getVarInt32() if tt == 10: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.mutable_attachments().TryMerge(tmp) continue # tag 0 is special: it's used to indicate an error. # so if we see it we raise an exception. if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_attachments_: res+=prefix+"attachments <\n" res+=self.attachments_.__str__(prefix + " ", printElemNumber) res+=prefix+">\n" return res kattachments = 1 _TEXT = ( "ErrorCode", # 0 "attachments", # 1 ) _TYPES = ( ProtocolBuffer.Encoder.NUMERIC, # 0 ProtocolBuffer.Encoder.STRING, # 1 ) # stylesheet for XML output _STYLE = \ """""" _STYLE_CONTENT_TYPE = \ """""" _SERIALIZED_DESCRIPTOR = array.array('B', [ 0x5a, 0x24, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x64, 0x6f, 0x63, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x0e, 0x44, 0x6f, 0x63, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x13, 0x1a, 0x0b, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x01, 0x28, 0x02, 0x30, 0x0b, 0x38, 0x02, 0x4a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x14, ]) _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())