def __init__(self, contents=None): self.key_ = Reference() if contents is not None: self.MergeFromString(contents)
class TransactionRequest_Precondition(ProtocolBuffer.ProtocolMessage): has_key_ = 0 has_hash_ = 0 hash_ = "" def __init__(self, contents=None): self.key_ = Reference() if contents is not None: self.MergeFromString(contents) def key(self): return self.key_ def mutable_key(self): self.has_key_ = 1 return self.key_ def clear_key(self): self.has_key_ = 0 self.key_.Clear() def has_key(self): return self.has_key_ def hash(self): return self.hash_ def set_hash(self, x): self.has_hash_ = 1 self.hash_ = x def clear_hash(self): if self.has_hash_: self.has_hash_ = 0 self.hash_ = "" def has_hash(self): return self.has_hash_ def MergeFrom(self, x): assert x is not self if (x.has_key()): self.mutable_key().MergeFrom(x.key()) if (x.has_hash()): self.set_hash(x.hash()) def Equals(self, x): if x is self: return 1 if self.has_key_ != x.has_key_: return 0 if self.has_key_ and self.key_ != x.key_: return 0 if self.has_hash_ != x.has_hash_: return 0 if self.has_hash_ and self.hash_ != x.hash_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_key_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: key not set.') elif not self.key_.IsInitialized(debug_strs): initialized = 0 return initialized def ByteSize(self): n = 0 n += self.lengthString(self.key_.ByteSize()) if (self.has_hash_): n += 1 + self.lengthString(len(self.hash_)) return n + 1 def ByteSizePartial(self): n = 0 if (self.has_key_): n += 1 n += self.lengthString(self.key_.ByteSizePartial()) if (self.has_hash_): n += 1 + self.lengthString(len(self.hash_)) return n def Clear(self): self.clear_key() self.clear_hash() def OutputUnchecked(self, out): out.putVarInt32(18) out.putVarInt32(self.key_.ByteSize()) self.key_.OutputUnchecked(out) if (self.has_hash_): out.putVarInt32(26) out.putPrefixedString(self.hash_) def OutputPartial(self, out): if (self.has_key_): out.putVarInt32(18) out.putVarInt32(self.key_.ByteSizePartial()) self.key_.OutputPartial(out) if (self.has_hash_): out.putVarInt32(26) out.putPrefixedString(self.hash_) def TryMerge(self, d): while 1: tt = d.getVarInt32() if tt == 12: break if tt == 18: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.mutable_key().TryMerge(tmp) continue if tt == 26: self.set_hash(d.getPrefixedString()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res = "" if self.has_key_: res += prefix + "key <\n" res += self.key_.__str__(prefix + " ", printElemNumber) res += prefix + ">\n" if self.has_hash_: res += prefix + ("hash: %s\n" % self.DebugFormatString(self.hash_)) return res
class TransactionRequest_Precondition(ProtocolBuffer.ProtocolMessage): has_key_ = 0 has_hash_ = 0 hash_ = "" def __init__(self, contents=None): self.key_ = Reference() if contents is not None: self.MergeFromString(contents) def key(self): return self.key_ def mutable_key(self): self.has_key_ = 1; return self.key_ def clear_key(self):self.has_key_ = 0; self.key_.Clear() def has_key(self): return self.has_key_ def hash(self): return self.hash_ def set_hash(self, x): self.has_hash_ = 1 self.hash_ = x def clear_hash(self): if self.has_hash_: self.has_hash_ = 0 self.hash_ = "" def has_hash(self): return self.has_hash_ def MergeFrom(self, x): assert x is not self if (x.has_key()): self.mutable_key().MergeFrom(x.key()) if (x.has_hash()): self.set_hash(x.hash()) def Equals(self, x): if x is self: return 1 if self.has_key_ != x.has_key_: return 0 if self.has_key_ and self.key_ != x.key_: return 0 if self.has_hash_ != x.has_hash_: return 0 if self.has_hash_ and self.hash_ != x.hash_: return 0 return 1 def IsInitialized(self, debug_strs=None): initialized = 1 if (not self.has_key_): initialized = 0 if debug_strs is not None: debug_strs.append('Required field: key not set.') elif not self.key_.IsInitialized(debug_strs): initialized = 0 return initialized def ByteSize(self): n = 0 n += self.lengthString(self.key_.ByteSize()) if (self.has_hash_): n += 1 + self.lengthString(len(self.hash_)) return n + 1 def ByteSizePartial(self): n = 0 if (self.has_key_): n += 1 n += self.lengthString(self.key_.ByteSizePartial()) if (self.has_hash_): n += 1 + self.lengthString(len(self.hash_)) return n def Clear(self): self.clear_key() self.clear_hash() def OutputUnchecked(self, out): out.putVarInt32(18) out.putVarInt32(self.key_.ByteSize()) self.key_.OutputUnchecked(out) if (self.has_hash_): out.putVarInt32(26) out.putPrefixedString(self.hash_) def OutputPartial(self, out): if (self.has_key_): out.putVarInt32(18) out.putVarInt32(self.key_.ByteSizePartial()) self.key_.OutputPartial(out) if (self.has_hash_): out.putVarInt32(26) out.putPrefixedString(self.hash_) def TryMerge(self, d): while 1: tt = d.getVarInt32() if tt == 12: break if tt == 18: length = d.getVarInt32() tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) d.skip(length) self.mutable_key().TryMerge(tmp) continue if tt == 26: self.set_hash(d.getPrefixedString()) continue if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError d.skipData(tt) def __str__(self, prefix="", printElemNumber=0): res="" if self.has_key_: res+=prefix+"key <\n" res+=self.key_.__str__(prefix + " ", printElemNumber) res+=prefix+">\n" if self.has_hash_: res+=prefix+("hash: %s\n" % self.DebugFormatString(self.hash_)) return res