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
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
31 _extension_runtime
= False
32 _ExtendableProtocolMessage
= ProtocolBuffer
.ProtocolMessage
34 class StringProto(ProtocolBuffer
.ProtocolMessage
):
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
):
47 def clear_value(self
):
52 def has_value(self
): return self
.has_value_
55 def MergeFrom(self
, x
):
57 if (x
.has_value()): self
.set_value(x
.value())
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
65 def IsInitialized(self
, debug_strs
=None):
67 if (not self
.has_value_
):
69 if debug_strs
is not None:
70 debug_strs
.append('Required field: value not set.')
75 n
+= self
.lengthString(len(self
.value_
))
78 def ByteSizePartial(self
):
82 n
+= self
.lengthString(len(self
.value_
))
88 def OutputUnchecked(self
, out
):
90 out
.putPrefixedString(self
.value_
)
92 def OutputPartial(self
, out
):
95 out
.putPrefixedString(self
.value_
)
97 def TryMerge(self
, d
):
101 self
.set_value(d
.getPrefixedString())
105 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
109 def __str__(self
, prefix
="", printElemNumber
=0):
111 if self
.has_value_
: res
+=prefix
+("value: %s\n" % self
.DebugFormatString(self
.value_
))
115 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
116 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
120 _TEXT
= _BuildTagLookupTable({
125 _TYPES
= _BuildTagLookupTable({
126 0: ProtocolBuffer
.Encoder
.NUMERIC
,
127 1: ProtocolBuffer
.Encoder
.STRING
,
128 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
132 _STYLE_CONTENT_TYPE
= """"""
133 _PROTO_DESCRIPTOR_NAME
= 'apphosting.base.StringProto'
134 class Integer32Proto(ProtocolBuffer
.ProtocolMessage
):
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
):
147 def clear_value(self
):
152 def has_value(self
): return self
.has_value_
155 def MergeFrom(self
, x
):
157 if (x
.has_value()): self
.set_value(x
.value())
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
165 def IsInitialized(self
, debug_strs
=None):
167 if (not self
.has_value_
):
169 if debug_strs
is not None:
170 debug_strs
.append('Required field: value not set.')
175 n
+= self
.lengthVarInt64(self
.value_
)
178 def ByteSizePartial(self
):
180 if (self
.has_value_
):
182 n
+= self
.lengthVarInt64(self
.value_
)
188 def OutputUnchecked(self
, out
):
190 out
.putVarInt32(self
.value_
)
192 def OutputPartial(self
, out
):
193 if (self
.has_value_
):
195 out
.putVarInt32(self
.value_
)
197 def TryMerge(self
, d
):
201 self
.set_value(d
.getVarInt32())
205 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
209 def __str__(self
, prefix
="", printElemNumber
=0):
211 if self
.has_value_
: res
+=prefix
+("value: %s\n" % self
.DebugFormatInt32(self
.value_
))
215 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
216 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
220 _TEXT
= _BuildTagLookupTable({
225 _TYPES
= _BuildTagLookupTable({
226 0: ProtocolBuffer
.Encoder
.NUMERIC
,
227 1: ProtocolBuffer
.Encoder
.NUMERIC
,
228 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
232 _STYLE_CONTENT_TYPE
= """"""
233 _PROTO_DESCRIPTOR_NAME
= 'apphosting.base.Integer32Proto'
234 class Integer64Proto(ProtocolBuffer
.ProtocolMessage
):
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
):
247 def clear_value(self
):
252 def has_value(self
): return self
.has_value_
255 def MergeFrom(self
, x
):
257 if (x
.has_value()): self
.set_value(x
.value())
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
265 def IsInitialized(self
, debug_strs
=None):
267 if (not self
.has_value_
):
269 if debug_strs
is not None:
270 debug_strs
.append('Required field: value not set.')
275 n
+= self
.lengthVarInt64(self
.value_
)
278 def ByteSizePartial(self
):
280 if (self
.has_value_
):
282 n
+= self
.lengthVarInt64(self
.value_
)
288 def OutputUnchecked(self
, out
):
290 out
.putVarInt64(self
.value_
)
292 def OutputPartial(self
, out
):
293 if (self
.has_value_
):
295 out
.putVarInt64(self
.value_
)
297 def TryMerge(self
, d
):
301 self
.set_value(d
.getVarInt64())
305 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
309 def __str__(self
, prefix
="", printElemNumber
=0):
311 if self
.has_value_
: res
+=prefix
+("value: %s\n" % self
.DebugFormatInt64(self
.value_
))
315 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
316 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
320 _TEXT
= _BuildTagLookupTable({
325 _TYPES
= _BuildTagLookupTable({
326 0: ProtocolBuffer
.Encoder
.NUMERIC
,
327 1: ProtocolBuffer
.Encoder
.NUMERIC
,
328 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
332 _STYLE_CONTENT_TYPE
= """"""
333 _PROTO_DESCRIPTOR_NAME
= 'apphosting.base.Integer64Proto'
334 class BoolProto(ProtocolBuffer
.ProtocolMessage
):
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
):
347 def clear_value(self
):
352 def has_value(self
): return self
.has_value_
355 def MergeFrom(self
, x
):
357 if (x
.has_value()): self
.set_value(x
.value())
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
365 def IsInitialized(self
, debug_strs
=None):
367 if (not self
.has_value_
):
369 if debug_strs
is not None:
370 debug_strs
.append('Required field: value not set.')
377 def ByteSizePartial(self
):
379 if (self
.has_value_
):
386 def OutputUnchecked(self
, out
):
388 out
.putBoolean(self
.value_
)
390 def OutputPartial(self
, out
):
391 if (self
.has_value_
):
393 out
.putBoolean(self
.value_
)
395 def TryMerge(self
, d
):
399 self
.set_value(d
.getBoolean())
403 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
407 def __str__(self
, prefix
="", printElemNumber
=0):
409 if self
.has_value_
: res
+=prefix
+("value: %s\n" % self
.DebugFormatBool(self
.value_
))
413 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
414 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
418 _TEXT
= _BuildTagLookupTable({
423 _TYPES
= _BuildTagLookupTable({
424 0: ProtocolBuffer
.Encoder
.NUMERIC
,
425 1: ProtocolBuffer
.Encoder
.NUMERIC
,
426 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
430 _STYLE_CONTENT_TYPE
= """"""
431 _PROTO_DESCRIPTOR_NAME
= 'apphosting.base.BoolProto'
432 class DoubleProto(ProtocolBuffer
.ProtocolMessage
):
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
):
445 def clear_value(self
):
450 def has_value(self
): return self
.has_value_
453 def MergeFrom(self
, x
):
455 if (x
.has_value()): self
.set_value(x
.value())
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
463 def IsInitialized(self
, debug_strs
=None):
465 if (not self
.has_value_
):
467 if debug_strs
is not None:
468 debug_strs
.append('Required field: value not set.')
475 def ByteSizePartial(self
):
477 if (self
.has_value_
):
484 def OutputUnchecked(self
, out
):
486 out
.putDouble(self
.value_
)
488 def OutputPartial(self
, out
):
489 if (self
.has_value_
):
491 out
.putDouble(self
.value_
)
493 def TryMerge(self
, d
):
497 self
.set_value(d
.getDouble())
501 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
505 def __str__(self
, prefix
="", printElemNumber
=0):
507 if self
.has_value_
: res
+=prefix
+("value: %s\n" % self
.DebugFormat(self
.value_
))
511 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
512 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
516 _TEXT
= _BuildTagLookupTable({
521 _TYPES
= _BuildTagLookupTable({
522 0: ProtocolBuffer
.Encoder
.NUMERIC
,
523 1: ProtocolBuffer
.Encoder
.DOUBLE
,
524 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
528 _STYLE_CONTENT_TYPE
= """"""
529 _PROTO_DESCRIPTOR_NAME
= 'apphosting.base.DoubleProto'
530 class BytesProto(ProtocolBuffer
.ProtocolMessage
):
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
):
543 def clear_value(self
):
548 def has_value(self
): return self
.has_value_
551 def MergeFrom(self
, x
):
553 if (x
.has_value()): self
.set_value(x
.value())
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
561 def IsInitialized(self
, debug_strs
=None):
563 if (not self
.has_value_
):
565 if debug_strs
is not None:
566 debug_strs
.append('Required field: value not set.')
571 n
+= self
.lengthString(len(self
.value_
))
574 def ByteSizePartial(self
):
576 if (self
.has_value_
):
578 n
+= self
.lengthString(len(self
.value_
))
584 def OutputUnchecked(self
, out
):
586 out
.putPrefixedString(self
.value_
)
588 def OutputPartial(self
, out
):
589 if (self
.has_value_
):
591 out
.putPrefixedString(self
.value_
)
593 def TryMerge(self
, d
):
597 self
.set_value(d
.getPrefixedString())
601 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
605 def __str__(self
, prefix
="", printElemNumber
=0):
607 if self
.has_value_
: res
+=prefix
+("value: %s\n" % self
.DebugFormatString(self
.value_
))
611 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
612 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
616 _TEXT
= _BuildTagLookupTable({
621 _TYPES
= _BuildTagLookupTable({
622 0: ProtocolBuffer
.Encoder
.NUMERIC
,
623 1: ProtocolBuffer
.Encoder
.STRING
,
624 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
628 _STYLE_CONTENT_TYPE
= """"""
629 _PROTO_DESCRIPTOR_NAME
= 'apphosting.base.BytesProto'
630 class VoidProto(ProtocolBuffer
.ProtocolMessage
):
632 def __init__(self
, contents
=None):
634 if contents
is not None: self
.MergeFromString(contents
)
637 def MergeFrom(self
, x
):
641 if x
is self
: return 1
644 def IsInitialized(self
, debug_strs
=None):
652 def ByteSizePartial(self
):
659 def OutputUnchecked(self
, out
):
662 def OutputPartial(self
, out
):
665 def TryMerge(self
, d
):
670 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
674 def __str__(self
, prefix
="", printElemNumber
=0):
679 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
680 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
683 _TEXT
= _BuildTagLookupTable({
687 _TYPES
= _BuildTagLookupTable({
688 0: ProtocolBuffer
.Encoder
.NUMERIC
,
689 }, 0, ProtocolBuffer
.Encoder
.MAX_TYPE
)
693 _STYLE_CONTENT_TYPE
= """"""
694 _PROTO_DESCRIPTOR_NAME
= 'apphosting.base.VoidProto'
695 if _extension_runtime
:
698 __all__
= ['StringProto','Integer32Proto','Integer64Proto','BoolProto','DoubleProto','BytesProto','VoidProto']