1.9.30 sync.
[gae.git] / python / google / appengine / api / api_base_pb.py
blobf979447553917a47b1536bf7bd4d2118f7d059c5
1 #!/usr/bin/env python
3 # Copyright 2007 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 from google.net.proto import ProtocolBuffer
21 import array
22 import dummy_thread as thread
24 __pychecker__ = """maxreturns=0 maxbranches=0 no-callinit
25 unusednames=printElemNumber,debug_strs no-special"""
27 if hasattr(ProtocolBuffer, 'ExtendableProtocolMessage'):
28 _extension_runtime = True
29 _ExtendableProtocolMessage = ProtocolBuffer.ExtendableProtocolMessage
30 else:
31 _extension_runtime = False
32 _ExtendableProtocolMessage = ProtocolBuffer.ProtocolMessage
34 class StringProto(ProtocolBuffer.ProtocolMessage):
35 has_value_ = 0
36 value_ = ""
38 def __init__(self, contents=None):
39 if contents is not None: self.MergeFromString(contents)
41 def value(self): return self.value_
43 def set_value(self, x):
44 self.has_value_ = 1
45 self.value_ = x
47 def clear_value(self):
48 if self.has_value_:
49 self.has_value_ = 0
50 self.value_ = ""
52 def has_value(self): return self.has_value_
55 def MergeFrom(self, x):
56 assert x is not self
57 if (x.has_value()): self.set_value(x.value())
59 def Equals(self, x):
60 if x is self: return 1
61 if self.has_value_ != x.has_value_: return 0
62 if self.has_value_ and self.value_ != x.value_: return 0
63 return 1
65 def IsInitialized(self, debug_strs=None):
66 initialized = 1
67 if (not self.has_value_):
68 initialized = 0
69 if debug_strs is not None:
70 debug_strs.append('Required field: value not set.')
71 return initialized
73 def ByteSize(self):
74 n = 0
75 n += self.lengthString(len(self.value_))
76 return n + 1
78 def ByteSizePartial(self):
79 n = 0
80 if (self.has_value_):
81 n += 1
82 n += self.lengthString(len(self.value_))
83 return n
85 def Clear(self):
86 self.clear_value()
88 def OutputUnchecked(self, out):
89 out.putVarInt32(10)
90 out.putPrefixedString(self.value_)
92 def OutputPartial(self, out):
93 if (self.has_value_):
94 out.putVarInt32(10)
95 out.putPrefixedString(self.value_)
97 def TryMerge(self, d):
98 while d.avail() > 0:
99 tt = d.getVarInt32()
100 if tt == 10:
101 self.set_value(d.getPrefixedString())
102 continue
105 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
106 d.skipData(tt)
109 def __str__(self, prefix="", printElemNumber=0):
110 res=""
111 if self.has_value_: res+=prefix+("value: %s\n" % self.DebugFormatString(self.value_))
112 return res
115 def _BuildTagLookupTable(sparse, maxtag, default=None):
116 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
118 kvalue = 1
120 _TEXT = _BuildTagLookupTable({
121 0: "ErrorCode",
122 1: "value",
123 }, 1)
125 _TYPES = _BuildTagLookupTable({
126 0: ProtocolBuffer.Encoder.NUMERIC,
127 1: ProtocolBuffer.Encoder.STRING,
128 }, 1, ProtocolBuffer.Encoder.MAX_TYPE)
131 _STYLE = """"""
132 _STYLE_CONTENT_TYPE = """"""
133 _PROTO_DESCRIPTOR_NAME = 'apphosting.base.StringProto'
134 class Integer32Proto(ProtocolBuffer.ProtocolMessage):
135 has_value_ = 0
136 value_ = 0
138 def __init__(self, contents=None):
139 if contents is not None: self.MergeFromString(contents)
141 def value(self): return self.value_
143 def set_value(self, x):
144 self.has_value_ = 1
145 self.value_ = x
147 def clear_value(self):
148 if self.has_value_:
149 self.has_value_ = 0
150 self.value_ = 0
152 def has_value(self): return self.has_value_
155 def MergeFrom(self, x):
156 assert x is not self
157 if (x.has_value()): self.set_value(x.value())
159 def Equals(self, x):
160 if x is self: return 1
161 if self.has_value_ != x.has_value_: return 0
162 if self.has_value_ and self.value_ != x.value_: return 0
163 return 1
165 def IsInitialized(self, debug_strs=None):
166 initialized = 1
167 if (not self.has_value_):
168 initialized = 0
169 if debug_strs is not None:
170 debug_strs.append('Required field: value not set.')
171 return initialized
173 def ByteSize(self):
174 n = 0
175 n += self.lengthVarInt64(self.value_)
176 return n + 1
178 def ByteSizePartial(self):
179 n = 0
180 if (self.has_value_):
181 n += 1
182 n += self.lengthVarInt64(self.value_)
183 return n
185 def Clear(self):
186 self.clear_value()
188 def OutputUnchecked(self, out):
189 out.putVarInt32(8)
190 out.putVarInt32(self.value_)
192 def OutputPartial(self, out):
193 if (self.has_value_):
194 out.putVarInt32(8)
195 out.putVarInt32(self.value_)
197 def TryMerge(self, d):
198 while d.avail() > 0:
199 tt = d.getVarInt32()
200 if tt == 8:
201 self.set_value(d.getVarInt32())
202 continue
205 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
206 d.skipData(tt)
209 def __str__(self, prefix="", printElemNumber=0):
210 res=""
211 if self.has_value_: res+=prefix+("value: %s\n" % self.DebugFormatInt32(self.value_))
212 return res
215 def _BuildTagLookupTable(sparse, maxtag, default=None):
216 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
218 kvalue = 1
220 _TEXT = _BuildTagLookupTable({
221 0: "ErrorCode",
222 1: "value",
223 }, 1)
225 _TYPES = _BuildTagLookupTable({
226 0: ProtocolBuffer.Encoder.NUMERIC,
227 1: ProtocolBuffer.Encoder.NUMERIC,
228 }, 1, ProtocolBuffer.Encoder.MAX_TYPE)
231 _STYLE = """"""
232 _STYLE_CONTENT_TYPE = """"""
233 _PROTO_DESCRIPTOR_NAME = 'apphosting.base.Integer32Proto'
234 class Integer64Proto(ProtocolBuffer.ProtocolMessage):
235 has_value_ = 0
236 value_ = 0
238 def __init__(self, contents=None):
239 if contents is not None: self.MergeFromString(contents)
241 def value(self): return self.value_
243 def set_value(self, x):
244 self.has_value_ = 1
245 self.value_ = x
247 def clear_value(self):
248 if self.has_value_:
249 self.has_value_ = 0
250 self.value_ = 0
252 def has_value(self): return self.has_value_
255 def MergeFrom(self, x):
256 assert x is not self
257 if (x.has_value()): self.set_value(x.value())
259 def Equals(self, x):
260 if x is self: return 1
261 if self.has_value_ != x.has_value_: return 0
262 if self.has_value_ and self.value_ != x.value_: return 0
263 return 1
265 def IsInitialized(self, debug_strs=None):
266 initialized = 1
267 if (not self.has_value_):
268 initialized = 0
269 if debug_strs is not None:
270 debug_strs.append('Required field: value not set.')
271 return initialized
273 def ByteSize(self):
274 n = 0
275 n += self.lengthVarInt64(self.value_)
276 return n + 1
278 def ByteSizePartial(self):
279 n = 0
280 if (self.has_value_):
281 n += 1
282 n += self.lengthVarInt64(self.value_)
283 return n
285 def Clear(self):
286 self.clear_value()
288 def OutputUnchecked(self, out):
289 out.putVarInt32(8)
290 out.putVarInt64(self.value_)
292 def OutputPartial(self, out):
293 if (self.has_value_):
294 out.putVarInt32(8)
295 out.putVarInt64(self.value_)
297 def TryMerge(self, d):
298 while d.avail() > 0:
299 tt = d.getVarInt32()
300 if tt == 8:
301 self.set_value(d.getVarInt64())
302 continue
305 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
306 d.skipData(tt)
309 def __str__(self, prefix="", printElemNumber=0):
310 res=""
311 if self.has_value_: res+=prefix+("value: %s\n" % self.DebugFormatInt64(self.value_))
312 return res
315 def _BuildTagLookupTable(sparse, maxtag, default=None):
316 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
318 kvalue = 1
320 _TEXT = _BuildTagLookupTable({
321 0: "ErrorCode",
322 1: "value",
323 }, 1)
325 _TYPES = _BuildTagLookupTable({
326 0: ProtocolBuffer.Encoder.NUMERIC,
327 1: ProtocolBuffer.Encoder.NUMERIC,
328 }, 1, ProtocolBuffer.Encoder.MAX_TYPE)
331 _STYLE = """"""
332 _STYLE_CONTENT_TYPE = """"""
333 _PROTO_DESCRIPTOR_NAME = 'apphosting.base.Integer64Proto'
334 class BoolProto(ProtocolBuffer.ProtocolMessage):
335 has_value_ = 0
336 value_ = 0
338 def __init__(self, contents=None):
339 if contents is not None: self.MergeFromString(contents)
341 def value(self): return self.value_
343 def set_value(self, x):
344 self.has_value_ = 1
345 self.value_ = x
347 def clear_value(self):
348 if self.has_value_:
349 self.has_value_ = 0
350 self.value_ = 0
352 def has_value(self): return self.has_value_
355 def MergeFrom(self, x):
356 assert x is not self
357 if (x.has_value()): self.set_value(x.value())
359 def Equals(self, x):
360 if x is self: return 1
361 if self.has_value_ != x.has_value_: return 0
362 if self.has_value_ and self.value_ != x.value_: return 0
363 return 1
365 def IsInitialized(self, debug_strs=None):
366 initialized = 1
367 if (not self.has_value_):
368 initialized = 0
369 if debug_strs is not None:
370 debug_strs.append('Required field: value not set.')
371 return initialized
373 def ByteSize(self):
374 n = 0
375 return n + 2
377 def ByteSizePartial(self):
378 n = 0
379 if (self.has_value_):
380 n += 2
381 return n
383 def Clear(self):
384 self.clear_value()
386 def OutputUnchecked(self, out):
387 out.putVarInt32(8)
388 out.putBoolean(self.value_)
390 def OutputPartial(self, out):
391 if (self.has_value_):
392 out.putVarInt32(8)
393 out.putBoolean(self.value_)
395 def TryMerge(self, d):
396 while d.avail() > 0:
397 tt = d.getVarInt32()
398 if tt == 8:
399 self.set_value(d.getBoolean())
400 continue
403 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
404 d.skipData(tt)
407 def __str__(self, prefix="", printElemNumber=0):
408 res=""
409 if self.has_value_: res+=prefix+("value: %s\n" % self.DebugFormatBool(self.value_))
410 return res
413 def _BuildTagLookupTable(sparse, maxtag, default=None):
414 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
416 kvalue = 1
418 _TEXT = _BuildTagLookupTable({
419 0: "ErrorCode",
420 1: "value",
421 }, 1)
423 _TYPES = _BuildTagLookupTable({
424 0: ProtocolBuffer.Encoder.NUMERIC,
425 1: ProtocolBuffer.Encoder.NUMERIC,
426 }, 1, ProtocolBuffer.Encoder.MAX_TYPE)
429 _STYLE = """"""
430 _STYLE_CONTENT_TYPE = """"""
431 _PROTO_DESCRIPTOR_NAME = 'apphosting.base.BoolProto'
432 class DoubleProto(ProtocolBuffer.ProtocolMessage):
433 has_value_ = 0
434 value_ = 0.0
436 def __init__(self, contents=None):
437 if contents is not None: self.MergeFromString(contents)
439 def value(self): return self.value_
441 def set_value(self, x):
442 self.has_value_ = 1
443 self.value_ = x
445 def clear_value(self):
446 if self.has_value_:
447 self.has_value_ = 0
448 self.value_ = 0.0
450 def has_value(self): return self.has_value_
453 def MergeFrom(self, x):
454 assert x is not self
455 if (x.has_value()): self.set_value(x.value())
457 def Equals(self, x):
458 if x is self: return 1
459 if self.has_value_ != x.has_value_: return 0
460 if self.has_value_ and self.value_ != x.value_: return 0
461 return 1
463 def IsInitialized(self, debug_strs=None):
464 initialized = 1
465 if (not self.has_value_):
466 initialized = 0
467 if debug_strs is not None:
468 debug_strs.append('Required field: value not set.')
469 return initialized
471 def ByteSize(self):
472 n = 0
473 return n + 9
475 def ByteSizePartial(self):
476 n = 0
477 if (self.has_value_):
478 n += 9
479 return n
481 def Clear(self):
482 self.clear_value()
484 def OutputUnchecked(self, out):
485 out.putVarInt32(9)
486 out.putDouble(self.value_)
488 def OutputPartial(self, out):
489 if (self.has_value_):
490 out.putVarInt32(9)
491 out.putDouble(self.value_)
493 def TryMerge(self, d):
494 while d.avail() > 0:
495 tt = d.getVarInt32()
496 if tt == 9:
497 self.set_value(d.getDouble())
498 continue
501 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
502 d.skipData(tt)
505 def __str__(self, prefix="", printElemNumber=0):
506 res=""
507 if self.has_value_: res+=prefix+("value: %s\n" % self.DebugFormat(self.value_))
508 return res
511 def _BuildTagLookupTable(sparse, maxtag, default=None):
512 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
514 kvalue = 1
516 _TEXT = _BuildTagLookupTable({
517 0: "ErrorCode",
518 1: "value",
519 }, 1)
521 _TYPES = _BuildTagLookupTable({
522 0: ProtocolBuffer.Encoder.NUMERIC,
523 1: ProtocolBuffer.Encoder.DOUBLE,
524 }, 1, ProtocolBuffer.Encoder.MAX_TYPE)
527 _STYLE = """"""
528 _STYLE_CONTENT_TYPE = """"""
529 _PROTO_DESCRIPTOR_NAME = 'apphosting.base.DoubleProto'
530 class BytesProto(ProtocolBuffer.ProtocolMessage):
531 has_value_ = 0
532 value_ = ""
534 def __init__(self, contents=None):
535 if contents is not None: self.MergeFromString(contents)
537 def value(self): return self.value_
539 def set_value(self, x):
540 self.has_value_ = 1
541 self.value_ = x
543 def clear_value(self):
544 if self.has_value_:
545 self.has_value_ = 0
546 self.value_ = ""
548 def has_value(self): return self.has_value_
551 def MergeFrom(self, x):
552 assert x is not self
553 if (x.has_value()): self.set_value(x.value())
555 def Equals(self, x):
556 if x is self: return 1
557 if self.has_value_ != x.has_value_: return 0
558 if self.has_value_ and self.value_ != x.value_: return 0
559 return 1
561 def IsInitialized(self, debug_strs=None):
562 initialized = 1
563 if (not self.has_value_):
564 initialized = 0
565 if debug_strs is not None:
566 debug_strs.append('Required field: value not set.')
567 return initialized
569 def ByteSize(self):
570 n = 0
571 n += self.lengthString(len(self.value_))
572 return n + 1
574 def ByteSizePartial(self):
575 n = 0
576 if (self.has_value_):
577 n += 1
578 n += self.lengthString(len(self.value_))
579 return n
581 def Clear(self):
582 self.clear_value()
584 def OutputUnchecked(self, out):
585 out.putVarInt32(10)
586 out.putPrefixedString(self.value_)
588 def OutputPartial(self, out):
589 if (self.has_value_):
590 out.putVarInt32(10)
591 out.putPrefixedString(self.value_)
593 def TryMerge(self, d):
594 while d.avail() > 0:
595 tt = d.getVarInt32()
596 if tt == 10:
597 self.set_value(d.getPrefixedString())
598 continue
601 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
602 d.skipData(tt)
605 def __str__(self, prefix="", printElemNumber=0):
606 res=""
607 if self.has_value_: res+=prefix+("value: %s\n" % self.DebugFormatString(self.value_))
608 return res
611 def _BuildTagLookupTable(sparse, maxtag, default=None):
612 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
614 kvalue = 1
616 _TEXT = _BuildTagLookupTable({
617 0: "ErrorCode",
618 1: "value",
619 }, 1)
621 _TYPES = _BuildTagLookupTable({
622 0: ProtocolBuffer.Encoder.NUMERIC,
623 1: ProtocolBuffer.Encoder.STRING,
624 }, 1, ProtocolBuffer.Encoder.MAX_TYPE)
627 _STYLE = """"""
628 _STYLE_CONTENT_TYPE = """"""
629 _PROTO_DESCRIPTOR_NAME = 'apphosting.base.BytesProto'
630 class VoidProto(ProtocolBuffer.ProtocolMessage):
632 def __init__(self, contents=None):
633 pass
634 if contents is not None: self.MergeFromString(contents)
637 def MergeFrom(self, x):
638 assert x is not self
640 def Equals(self, x):
641 if x is self: return 1
642 return 1
644 def IsInitialized(self, debug_strs=None):
645 initialized = 1
646 return initialized
648 def ByteSize(self):
649 n = 0
650 return n
652 def ByteSizePartial(self):
653 n = 0
654 return n
656 def Clear(self):
657 pass
659 def OutputUnchecked(self, out):
660 pass
662 def OutputPartial(self, out):
663 pass
665 def TryMerge(self, d):
666 while d.avail() > 0:
667 tt = d.getVarInt32()
670 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
671 d.skipData(tt)
674 def __str__(self, prefix="", printElemNumber=0):
675 res=""
676 return res
679 def _BuildTagLookupTable(sparse, maxtag, default=None):
680 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
683 _TEXT = _BuildTagLookupTable({
684 0: "ErrorCode",
685 }, 0)
687 _TYPES = _BuildTagLookupTable({
688 0: ProtocolBuffer.Encoder.NUMERIC,
689 }, 0, ProtocolBuffer.Encoder.MAX_TYPE)
692 _STYLE = """"""
693 _STYLE_CONTENT_TYPE = """"""
694 _PROTO_DESCRIPTOR_NAME = 'apphosting.base.VoidProto'
695 if _extension_runtime:
696 pass
698 __all__ = ['StringProto','Integer32Proto','Integer64Proto','BoolProto','DoubleProto','BytesProto','VoidProto']