thirdparty/google_appengine/google/appengine/ext/remote_api/remote_api_pb.py
changeset 2864 2e0b0af889be
parent 1278 a7766286a7be
equal deleted inserted replaced
2862:27971a13089f 2864:2e0b0af889be
   153       res+=prefix+"request <\n"
   153       res+=prefix+"request <\n"
   154       res+=self.request_.__str__(prefix + "  ", printElemNumber)
   154       res+=self.request_.__str__(prefix + "  ", printElemNumber)
   155       res+=prefix+">\n"
   155       res+=prefix+">\n"
   156     return res
   156     return res
   157 
   157 
       
   158 
       
   159   def _BuildTagLookupTable(sparse, maxtag, default=None):
       
   160     return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
       
   161 
   158   kservice_name = 2
   162   kservice_name = 2
   159   kmethod = 3
   163   kmethod = 3
   160   krequest = 4
   164   krequest = 4
   161 
   165 
   162   _TEXT = (
   166   _TEXT = _BuildTagLookupTable({
   163    "ErrorCode",
   167     0: "ErrorCode",
   164    None,
   168     2: "service_name",
   165    "service_name",
   169     3: "method",
   166    "method",
   170     4: "request",
   167    "request",
   171   }, 4)
   168   )
   172 
   169 
   173   _TYPES = _BuildTagLookupTable({
   170   _TYPES = (
   174     0: ProtocolBuffer.Encoder.NUMERIC,
   171    ProtocolBuffer.Encoder.NUMERIC,
   175     2: ProtocolBuffer.Encoder.STRING,
   172    ProtocolBuffer.Encoder.MAX_TYPE,
   176     3: ProtocolBuffer.Encoder.STRING,
   173 
   177     4: ProtocolBuffer.Encoder.STRING,
   174    ProtocolBuffer.Encoder.STRING,
   178   }, 4, ProtocolBuffer.Encoder.MAX_TYPE)
   175 
   179 
   176    ProtocolBuffer.Encoder.STRING,
   180   _STYLE = """"""
   177 
   181   _STYLE_CONTENT_TYPE = """"""
   178    ProtocolBuffer.Encoder.STRING,
   182 class ApplicationError(ProtocolBuffer.ProtocolMessage):
   179 
   183   has_code_ = 0
   180   )
   184   code_ = 0
       
   185   has_detail_ = 0
       
   186   detail_ = ""
       
   187 
       
   188   def __init__(self, contents=None):
       
   189     if contents is not None: self.MergeFromString(contents)
       
   190 
       
   191   def code(self): return self.code_
       
   192 
       
   193   def set_code(self, x):
       
   194     self.has_code_ = 1
       
   195     self.code_ = x
       
   196 
       
   197   def clear_code(self):
       
   198     if self.has_code_:
       
   199       self.has_code_ = 0
       
   200       self.code_ = 0
       
   201 
       
   202   def has_code(self): return self.has_code_
       
   203 
       
   204   def detail(self): return self.detail_
       
   205 
       
   206   def set_detail(self, x):
       
   207     self.has_detail_ = 1
       
   208     self.detail_ = x
       
   209 
       
   210   def clear_detail(self):
       
   211     if self.has_detail_:
       
   212       self.has_detail_ = 0
       
   213       self.detail_ = ""
       
   214 
       
   215   def has_detail(self): return self.has_detail_
       
   216 
       
   217 
       
   218   def MergeFrom(self, x):
       
   219     assert x is not self
       
   220     if (x.has_code()): self.set_code(x.code())
       
   221     if (x.has_detail()): self.set_detail(x.detail())
       
   222 
       
   223   def Equals(self, x):
       
   224     if x is self: return 1
       
   225     if self.has_code_ != x.has_code_: return 0
       
   226     if self.has_code_ and self.code_ != x.code_: return 0
       
   227     if self.has_detail_ != x.has_detail_: return 0
       
   228     if self.has_detail_ and self.detail_ != x.detail_: return 0
       
   229     return 1
       
   230 
       
   231   def IsInitialized(self, debug_strs=None):
       
   232     initialized = 1
       
   233     if (not self.has_code_):
       
   234       initialized = 0
       
   235       if debug_strs is not None:
       
   236         debug_strs.append('Required field: code not set.')
       
   237     if (not self.has_detail_):
       
   238       initialized = 0
       
   239       if debug_strs is not None:
       
   240         debug_strs.append('Required field: detail not set.')
       
   241     return initialized
       
   242 
       
   243   def ByteSize(self):
       
   244     n = 0
       
   245     n += self.lengthVarInt64(self.code_)
       
   246     n += self.lengthString(len(self.detail_))
       
   247     return n + 2
       
   248 
       
   249   def Clear(self):
       
   250     self.clear_code()
       
   251     self.clear_detail()
       
   252 
       
   253   def OutputUnchecked(self, out):
       
   254     out.putVarInt32(8)
       
   255     out.putVarInt32(self.code_)
       
   256     out.putVarInt32(18)
       
   257     out.putPrefixedString(self.detail_)
       
   258 
       
   259   def TryMerge(self, d):
       
   260     while d.avail() > 0:
       
   261       tt = d.getVarInt32()
       
   262       if tt == 8:
       
   263         self.set_code(d.getVarInt32())
       
   264         continue
       
   265       if tt == 18:
       
   266         self.set_detail(d.getPrefixedString())
       
   267         continue
       
   268       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   269       d.skipData(tt)
       
   270 
       
   271 
       
   272   def __str__(self, prefix="", printElemNumber=0):
       
   273     res=""
       
   274     if self.has_code_: res+=prefix+("code: %s\n" % self.DebugFormatInt32(self.code_))
       
   275     if self.has_detail_: res+=prefix+("detail: %s\n" % self.DebugFormatString(self.detail_))
       
   276     return res
       
   277 
       
   278 
       
   279   def _BuildTagLookupTable(sparse, maxtag, default=None):
       
   280     return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
       
   281 
       
   282   kcode = 1
       
   283   kdetail = 2
       
   284 
       
   285   _TEXT = _BuildTagLookupTable({
       
   286     0: "ErrorCode",
       
   287     1: "code",
       
   288     2: "detail",
       
   289   }, 2)
       
   290 
       
   291   _TYPES = _BuildTagLookupTable({
       
   292     0: ProtocolBuffer.Encoder.NUMERIC,
       
   293     1: ProtocolBuffer.Encoder.NUMERIC,
       
   294     2: ProtocolBuffer.Encoder.STRING,
       
   295   }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
   181 
   296 
   182   _STYLE = """"""
   297   _STYLE = """"""
   183   _STYLE_CONTENT_TYPE = """"""
   298   _STYLE_CONTENT_TYPE = """"""
   184 class Response(ProtocolBuffer.ProtocolMessage):
   299 class Response(ProtocolBuffer.ProtocolMessage):
   185   has_response_ = 0
   300   has_response_ = 0
   186   response_ = None
   301   response_ = None
   187   has_exception_ = 0
   302   has_exception_ = 0
   188   exception_ = None
   303   exception_ = None
       
   304   has_application_error_ = 0
       
   305   application_error_ = None
       
   306   has_java_exception_ = 0
       
   307   java_exception_ = None
   189 
   308 
   190   def __init__(self, contents=None):
   309   def __init__(self, contents=None):
   191     self.lazy_init_lock_ = thread.allocate_lock()
   310     self.lazy_init_lock_ = thread.allocate_lock()
   192     if contents is not None: self.MergeFromString(contents)
   311     if contents is not None: self.MergeFromString(contents)
   193 
   312 
   225       self.has_exception_ = 0;
   344       self.has_exception_ = 0;
   226       if self.exception_ is not None: self.exception_.Clear()
   345       if self.exception_ is not None: self.exception_.Clear()
   227 
   346 
   228   def has_exception(self): return self.has_exception_
   347   def has_exception(self): return self.has_exception_
   229 
   348 
       
   349   def application_error(self):
       
   350     if self.application_error_ is None:
       
   351       self.lazy_init_lock_.acquire()
       
   352       try:
       
   353         if self.application_error_ is None: self.application_error_ = ApplicationError()
       
   354       finally:
       
   355         self.lazy_init_lock_.release()
       
   356     return self.application_error_
       
   357 
       
   358   def mutable_application_error(self): self.has_application_error_ = 1; return self.application_error()
       
   359 
       
   360   def clear_application_error(self):
       
   361     if self.has_application_error_:
       
   362       self.has_application_error_ = 0;
       
   363       if self.application_error_ is not None: self.application_error_.Clear()
       
   364 
       
   365   def has_application_error(self): return self.has_application_error_
       
   366 
       
   367   def java_exception(self):
       
   368     if self.java_exception_ is None:
       
   369       self.lazy_init_lock_.acquire()
       
   370       try:
       
   371         if self.java_exception_ is None: self.java_exception_ = RawMessage()
       
   372       finally:
       
   373         self.lazy_init_lock_.release()
       
   374     return self.java_exception_
       
   375 
       
   376   def mutable_java_exception(self): self.has_java_exception_ = 1; return self.java_exception()
       
   377 
       
   378   def clear_java_exception(self):
       
   379     if self.has_java_exception_:
       
   380       self.has_java_exception_ = 0;
       
   381       if self.java_exception_ is not None: self.java_exception_.Clear()
       
   382 
       
   383   def has_java_exception(self): return self.has_java_exception_
       
   384 
   230 
   385 
   231   def MergeFrom(self, x):
   386   def MergeFrom(self, x):
   232     assert x is not self
   387     assert x is not self
   233     if (x.has_response()): self.mutable_response().MergeFrom(x.response())
   388     if (x.has_response()): self.mutable_response().MergeFrom(x.response())
   234     if (x.has_exception()): self.mutable_exception().MergeFrom(x.exception())
   389     if (x.has_exception()): self.mutable_exception().MergeFrom(x.exception())
       
   390     if (x.has_application_error()): self.mutable_application_error().MergeFrom(x.application_error())
       
   391     if (x.has_java_exception()): self.mutable_java_exception().MergeFrom(x.java_exception())
   235 
   392 
   236   def Equals(self, x):
   393   def Equals(self, x):
   237     if x is self: return 1
   394     if x is self: return 1
   238     if self.has_response_ != x.has_response_: return 0
   395     if self.has_response_ != x.has_response_: return 0
   239     if self.has_response_ and self.response_ != x.response_: return 0
   396     if self.has_response_ and self.response_ != x.response_: return 0
   240     if self.has_exception_ != x.has_exception_: return 0
   397     if self.has_exception_ != x.has_exception_: return 0
   241     if self.has_exception_ and self.exception_ != x.exception_: return 0
   398     if self.has_exception_ and self.exception_ != x.exception_: return 0
       
   399     if self.has_application_error_ != x.has_application_error_: return 0
       
   400     if self.has_application_error_ and self.application_error_ != x.application_error_: return 0
       
   401     if self.has_java_exception_ != x.has_java_exception_: return 0
       
   402     if self.has_java_exception_ and self.java_exception_ != x.java_exception_: return 0
   242     return 1
   403     return 1
   243 
   404 
   244   def IsInitialized(self, debug_strs=None):
   405   def IsInitialized(self, debug_strs=None):
   245     initialized = 1
   406     initialized = 1
   246     if (self.has_response_ and not self.response_.IsInitialized(debug_strs)): initialized = 0
   407     if (self.has_response_ and not self.response_.IsInitialized(debug_strs)): initialized = 0
   247     if (self.has_exception_ and not self.exception_.IsInitialized(debug_strs)): initialized = 0
   408     if (self.has_exception_ and not self.exception_.IsInitialized(debug_strs)): initialized = 0
       
   409     if (self.has_application_error_ and not self.application_error_.IsInitialized(debug_strs)): initialized = 0
       
   410     if (self.has_java_exception_ and not self.java_exception_.IsInitialized(debug_strs)): initialized = 0
   248     return initialized
   411     return initialized
   249 
   412 
   250   def ByteSize(self):
   413   def ByteSize(self):
   251     n = 0
   414     n = 0
   252     if (self.has_response_): n += 1 + self.lengthString(self.response_.ByteSize())
   415     if (self.has_response_): n += 1 + self.lengthString(self.response_.ByteSize())
   253     if (self.has_exception_): n += 1 + self.lengthString(self.exception_.ByteSize())
   416     if (self.has_exception_): n += 1 + self.lengthString(self.exception_.ByteSize())
       
   417     if (self.has_application_error_): n += 1 + self.lengthString(self.application_error_.ByteSize())
       
   418     if (self.has_java_exception_): n += 1 + self.lengthString(self.java_exception_.ByteSize())
   254     return n + 0
   419     return n + 0
   255 
   420 
   256   def Clear(self):
   421   def Clear(self):
   257     self.clear_response()
   422     self.clear_response()
   258     self.clear_exception()
   423     self.clear_exception()
       
   424     self.clear_application_error()
       
   425     self.clear_java_exception()
   259 
   426 
   260   def OutputUnchecked(self, out):
   427   def OutputUnchecked(self, out):
   261     if (self.has_response_):
   428     if (self.has_response_):
   262       out.putVarInt32(10)
   429       out.putVarInt32(10)
   263       out.putVarInt32(self.response_.ByteSize())
   430       out.putVarInt32(self.response_.ByteSize())
   264       self.response_.OutputUnchecked(out)
   431       self.response_.OutputUnchecked(out)
   265     if (self.has_exception_):
   432     if (self.has_exception_):
   266       out.putVarInt32(18)
   433       out.putVarInt32(18)
   267       out.putVarInt32(self.exception_.ByteSize())
   434       out.putVarInt32(self.exception_.ByteSize())
   268       self.exception_.OutputUnchecked(out)
   435       self.exception_.OutputUnchecked(out)
       
   436     if (self.has_application_error_):
       
   437       out.putVarInt32(26)
       
   438       out.putVarInt32(self.application_error_.ByteSize())
       
   439       self.application_error_.OutputUnchecked(out)
       
   440     if (self.has_java_exception_):
       
   441       out.putVarInt32(34)
       
   442       out.putVarInt32(self.java_exception_.ByteSize())
       
   443       self.java_exception_.OutputUnchecked(out)
   269 
   444 
   270   def TryMerge(self, d):
   445   def TryMerge(self, d):
   271     while d.avail() > 0:
   446     while d.avail() > 0:
   272       tt = d.getVarInt32()
   447       tt = d.getVarInt32()
   273       if tt == 10:
   448       if tt == 10:
   279       if tt == 18:
   454       if tt == 18:
   280         length = d.getVarInt32()
   455         length = d.getVarInt32()
   281         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
   456         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
   282         d.skip(length)
   457         d.skip(length)
   283         self.mutable_exception().TryMerge(tmp)
   458         self.mutable_exception().TryMerge(tmp)
       
   459         continue
       
   460       if tt == 26:
       
   461         length = d.getVarInt32()
       
   462         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   463         d.skip(length)
       
   464         self.mutable_application_error().TryMerge(tmp)
       
   465         continue
       
   466       if tt == 34:
       
   467         length = d.getVarInt32()
       
   468         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   469         d.skip(length)
       
   470         self.mutable_java_exception().TryMerge(tmp)
   284         continue
   471         continue
   285       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
   472       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
   286       d.skipData(tt)
   473       d.skipData(tt)
   287 
   474 
   288 
   475 
   294       res+=prefix+">\n"
   481       res+=prefix+">\n"
   295     if self.has_exception_:
   482     if self.has_exception_:
   296       res+=prefix+"exception <\n"
   483       res+=prefix+"exception <\n"
   297       res+=self.exception_.__str__(prefix + "  ", printElemNumber)
   484       res+=self.exception_.__str__(prefix + "  ", printElemNumber)
   298       res+=prefix+">\n"
   485       res+=prefix+">\n"
       
   486     if self.has_application_error_:
       
   487       res+=prefix+"application_error <\n"
       
   488       res+=self.application_error_.__str__(prefix + "  ", printElemNumber)
       
   489       res+=prefix+">\n"
       
   490     if self.has_java_exception_:
       
   491       res+=prefix+"java_exception <\n"
       
   492       res+=self.java_exception_.__str__(prefix + "  ", printElemNumber)
       
   493       res+=prefix+">\n"
   299     return res
   494     return res
       
   495 
       
   496 
       
   497   def _BuildTagLookupTable(sparse, maxtag, default=None):
       
   498     return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
   300 
   499 
   301   kresponse = 1
   500   kresponse = 1
   302   kexception = 2
   501   kexception = 2
   303 
   502   kapplication_error = 3
   304   _TEXT = (
   503   kjava_exception = 4
   305    "ErrorCode",
   504 
   306    "response",
   505   _TEXT = _BuildTagLookupTable({
   307    "exception",
   506     0: "ErrorCode",
   308   )
   507     1: "response",
   309 
   508     2: "exception",
   310   _TYPES = (
   509     3: "application_error",
   311    ProtocolBuffer.Encoder.NUMERIC,
   510     4: "java_exception",
   312    ProtocolBuffer.Encoder.STRING,
   511   }, 4)
   313 
   512 
   314    ProtocolBuffer.Encoder.STRING,
   513   _TYPES = _BuildTagLookupTable({
   315 
   514     0: ProtocolBuffer.Encoder.NUMERIC,
   316   )
   515     1: ProtocolBuffer.Encoder.STRING,
       
   516     2: ProtocolBuffer.Encoder.STRING,
       
   517     3: ProtocolBuffer.Encoder.STRING,
       
   518     4: ProtocolBuffer.Encoder.STRING,
       
   519   }, 4, ProtocolBuffer.Encoder.MAX_TYPE)
   317 
   520 
   318   _STYLE = """"""
   521   _STYLE = """"""
   319   _STYLE_CONTENT_TYPE = """"""
   522   _STYLE_CONTENT_TYPE = """"""
   320 class TransactionRequest_Precondition(ProtocolBuffer.ProtocolMessage):
   523 class TransactionRequest_Precondition(ProtocolBuffer.ProtocolMessage):
   321   has_key_ = 0
   524   has_key_ = 0
   570       res+=prefix+"deletes <\n"
   773       res+=prefix+"deletes <\n"
   571       res+=self.deletes_.__str__(prefix + "  ", printElemNumber)
   774       res+=self.deletes_.__str__(prefix + "  ", printElemNumber)
   572       res+=prefix+">\n"
   775       res+=prefix+">\n"
   573     return res
   776     return res
   574 
   777 
       
   778 
       
   779   def _BuildTagLookupTable(sparse, maxtag, default=None):
       
   780     return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
       
   781 
   575   kPreconditionGroup = 1
   782   kPreconditionGroup = 1
   576   kPreconditionkey = 2
   783   kPreconditionkey = 2
   577   kPreconditionhash = 3
   784   kPreconditionhash = 3
   578   kputs = 4
   785   kputs = 4
   579   kdeletes = 5
   786   kdeletes = 5
   580 
   787 
   581   _TEXT = (
   788   _TEXT = _BuildTagLookupTable({
   582    "ErrorCode",
   789     0: "ErrorCode",
   583    "Precondition",
   790     1: "Precondition",
   584    "key",
   791     2: "key",
   585    "hash",
   792     3: "hash",
   586    "puts",
   793     4: "puts",
   587    "deletes",
   794     5: "deletes",
   588   )
   795   }, 5)
   589 
   796 
   590   _TYPES = (
   797   _TYPES = _BuildTagLookupTable({
   591    ProtocolBuffer.Encoder.NUMERIC,
   798     0: ProtocolBuffer.Encoder.NUMERIC,
   592    ProtocolBuffer.Encoder.STARTGROUP,
   799     1: ProtocolBuffer.Encoder.STARTGROUP,
   593 
   800     2: ProtocolBuffer.Encoder.STRING,
   594    ProtocolBuffer.Encoder.STRING,
   801     3: ProtocolBuffer.Encoder.STRING,
   595 
   802     4: ProtocolBuffer.Encoder.STRING,
   596    ProtocolBuffer.Encoder.STRING,
   803     5: ProtocolBuffer.Encoder.STRING,
   597 
   804   }, 5, ProtocolBuffer.Encoder.MAX_TYPE)
   598    ProtocolBuffer.Encoder.STRING,
       
   599 
       
   600    ProtocolBuffer.Encoder.STRING,
       
   601 
       
   602   )
       
   603 
   805 
   604   _STYLE = """"""
   806   _STYLE = """"""
   605   _STYLE_CONTENT_TYPE = """"""
   807   _STYLE_CONTENT_TYPE = """"""
   606 
   808 
   607 __all__ = ['Request','Response','TransactionRequest','TransactionRequest_Precondition']
   809 __all__ = ['Request','ApplicationError','Response','TransactionRequest','TransactionRequest_Precondition']