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
23 import dummy_thread
as thread
25 from google3
.net
.proto
import _net_proto___parse__python
27 _net_proto___parse__python
= None
29 __pychecker__
= """maxreturns=0 maxbranches=0 no-callinit
30 unusednames=printElemNumber,debug_strs no-special"""
32 if hasattr(ProtocolBuffer
, 'ExtendableProtocolMessage'):
33 _extension_runtime
= True
34 _ExtendableProtocolMessage
= ProtocolBuffer
.ExtendableProtocolMessage
36 _extension_runtime
= False
37 _ExtendableProtocolMessage
= ProtocolBuffer
.ProtocolMessage
39 class PartitionId(ProtocolBuffer
.ProtocolMessage
):
42 MAX_DIMENSION_TAG
= 100
45 100: "MAX_DIMENSION_TAG",
48 def Constants_Name(cls
, x
): return cls
._Constants
_NAMES
.get(x
, "")
49 Constants_Name
= classmethod(Constants_Name
)
56 def __init__(self
, contents
=None):
57 if contents
is not None: self
.MergeFromString(contents
)
59 def dataset_id(self
): return self
.dataset_id_
61 def set_dataset_id(self
, x
):
62 self
.has_dataset_id_
= 1
65 def clear_dataset_id(self
):
66 if self
.has_dataset_id_
:
67 self
.has_dataset_id_
= 0
70 def has_dataset_id(self
): return self
.has_dataset_id_
72 def namespace(self
): return self
.namespace_
74 def set_namespace(self
, x
):
75 self
.has_namespace_
= 1
78 def clear_namespace(self
):
79 if self
.has_namespace_
:
80 self
.has_namespace_
= 0
83 def has_namespace(self
): return self
.has_namespace_
86 def MergeFrom(self
, x
):
88 if (x
.has_dataset_id()): self
.set_dataset_id(x
.dataset_id())
89 if (x
.has_namespace()): self
.set_namespace(x
.namespace())
91 if _net_proto___parse__python
is not None:
92 def _CMergeFromString(self
, s
):
93 _net_proto___parse__python
.MergeFromString(self
, 'apphosting.datastore.v4.PartitionId', s
)
95 if _net_proto___parse__python
is not None:
97 return _net_proto___parse__python
.Encode(self
, 'apphosting.datastore.v4.PartitionId')
99 if _net_proto___parse__python
is not None:
100 def _CEncodePartial(self
):
101 return _net_proto___parse__python
.EncodePartial(self
, 'apphosting.datastore.v4.PartitionId')
103 if _net_proto___parse__python
is not None:
104 def _CToASCII(self
, output_format
):
105 return _net_proto___parse__python
.ToASCII(self
, 'apphosting.datastore.v4.PartitionId', output_format
)
108 if _net_proto___parse__python
is not None:
109 def ParseASCII(self
, s
):
110 _net_proto___parse__python
.ParseASCII(self
, 'apphosting.datastore.v4.PartitionId', s
)
113 if _net_proto___parse__python
is not None:
114 def ParseASCIIIgnoreUnknown(self
, s
):
115 _net_proto___parse__python
.ParseASCIIIgnoreUnknown(self
, 'apphosting.datastore.v4.PartitionId', s
)
119 if x
is self
: return 1
120 if self
.has_dataset_id_
!= x
.has_dataset_id_
: return 0
121 if self
.has_dataset_id_
and self
.dataset_id_
!= x
.dataset_id_
: return 0
122 if self
.has_namespace_
!= x
.has_namespace_
: return 0
123 if self
.has_namespace_
and self
.namespace_
!= x
.namespace_
: return 0
126 def IsInitialized(self
, debug_strs
=None):
132 if (self
.has_dataset_id_
): n
+= 1 + self
.lengthString(len(self
.dataset_id_
))
133 if (self
.has_namespace_
): n
+= 1 + self
.lengthString(len(self
.namespace_
))
136 def ByteSizePartial(self
):
138 if (self
.has_dataset_id_
): n
+= 1 + self
.lengthString(len(self
.dataset_id_
))
139 if (self
.has_namespace_
): n
+= 1 + self
.lengthString(len(self
.namespace_
))
143 self
.clear_dataset_id()
144 self
.clear_namespace()
146 def OutputUnchecked(self
, out
):
147 if (self
.has_dataset_id_
):
149 out
.putPrefixedString(self
.dataset_id_
)
150 if (self
.has_namespace_
):
152 out
.putPrefixedString(self
.namespace_
)
154 def OutputPartial(self
, out
):
155 if (self
.has_dataset_id_
):
157 out
.putPrefixedString(self
.dataset_id_
)
158 if (self
.has_namespace_
):
160 out
.putPrefixedString(self
.namespace_
)
162 def TryMerge(self
, d
):
166 self
.set_dataset_id(d
.getPrefixedString())
169 self
.set_namespace(d
.getPrefixedString())
173 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
177 def __str__(self
, prefix
="", printElemNumber
=0):
179 if self
.has_dataset_id_
: res
+=prefix
+("dataset_id: %s\n" % self
.DebugFormatString(self
.dataset_id_
))
180 if self
.has_namespace_
: res
+=prefix
+("namespace: %s\n" % self
.DebugFormatString(self
.namespace_
))
184 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
185 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
190 _TEXT
= _BuildTagLookupTable({
196 _TYPES
= _BuildTagLookupTable({
197 0: ProtocolBuffer
.Encoder
.NUMERIC
,
198 3: ProtocolBuffer
.Encoder
.STRING
,
199 4: ProtocolBuffer
.Encoder
.STRING
,
200 }, 4, ProtocolBuffer
.Encoder
.MAX_TYPE
)
204 _STYLE_CONTENT_TYPE
= """"""
205 _PROTO_DESCRIPTOR_NAME
= 'apphosting.datastore.v4.PartitionId'
206 _SERIALIZED_DESCRIPTOR
= array
.array('B')
207 _SERIALIZED_DESCRIPTOR
.fromstring(base64
.decodestring("WiRhcHBob3N0aW5nL2RhdGFzdG9yZS9lbnRpdHlfdjQucHJvdG8KI2FwcGhvc3RpbmcuZGF0YXN0b3JlLnY0LlBhcnRpdGlvbklkExoKZGF0YXNldF9pZCADKAIwCTgBFBMaCW5hbWVzcGFjZSAEKAIwCTgBFHN6CUNvbnN0YW50c4sBkgERTUFYX0RJTUVOU0lPTl9UQUeYAWSMAXS6AYIICiRhcHBob3N0aW5nL2RhdGFzdG9yZS9lbnRpdHlfdjQucHJvdG8SF2FwcGhvc3RpbmcuZGF0YXN0b3JlLnY0IlgKC1BhcnRpdGlvbklkEhIKCmRhdGFzZXRfaWQYAyABKAkSEQoJbmFtZXNwYWNlGAQgASgJIiIKCUNvbnN0YW50cxIVChFNQVhfRElNRU5TSU9OX1RBRxBkIrgBCgNLZXkSOgoMcGFydGl0aW9uX2lkGAEgASgLMiQuYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuUGFydGl0aW9uSWQSPgoMcGF0aF9lbGVtZW50GAIgAygLMiguYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuS2V5LlBhdGhFbGVtZW50GjUKC1BhdGhFbGVtZW50EgwKBGtpbmQYASACKAkSCgoCaWQYAiABKAMSDAoEbmFtZRgDIAEoCSL3AgoFVmFsdWUSFQoNYm9vbGVhbl92YWx1ZRgBIAEoCBIVCg1pbnRlZ2VyX3ZhbHVlGAIgASgDEhQKDGRvdWJsZV92YWx1ZRgDIAEoARIkChx0aW1lc3RhbXBfbWljcm9zZWNvbmRzX3ZhbHVlGAQgASgDEi8KCWtleV92YWx1ZRgFIAEoCzIcLmFwcGhvc3RpbmcuZGF0YXN0b3JlLnY0LktleRIWCg5ibG9iX2tleV92YWx1ZRgQIAEoCRIUCgxzdHJpbmdfdmFsdWUYESABKAkSEgoKYmxvYl92YWx1ZRgSIAEoDBI1CgxlbnRpdHlfdmFsdWUYBiABKAsyHy5hcHBob3N0aW5nLmRhdGFzdG9yZS52NC5FbnRpdHkSMgoKbGlzdF92YWx1ZRgHIAMoCzIeLmFwcGhvc3RpbmcuZGF0YXN0b3JlLnY0LlZhbHVlEg8KB21lYW5pbmcYDiABKAUSFQoHaW5kZXhlZBgPIAEoCDoEdHJ1ZSKiAQoIUHJvcGVydHkSDAoEbmFtZRgBIAIoCRIfChBkZXByZWNhdGVkX211bHRpGAIgASgIOgVmYWxzZRI4ChBkZXByZWNhdGVkX3ZhbHVlGAMgAygLMh4uYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuVmFsdWUSLQoFdmFsdWUYBCABKAsyHi5hcHBob3N0aW5nLmRhdGFzdG9yZS52NC5WYWx1ZSJoCgZFbnRpdHkSKQoDa2V5GAEgASgLMhwuYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuS2V5EjMKCHByb3BlcnR5GAIgAygLMiEuYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuUHJvcGVydHlCIwofY29tLmdvb2dsZS5hcHBob3N0aW5nLmRhdGFzdG9yZSAB"))
208 if _net_proto___parse__python
is not None:
209 _net_proto___parse__python
.RegisterType(
210 _SERIALIZED_DESCRIPTOR
.tostring())
212 class Key_PathElement(ProtocolBuffer
.ProtocolMessage
):
220 def __init__(self
, contents
=None):
221 if contents
is not None: self
.MergeFromString(contents
)
223 def kind(self
): return self
.kind_
225 def set_kind(self
, x
):
229 def clear_kind(self
):
234 def has_kind(self
): return self
.has_kind_
236 def id(self
): return self
.id_
247 def has_id(self
): return self
.has_id_
249 def name(self
): return self
.name_
251 def set_name(self
, x
):
255 def clear_name(self
):
260 def has_name(self
): return self
.has_name_
263 def MergeFrom(self
, x
):
265 if (x
.has_kind()): self
.set_kind(x
.kind())
266 if (x
.has_id()): self
.set_id(x
.id())
267 if (x
.has_name()): self
.set_name(x
.name())
269 if _net_proto___parse__python
is not None:
270 def _CMergeFromString(self
, s
):
271 _net_proto___parse__python
.MergeFromString(self
, 'apphosting.datastore.v4.Key_PathElement', s
)
273 if _net_proto___parse__python
is not None:
275 return _net_proto___parse__python
.Encode(self
, 'apphosting.datastore.v4.Key_PathElement')
277 if _net_proto___parse__python
is not None:
278 def _CEncodePartial(self
):
279 return _net_proto___parse__python
.EncodePartial(self
, 'apphosting.datastore.v4.Key_PathElement')
281 if _net_proto___parse__python
is not None:
282 def _CToASCII(self
, output_format
):
283 return _net_proto___parse__python
.ToASCII(self
, 'apphosting.datastore.v4.Key_PathElement', output_format
)
286 if _net_proto___parse__python
is not None:
287 def ParseASCII(self
, s
):
288 _net_proto___parse__python
.ParseASCII(self
, 'apphosting.datastore.v4.Key_PathElement', s
)
291 if _net_proto___parse__python
is not None:
292 def ParseASCIIIgnoreUnknown(self
, s
):
293 _net_proto___parse__python
.ParseASCIIIgnoreUnknown(self
, 'apphosting.datastore.v4.Key_PathElement', s
)
297 if x
is self
: return 1
298 if self
.has_kind_
!= x
.has_kind_
: return 0
299 if self
.has_kind_
and self
.kind_
!= x
.kind_
: return 0
300 if self
.has_id_
!= x
.has_id_
: return 0
301 if self
.has_id_
and self
.id_
!= x
.id_
: return 0
302 if self
.has_name_
!= x
.has_name_
: return 0
303 if self
.has_name_
and self
.name_
!= x
.name_
: return 0
306 def IsInitialized(self
, debug_strs
=None):
308 if (not self
.has_kind_
):
310 if debug_strs
is not None:
311 debug_strs
.append('Required field: kind not set.')
316 n
+= self
.lengthString(len(self
.kind_
))
317 if (self
.has_id_
): n
+= 1 + self
.lengthVarInt64(self
.id_
)
318 if (self
.has_name_
): n
+= 1 + self
.lengthString(len(self
.name_
))
321 def ByteSizePartial(self
):
325 n
+= self
.lengthString(len(self
.kind_
))
326 if (self
.has_id_
): n
+= 1 + self
.lengthVarInt64(self
.id_
)
327 if (self
.has_name_
): n
+= 1 + self
.lengthString(len(self
.name_
))
335 def OutputUnchecked(self
, out
):
337 out
.putPrefixedString(self
.kind_
)
340 out
.putVarInt64(self
.id_
)
343 out
.putPrefixedString(self
.name_
)
345 def OutputPartial(self
, out
):
348 out
.putPrefixedString(self
.kind_
)
351 out
.putVarInt64(self
.id_
)
354 out
.putPrefixedString(self
.name_
)
356 def TryMerge(self
, d
):
360 self
.set_kind(d
.getPrefixedString())
363 self
.set_id(d
.getVarInt64())
366 self
.set_name(d
.getPrefixedString())
370 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
374 def __str__(self
, prefix
="", printElemNumber
=0):
376 if self
.has_kind_
: res
+=prefix
+("kind: %s\n" % self
.DebugFormatString(self
.kind_
))
377 if self
.has_id_
: res
+=prefix
+("id: %s\n" % self
.DebugFormatInt64(self
.id_
))
378 if self
.has_name_
: res
+=prefix
+("name: %s\n" % self
.DebugFormatString(self
.name_
))
382 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
383 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
389 _TEXT
= _BuildTagLookupTable({
396 _TYPES
= _BuildTagLookupTable({
397 0: ProtocolBuffer
.Encoder
.NUMERIC
,
398 1: ProtocolBuffer
.Encoder
.STRING
,
399 2: ProtocolBuffer
.Encoder
.NUMERIC
,
400 3: ProtocolBuffer
.Encoder
.STRING
,
401 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
405 _STYLE_CONTENT_TYPE
= """"""
406 _PROTO_DESCRIPTOR_NAME
= 'apphosting.datastore.v4.Key_PathElement'
407 _SERIALIZED_DESCRIPTOR
= array
.array('B')
408 _SERIALIZED_DESCRIPTOR
.fromstring(base64
.decodestring("WiRhcHBob3N0aW5nL2RhdGFzdG9yZS9lbnRpdHlfdjQucHJvdG8KJ2FwcGhvc3RpbmcuZGF0YXN0b3JlLnY0LktleV9QYXRoRWxlbWVudBMaBGtpbmQgASgCMAk4AhQTGgJpZCACKAAwAzgBFBMaBG5hbWUgAygCMAk4ARTCASNhcHBob3N0aW5nLmRhdGFzdG9yZS52NC5QYXJ0aXRpb25JZMoBJ2FwcGhvc3RpbmcuZGF0YXN0b3JlLnY0LktleS5QYXRoRWxlbWVudA=="))
409 if _net_proto___parse__python
is not None:
410 _net_proto___parse__python
.RegisterType(
411 _SERIALIZED_DESCRIPTOR
.tostring())
413 class Key(ProtocolBuffer
.ProtocolMessage
):
414 has_partition_id_
= 0
417 def __init__(self
, contents
=None):
418 self
.path_element_
= []
419 self
.lazy_init_lock_
= thread
.allocate_lock()
420 if contents
is not None: self
.MergeFromString(contents
)
422 def partition_id(self
):
423 if self
.partition_id_
is None:
424 self
.lazy_init_lock_
.acquire()
426 if self
.partition_id_
is None: self
.partition_id_
= PartitionId()
428 self
.lazy_init_lock_
.release()
429 return self
.partition_id_
431 def mutable_partition_id(self
): self
.has_partition_id_
= 1; return self
.partition_id()
433 def clear_partition_id(self
):
435 if self
.has_partition_id_
:
436 self
.has_partition_id_
= 0;
437 if self
.partition_id_
is not None: self
.partition_id_
.Clear()
439 def has_partition_id(self
): return self
.has_partition_id_
441 def path_element_size(self
): return len(self
.path_element_
)
442 def path_element_list(self
): return self
.path_element_
444 def path_element(self
, i
):
445 return self
.path_element_
[i
]
447 def mutable_path_element(self
, i
):
448 return self
.path_element_
[i
]
450 def add_path_element(self
):
451 x
= Key_PathElement()
452 self
.path_element_
.append(x
)
455 def clear_path_element(self
):
456 self
.path_element_
= []
458 def MergeFrom(self
, x
):
460 if (x
.has_partition_id()): self
.mutable_partition_id().MergeFrom(x
.partition_id())
461 for i
in xrange(x
.path_element_size()): self
.add_path_element().CopyFrom(x
.path_element(i
))
463 if _net_proto___parse__python
is not None:
464 def _CMergeFromString(self
, s
):
465 _net_proto___parse__python
.MergeFromString(self
, 'apphosting.datastore.v4.Key', s
)
467 if _net_proto___parse__python
is not None:
469 return _net_proto___parse__python
.Encode(self
, 'apphosting.datastore.v4.Key')
471 if _net_proto___parse__python
is not None:
472 def _CEncodePartial(self
):
473 return _net_proto___parse__python
.EncodePartial(self
, 'apphosting.datastore.v4.Key')
475 if _net_proto___parse__python
is not None:
476 def _CToASCII(self
, output_format
):
477 return _net_proto___parse__python
.ToASCII(self
, 'apphosting.datastore.v4.Key', output_format
)
480 if _net_proto___parse__python
is not None:
481 def ParseASCII(self
, s
):
482 _net_proto___parse__python
.ParseASCII(self
, 'apphosting.datastore.v4.Key', s
)
485 if _net_proto___parse__python
is not None:
486 def ParseASCIIIgnoreUnknown(self
, s
):
487 _net_proto___parse__python
.ParseASCIIIgnoreUnknown(self
, 'apphosting.datastore.v4.Key', s
)
491 if x
is self
: return 1
492 if self
.has_partition_id_
!= x
.has_partition_id_
: return 0
493 if self
.has_partition_id_
and self
.partition_id_
!= x
.partition_id_
: return 0
494 if len(self
.path_element_
) != len(x
.path_element_
): return 0
495 for e1
, e2
in zip(self
.path_element_
, x
.path_element_
):
496 if e1
!= e2
: return 0
499 def IsInitialized(self
, debug_strs
=None):
501 if (self
.has_partition_id_
and not self
.partition_id_
.IsInitialized(debug_strs
)): initialized
= 0
502 for p
in self
.path_element_
:
503 if not p
.IsInitialized(debug_strs
): initialized
=0
508 if (self
.has_partition_id_
): n
+= 1 + self
.lengthString(self
.partition_id_
.ByteSize())
509 n
+= 1 * len(self
.path_element_
)
510 for i
in xrange(len(self
.path_element_
)): n
+= self
.lengthString(self
.path_element_
[i
].ByteSize())
513 def ByteSizePartial(self
):
515 if (self
.has_partition_id_
): n
+= 1 + self
.lengthString(self
.partition_id_
.ByteSizePartial())
516 n
+= 1 * len(self
.path_element_
)
517 for i
in xrange(len(self
.path_element_
)): n
+= self
.lengthString(self
.path_element_
[i
].ByteSizePartial())
521 self
.clear_partition_id()
522 self
.clear_path_element()
524 def OutputUnchecked(self
, out
):
525 if (self
.has_partition_id_
):
527 out
.putVarInt32(self
.partition_id_
.ByteSize())
528 self
.partition_id_
.OutputUnchecked(out
)
529 for i
in xrange(len(self
.path_element_
)):
531 out
.putVarInt32(self
.path_element_
[i
].ByteSize())
532 self
.path_element_
[i
].OutputUnchecked(out
)
534 def OutputPartial(self
, out
):
535 if (self
.has_partition_id_
):
537 out
.putVarInt32(self
.partition_id_
.ByteSizePartial())
538 self
.partition_id_
.OutputPartial(out
)
539 for i
in xrange(len(self
.path_element_
)):
541 out
.putVarInt32(self
.path_element_
[i
].ByteSizePartial())
542 self
.path_element_
[i
].OutputPartial(out
)
544 def TryMerge(self
, d
):
548 length
= d
.getVarInt32()
549 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
551 self
.mutable_partition_id().TryMerge(tmp
)
554 length
= d
.getVarInt32()
555 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
557 self
.add_path_element().TryMerge(tmp
)
561 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
565 def __str__(self
, prefix
="", printElemNumber
=0):
567 if self
.has_partition_id_
:
568 res
+=prefix
+"partition_id <\n"
569 res
+=self
.partition_id_
.__str
__(prefix
+ " ", printElemNumber
)
572 for e
in self
.path_element_
:
574 if printElemNumber
: elm
="(%d)" % cnt
575 res
+=prefix
+("path_element%s <\n" % elm
)
576 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
582 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
583 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
588 _TEXT
= _BuildTagLookupTable({
594 _TYPES
= _BuildTagLookupTable({
595 0: ProtocolBuffer
.Encoder
.NUMERIC
,
596 1: ProtocolBuffer
.Encoder
.STRING
,
597 2: ProtocolBuffer
.Encoder
.STRING
,
598 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
602 _STYLE_CONTENT_TYPE
= """"""
603 _PROTO_DESCRIPTOR_NAME
= 'apphosting.datastore.v4.Key'
604 _SERIALIZED_DESCRIPTOR
= array
.array('B')
605 _SERIALIZED_DESCRIPTOR
.fromstring(base64
.decodestring("WiRhcHBob3N0aW5nL2RhdGFzdG9yZS9lbnRpdHlfdjQucHJvdG8KG2FwcGhvc3RpbmcuZGF0YXN0b3JlLnY0LktleRMaDHBhcnRpdGlvbl9pZCABKAIwCzgBSiNhcHBob3N0aW5nLmRhdGFzdG9yZS52NC5QYXJ0aXRpb25JZKMBqgEFY3R5cGWyAQZwcm90bzKkARQTGgxwYXRoX2VsZW1lbnQgAigCMAs4A0onYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuS2V5X1BhdGhFbGVtZW50owGqAQVjdHlwZbIBBnByb3RvMqQBFMIBI2FwcGhvc3RpbmcuZGF0YXN0b3JlLnY0LlBhcnRpdGlvbklk"))
606 if _net_proto___parse__python
is not None:
607 _net_proto___parse__python
.RegisterType(
608 _SERIALIZED_DESCRIPTOR
.tostring())
610 class Value(ProtocolBuffer
.ProtocolMessage
):
611 has_boolean_value_
= 0
613 has_integer_value_
= 0
615 has_double_value_
= 0
617 has_timestamp_microseconds_value_
= 0
618 timestamp_microseconds_value_
= 0
621 has_blob_key_value_
= 0
623 has_string_value_
= 0
627 has_entity_value_
= 0
634 def __init__(self
, contents
=None):
635 self
.list_value_
= []
636 self
.lazy_init_lock_
= thread
.allocate_lock()
637 if contents
is not None: self
.MergeFromString(contents
)
639 def boolean_value(self
): return self
.boolean_value_
641 def set_boolean_value(self
, x
):
642 self
.has_boolean_value_
= 1
643 self
.boolean_value_
= x
645 def clear_boolean_value(self
):
646 if self
.has_boolean_value_
:
647 self
.has_boolean_value_
= 0
648 self
.boolean_value_
= 0
650 def has_boolean_value(self
): return self
.has_boolean_value_
652 def integer_value(self
): return self
.integer_value_
654 def set_integer_value(self
, x
):
655 self
.has_integer_value_
= 1
656 self
.integer_value_
= x
658 def clear_integer_value(self
):
659 if self
.has_integer_value_
:
660 self
.has_integer_value_
= 0
661 self
.integer_value_
= 0
663 def has_integer_value(self
): return self
.has_integer_value_
665 def double_value(self
): return self
.double_value_
667 def set_double_value(self
, x
):
668 self
.has_double_value_
= 1
669 self
.double_value_
= x
671 def clear_double_value(self
):
672 if self
.has_double_value_
:
673 self
.has_double_value_
= 0
674 self
.double_value_
= 0.0
676 def has_double_value(self
): return self
.has_double_value_
678 def timestamp_microseconds_value(self
): return self
.timestamp_microseconds_value_
680 def set_timestamp_microseconds_value(self
, x
):
681 self
.has_timestamp_microseconds_value_
= 1
682 self
.timestamp_microseconds_value_
= x
684 def clear_timestamp_microseconds_value(self
):
685 if self
.has_timestamp_microseconds_value_
:
686 self
.has_timestamp_microseconds_value_
= 0
687 self
.timestamp_microseconds_value_
= 0
689 def has_timestamp_microseconds_value(self
): return self
.has_timestamp_microseconds_value_
692 if self
.key_value_
is None:
693 self
.lazy_init_lock_
.acquire()
695 if self
.key_value_
is None: self
.key_value_
= Key()
697 self
.lazy_init_lock_
.release()
698 return self
.key_value_
700 def mutable_key_value(self
): self
.has_key_value_
= 1; return self
.key_value()
702 def clear_key_value(self
):
704 if self
.has_key_value_
:
705 self
.has_key_value_
= 0;
706 if self
.key_value_
is not None: self
.key_value_
.Clear()
708 def has_key_value(self
): return self
.has_key_value_
710 def blob_key_value(self
): return self
.blob_key_value_
712 def set_blob_key_value(self
, x
):
713 self
.has_blob_key_value_
= 1
714 self
.blob_key_value_
= x
716 def clear_blob_key_value(self
):
717 if self
.has_blob_key_value_
:
718 self
.has_blob_key_value_
= 0
719 self
.blob_key_value_
= ""
721 def has_blob_key_value(self
): return self
.has_blob_key_value_
723 def string_value(self
): return self
.string_value_
725 def set_string_value(self
, x
):
726 self
.has_string_value_
= 1
727 self
.string_value_
= x
729 def clear_string_value(self
):
730 if self
.has_string_value_
:
731 self
.has_string_value_
= 0
732 self
.string_value_
= ""
734 def has_string_value(self
): return self
.has_string_value_
736 def blob_value(self
): return self
.blob_value_
738 def set_blob_value(self
, x
):
739 self
.has_blob_value_
= 1
742 def clear_blob_value(self
):
743 if self
.has_blob_value_
:
744 self
.has_blob_value_
= 0
745 self
.blob_value_
= ""
747 def has_blob_value(self
): return self
.has_blob_value_
749 def entity_value(self
):
750 if self
.entity_value_
is None:
751 self
.lazy_init_lock_
.acquire()
753 if self
.entity_value_
is None: self
.entity_value_
= Entity()
755 self
.lazy_init_lock_
.release()
756 return self
.entity_value_
758 def mutable_entity_value(self
): self
.has_entity_value_
= 1; return self
.entity_value()
760 def clear_entity_value(self
):
762 if self
.has_entity_value_
:
763 self
.has_entity_value_
= 0;
764 if self
.entity_value_
is not None: self
.entity_value_
.Clear()
766 def has_entity_value(self
): return self
.has_entity_value_
768 def list_value_size(self
): return len(self
.list_value_
)
769 def list_value_list(self
): return self
.list_value_
771 def list_value(self
, i
):
772 return self
.list_value_
[i
]
774 def mutable_list_value(self
, i
):
775 return self
.list_value_
[i
]
777 def add_list_value(self
):
779 self
.list_value_
.append(x
)
782 def clear_list_value(self
):
783 self
.list_value_
= []
784 def meaning(self
): return self
.meaning_
786 def set_meaning(self
, x
):
787 self
.has_meaning_
= 1
790 def clear_meaning(self
):
791 if self
.has_meaning_
:
792 self
.has_meaning_
= 0
795 def has_meaning(self
): return self
.has_meaning_
797 def indexed(self
): return self
.indexed_
799 def set_indexed(self
, x
):
800 self
.has_indexed_
= 1
803 def clear_indexed(self
):
804 if self
.has_indexed_
:
805 self
.has_indexed_
= 0
808 def has_indexed(self
): return self
.has_indexed_
811 def MergeFrom(self
, x
):
813 if (x
.has_boolean_value()): self
.set_boolean_value(x
.boolean_value())
814 if (x
.has_integer_value()): self
.set_integer_value(x
.integer_value())
815 if (x
.has_double_value()): self
.set_double_value(x
.double_value())
816 if (x
.has_timestamp_microseconds_value()): self
.set_timestamp_microseconds_value(x
.timestamp_microseconds_value())
817 if (x
.has_key_value()): self
.mutable_key_value().MergeFrom(x
.key_value())
818 if (x
.has_blob_key_value()): self
.set_blob_key_value(x
.blob_key_value())
819 if (x
.has_string_value()): self
.set_string_value(x
.string_value())
820 if (x
.has_blob_value()): self
.set_blob_value(x
.blob_value())
821 if (x
.has_entity_value()): self
.mutable_entity_value().MergeFrom(x
.entity_value())
822 for i
in xrange(x
.list_value_size()): self
.add_list_value().CopyFrom(x
.list_value(i
))
823 if (x
.has_meaning()): self
.set_meaning(x
.meaning())
824 if (x
.has_indexed()): self
.set_indexed(x
.indexed())
826 if _net_proto___parse__python
is not None:
827 def _CMergeFromString(self
, s
):
828 _net_proto___parse__python
.MergeFromString(self
, 'apphosting.datastore.v4.Value', s
)
830 if _net_proto___parse__python
is not None:
832 return _net_proto___parse__python
.Encode(self
, 'apphosting.datastore.v4.Value')
834 if _net_proto___parse__python
is not None:
835 def _CEncodePartial(self
):
836 return _net_proto___parse__python
.EncodePartial(self
, 'apphosting.datastore.v4.Value')
838 if _net_proto___parse__python
is not None:
839 def _CToASCII(self
, output_format
):
840 return _net_proto___parse__python
.ToASCII(self
, 'apphosting.datastore.v4.Value', output_format
)
843 if _net_proto___parse__python
is not None:
844 def ParseASCII(self
, s
):
845 _net_proto___parse__python
.ParseASCII(self
, 'apphosting.datastore.v4.Value', s
)
848 if _net_proto___parse__python
is not None:
849 def ParseASCIIIgnoreUnknown(self
, s
):
850 _net_proto___parse__python
.ParseASCIIIgnoreUnknown(self
, 'apphosting.datastore.v4.Value', s
)
854 if x
is self
: return 1
855 if self
.has_boolean_value_
!= x
.has_boolean_value_
: return 0
856 if self
.has_boolean_value_
and self
.boolean_value_
!= x
.boolean_value_
: return 0
857 if self
.has_integer_value_
!= x
.has_integer_value_
: return 0
858 if self
.has_integer_value_
and self
.integer_value_
!= x
.integer_value_
: return 0
859 if self
.has_double_value_
!= x
.has_double_value_
: return 0
860 if self
.has_double_value_
and self
.double_value_
!= x
.double_value_
: return 0
861 if self
.has_timestamp_microseconds_value_
!= x
.has_timestamp_microseconds_value_
: return 0
862 if self
.has_timestamp_microseconds_value_
and self
.timestamp_microseconds_value_
!= x
.timestamp_microseconds_value_
: return 0
863 if self
.has_key_value_
!= x
.has_key_value_
: return 0
864 if self
.has_key_value_
and self
.key_value_
!= x
.key_value_
: return 0
865 if self
.has_blob_key_value_
!= x
.has_blob_key_value_
: return 0
866 if self
.has_blob_key_value_
and self
.blob_key_value_
!= x
.blob_key_value_
: return 0
867 if self
.has_string_value_
!= x
.has_string_value_
: return 0
868 if self
.has_string_value_
and self
.string_value_
!= x
.string_value_
: return 0
869 if self
.has_blob_value_
!= x
.has_blob_value_
: return 0
870 if self
.has_blob_value_
and self
.blob_value_
!= x
.blob_value_
: return 0
871 if self
.has_entity_value_
!= x
.has_entity_value_
: return 0
872 if self
.has_entity_value_
and self
.entity_value_
!= x
.entity_value_
: return 0
873 if len(self
.list_value_
) != len(x
.list_value_
): return 0
874 for e1
, e2
in zip(self
.list_value_
, x
.list_value_
):
875 if e1
!= e2
: return 0
876 if self
.has_meaning_
!= x
.has_meaning_
: return 0
877 if self
.has_meaning_
and self
.meaning_
!= x
.meaning_
: return 0
878 if self
.has_indexed_
!= x
.has_indexed_
: return 0
879 if self
.has_indexed_
and self
.indexed_
!= x
.indexed_
: return 0
882 def IsInitialized(self
, debug_strs
=None):
884 if (self
.has_key_value_
and not self
.key_value_
.IsInitialized(debug_strs
)): initialized
= 0
885 if (self
.has_entity_value_
and not self
.entity_value_
.IsInitialized(debug_strs
)): initialized
= 0
886 for p
in self
.list_value_
:
887 if not p
.IsInitialized(debug_strs
): initialized
=0
892 if (self
.has_boolean_value_
): n
+= 2
893 if (self
.has_integer_value_
): n
+= 1 + self
.lengthVarInt64(self
.integer_value_
)
894 if (self
.has_double_value_
): n
+= 9
895 if (self
.has_timestamp_microseconds_value_
): n
+= 1 + self
.lengthVarInt64(self
.timestamp_microseconds_value_
)
896 if (self
.has_key_value_
): n
+= 1 + self
.lengthString(self
.key_value_
.ByteSize())
897 if (self
.has_blob_key_value_
): n
+= 2 + self
.lengthString(len(self
.blob_key_value_
))
898 if (self
.has_string_value_
): n
+= 2 + self
.lengthString(len(self
.string_value_
))
899 if (self
.has_blob_value_
): n
+= 2 + self
.lengthString(len(self
.blob_value_
))
900 if (self
.has_entity_value_
): n
+= 1 + self
.lengthString(self
.entity_value_
.ByteSize())
901 n
+= 1 * len(self
.list_value_
)
902 for i
in xrange(len(self
.list_value_
)): n
+= self
.lengthString(self
.list_value_
[i
].ByteSize())
903 if (self
.has_meaning_
): n
+= 1 + self
.lengthVarInt64(self
.meaning_
)
904 if (self
.has_indexed_
): n
+= 2
907 def ByteSizePartial(self
):
909 if (self
.has_boolean_value_
): n
+= 2
910 if (self
.has_integer_value_
): n
+= 1 + self
.lengthVarInt64(self
.integer_value_
)
911 if (self
.has_double_value_
): n
+= 9
912 if (self
.has_timestamp_microseconds_value_
): n
+= 1 + self
.lengthVarInt64(self
.timestamp_microseconds_value_
)
913 if (self
.has_key_value_
): n
+= 1 + self
.lengthString(self
.key_value_
.ByteSizePartial())
914 if (self
.has_blob_key_value_
): n
+= 2 + self
.lengthString(len(self
.blob_key_value_
))
915 if (self
.has_string_value_
): n
+= 2 + self
.lengthString(len(self
.string_value_
))
916 if (self
.has_blob_value_
): n
+= 2 + self
.lengthString(len(self
.blob_value_
))
917 if (self
.has_entity_value_
): n
+= 1 + self
.lengthString(self
.entity_value_
.ByteSizePartial())
918 n
+= 1 * len(self
.list_value_
)
919 for i
in xrange(len(self
.list_value_
)): n
+= self
.lengthString(self
.list_value_
[i
].ByteSizePartial())
920 if (self
.has_meaning_
): n
+= 1 + self
.lengthVarInt64(self
.meaning_
)
921 if (self
.has_indexed_
): n
+= 2
925 self
.clear_boolean_value()
926 self
.clear_integer_value()
927 self
.clear_double_value()
928 self
.clear_timestamp_microseconds_value()
929 self
.clear_key_value()
930 self
.clear_blob_key_value()
931 self
.clear_string_value()
932 self
.clear_blob_value()
933 self
.clear_entity_value()
934 self
.clear_list_value()
938 def OutputUnchecked(self
, out
):
939 if (self
.has_boolean_value_
):
941 out
.putBoolean(self
.boolean_value_
)
942 if (self
.has_integer_value_
):
944 out
.putVarInt64(self
.integer_value_
)
945 if (self
.has_double_value_
):
947 out
.putDouble(self
.double_value_
)
948 if (self
.has_timestamp_microseconds_value_
):
950 out
.putVarInt64(self
.timestamp_microseconds_value_
)
951 if (self
.has_key_value_
):
953 out
.putVarInt32(self
.key_value_
.ByteSize())
954 self
.key_value_
.OutputUnchecked(out
)
955 if (self
.has_entity_value_
):
957 out
.putVarInt32(self
.entity_value_
.ByteSize())
958 self
.entity_value_
.OutputUnchecked(out
)
959 for i
in xrange(len(self
.list_value_
)):
961 out
.putVarInt32(self
.list_value_
[i
].ByteSize())
962 self
.list_value_
[i
].OutputUnchecked(out
)
963 if (self
.has_meaning_
):
965 out
.putVarInt32(self
.meaning_
)
966 if (self
.has_indexed_
):
968 out
.putBoolean(self
.indexed_
)
969 if (self
.has_blob_key_value_
):
971 out
.putPrefixedString(self
.blob_key_value_
)
972 if (self
.has_string_value_
):
974 out
.putPrefixedString(self
.string_value_
)
975 if (self
.has_blob_value_
):
977 out
.putPrefixedString(self
.blob_value_
)
979 def OutputPartial(self
, out
):
980 if (self
.has_boolean_value_
):
982 out
.putBoolean(self
.boolean_value_
)
983 if (self
.has_integer_value_
):
985 out
.putVarInt64(self
.integer_value_
)
986 if (self
.has_double_value_
):
988 out
.putDouble(self
.double_value_
)
989 if (self
.has_timestamp_microseconds_value_
):
991 out
.putVarInt64(self
.timestamp_microseconds_value_
)
992 if (self
.has_key_value_
):
994 out
.putVarInt32(self
.key_value_
.ByteSizePartial())
995 self
.key_value_
.OutputPartial(out
)
996 if (self
.has_entity_value_
):
998 out
.putVarInt32(self
.entity_value_
.ByteSizePartial())
999 self
.entity_value_
.OutputPartial(out
)
1000 for i
in xrange(len(self
.list_value_
)):
1002 out
.putVarInt32(self
.list_value_
[i
].ByteSizePartial())
1003 self
.list_value_
[i
].OutputPartial(out
)
1004 if (self
.has_meaning_
):
1005 out
.putVarInt32(112)
1006 out
.putVarInt32(self
.meaning_
)
1007 if (self
.has_indexed_
):
1008 out
.putVarInt32(120)
1009 out
.putBoolean(self
.indexed_
)
1010 if (self
.has_blob_key_value_
):
1011 out
.putVarInt32(130)
1012 out
.putPrefixedString(self
.blob_key_value_
)
1013 if (self
.has_string_value_
):
1014 out
.putVarInt32(138)
1015 out
.putPrefixedString(self
.string_value_
)
1016 if (self
.has_blob_value_
):
1017 out
.putVarInt32(146)
1018 out
.putPrefixedString(self
.blob_value_
)
1020 def TryMerge(self
, d
):
1021 while d
.avail() > 0:
1022 tt
= d
.getVarInt32()
1024 self
.set_boolean_value(d
.getBoolean())
1027 self
.set_integer_value(d
.getVarInt64())
1030 self
.set_double_value(d
.getDouble())
1033 self
.set_timestamp_microseconds_value(d
.getVarInt64())
1036 length
= d
.getVarInt32()
1037 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1039 self
.mutable_key_value().TryMerge(tmp
)
1042 length
= d
.getVarInt32()
1043 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1045 self
.mutable_entity_value().TryMerge(tmp
)
1048 length
= d
.getVarInt32()
1049 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1051 self
.add_list_value().TryMerge(tmp
)
1054 self
.set_meaning(d
.getVarInt32())
1057 self
.set_indexed(d
.getBoolean())
1060 self
.set_blob_key_value(d
.getPrefixedString())
1063 self
.set_string_value(d
.getPrefixedString())
1066 self
.set_blob_value(d
.getPrefixedString())
1070 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1074 def __str__(self
, prefix
="", printElemNumber
=0):
1076 if self
.has_boolean_value_
: res
+=prefix
+("boolean_value: %s\n" % self
.DebugFormatBool(self
.boolean_value_
))
1077 if self
.has_integer_value_
: res
+=prefix
+("integer_value: %s\n" % self
.DebugFormatInt64(self
.integer_value_
))
1078 if self
.has_double_value_
: res
+=prefix
+("double_value: %s\n" % self
.DebugFormat(self
.double_value_
))
1079 if self
.has_timestamp_microseconds_value_
: res
+=prefix
+("timestamp_microseconds_value: %s\n" % self
.DebugFormatInt64(self
.timestamp_microseconds_value_
))
1080 if self
.has_key_value_
:
1081 res
+=prefix
+"key_value <\n"
1082 res
+=self
.key_value_
.__str
__(prefix
+ " ", printElemNumber
)
1084 if self
.has_blob_key_value_
: res
+=prefix
+("blob_key_value: %s\n" % self
.DebugFormatString(self
.blob_key_value_
))
1085 if self
.has_string_value_
: res
+=prefix
+("string_value: %s\n" % self
.DebugFormatString(self
.string_value_
))
1086 if self
.has_blob_value_
: res
+=prefix
+("blob_value: %s\n" % self
.DebugFormatString(self
.blob_value_
))
1087 if self
.has_entity_value_
:
1088 res
+=prefix
+"entity_value <\n"
1089 res
+=self
.entity_value_
.__str
__(prefix
+ " ", printElemNumber
)
1092 for e
in self
.list_value_
:
1094 if printElemNumber
: elm
="(%d)" % cnt
1095 res
+=prefix
+("list_value%s <\n" % elm
)
1096 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
1099 if self
.has_meaning_
: res
+=prefix
+("meaning: %s\n" % self
.DebugFormatInt32(self
.meaning_
))
1100 if self
.has_indexed_
: res
+=prefix
+("indexed: %s\n" % self
.DebugFormatBool(self
.indexed_
))
1104 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1105 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1110 ktimestamp_microseconds_value
= 4
1112 kblob_key_value
= 16
1120 _TEXT
= _BuildTagLookupTable({
1125 4: "timestamp_microseconds_value",
1131 16: "blob_key_value",
1136 _TYPES
= _BuildTagLookupTable({
1137 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1138 1: ProtocolBuffer
.Encoder
.NUMERIC
,
1139 2: ProtocolBuffer
.Encoder
.NUMERIC
,
1140 3: ProtocolBuffer
.Encoder
.DOUBLE
,
1141 4: ProtocolBuffer
.Encoder
.NUMERIC
,
1142 5: ProtocolBuffer
.Encoder
.STRING
,
1143 6: ProtocolBuffer
.Encoder
.STRING
,
1144 7: ProtocolBuffer
.Encoder
.STRING
,
1145 14: ProtocolBuffer
.Encoder
.NUMERIC
,
1146 15: ProtocolBuffer
.Encoder
.NUMERIC
,
1147 16: ProtocolBuffer
.Encoder
.STRING
,
1148 17: ProtocolBuffer
.Encoder
.STRING
,
1149 18: ProtocolBuffer
.Encoder
.STRING
,
1150 }, 18, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1154 _STYLE_CONTENT_TYPE
= """"""
1155 _PROTO_DESCRIPTOR_NAME
= 'apphosting.datastore.v4.Value'
1156 _SERIALIZED_DESCRIPTOR
= array
.array('B')
1157 _SERIALIZED_DESCRIPTOR
.fromstring(base64
.decodestring("WiRhcHBob3N0aW5nL2RhdGFzdG9yZS9lbnRpdHlfdjQucHJvdG8KHWFwcGhvc3RpbmcuZGF0YXN0b3JlLnY0LlZhbHVlExoNYm9vbGVhbl92YWx1ZSABKAAwCDgBFBMaDWludGVnZXJfdmFsdWUgAigAMAM4ARQTGgxkb3VibGVfdmFsdWUgAygBMAE4ARQTGhx0aW1lc3RhbXBfbWljcm9zZWNvbmRzX3ZhbHVlIAQoADADOAEUExoJa2V5X3ZhbHVlIAUoAjALOAFKG2FwcGhvc3RpbmcuZGF0YXN0b3JlLnY0LktleaMBqgEFY3R5cGWyAQZwcm90bzKkARQTGg5ibG9iX2tleV92YWx1ZSAQKAIwCTgBFBMaDHN0cmluZ192YWx1ZSARKAIwCTgBFBMaCmJsb2JfdmFsdWUgEigCMAk4ARQTGgxlbnRpdHlfdmFsdWUgBigCMAs4AUoeYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuRW50aXR5owGqAQVjdHlwZbIBBnByb3RvMqQBFBMaCmxpc3RfdmFsdWUgBygCMAs4A0odYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuVmFsdWWjAaoBBWN0eXBlsgEGcHJvdG8ypAEUExoHbWVhbmluZyAOKAAwBTgBFBMaB2luZGV4ZWQgDygAMAg4AUIEdHJ1ZaMBqgEHZGVmYXVsdLIBBHRydWWkARTCASNhcHBob3N0aW5nLmRhdGFzdG9yZS52NC5QYXJ0aXRpb25JZA=="))
1158 if _net_proto___parse__python
is not None:
1159 _net_proto___parse__python
.RegisterType(
1160 _SERIALIZED_DESCRIPTOR
.tostring())
1162 class Property(ProtocolBuffer
.ProtocolMessage
):
1165 has_deprecated_multi_
= 0
1166 deprecated_multi_
= 0
1170 def __init__(self
, contents
=None):
1171 self
.deprecated_value_
= []
1172 self
.lazy_init_lock_
= thread
.allocate_lock()
1173 if contents
is not None: self
.MergeFromString(contents
)
1175 def name(self
): return self
.name_
1177 def set_name(self
, x
):
1181 def clear_name(self
):
1186 def has_name(self
): return self
.has_name_
1188 def deprecated_multi(self
): return self
.deprecated_multi_
1190 def set_deprecated_multi(self
, x
):
1191 self
.has_deprecated_multi_
= 1
1192 self
.deprecated_multi_
= x
1194 def clear_deprecated_multi(self
):
1195 if self
.has_deprecated_multi_
:
1196 self
.has_deprecated_multi_
= 0
1197 self
.deprecated_multi_
= 0
1199 def has_deprecated_multi(self
): return self
.has_deprecated_multi_
1201 def deprecated_value_size(self
): return len(self
.deprecated_value_
)
1202 def deprecated_value_list(self
): return self
.deprecated_value_
1204 def deprecated_value(self
, i
):
1205 return self
.deprecated_value_
[i
]
1207 def mutable_deprecated_value(self
, i
):
1208 return self
.deprecated_value_
[i
]
1210 def add_deprecated_value(self
):
1212 self
.deprecated_value_
.append(x
)
1215 def clear_deprecated_value(self
):
1216 self
.deprecated_value_
= []
1218 if self
.value_
is None:
1219 self
.lazy_init_lock_
.acquire()
1221 if self
.value_
is None: self
.value_
= Value()
1223 self
.lazy_init_lock_
.release()
1226 def mutable_value(self
): self
.has_value_
= 1; return self
.value()
1228 def clear_value(self
):
1231 self
.has_value_
= 0;
1232 if self
.value_
is not None: self
.value_
.Clear()
1234 def has_value(self
): return self
.has_value_
1237 def MergeFrom(self
, x
):
1238 assert x
is not self
1239 if (x
.has_name()): self
.set_name(x
.name())
1240 if (x
.has_deprecated_multi()): self
.set_deprecated_multi(x
.deprecated_multi())
1241 for i
in xrange(x
.deprecated_value_size()): self
.add_deprecated_value().CopyFrom(x
.deprecated_value(i
))
1242 if (x
.has_value()): self
.mutable_value().MergeFrom(x
.value())
1244 if _net_proto___parse__python
is not None:
1245 def _CMergeFromString(self
, s
):
1246 _net_proto___parse__python
.MergeFromString(self
, 'apphosting.datastore.v4.Property', s
)
1248 if _net_proto___parse__python
is not None:
1250 return _net_proto___parse__python
.Encode(self
, 'apphosting.datastore.v4.Property')
1252 if _net_proto___parse__python
is not None:
1253 def _CEncodePartial(self
):
1254 return _net_proto___parse__python
.EncodePartial(self
, 'apphosting.datastore.v4.Property')
1256 if _net_proto___parse__python
is not None:
1257 def _CToASCII(self
, output_format
):
1258 return _net_proto___parse__python
.ToASCII(self
, 'apphosting.datastore.v4.Property', output_format
)
1261 if _net_proto___parse__python
is not None:
1262 def ParseASCII(self
, s
):
1263 _net_proto___parse__python
.ParseASCII(self
, 'apphosting.datastore.v4.Property', s
)
1266 if _net_proto___parse__python
is not None:
1267 def ParseASCIIIgnoreUnknown(self
, s
):
1268 _net_proto___parse__python
.ParseASCIIIgnoreUnknown(self
, 'apphosting.datastore.v4.Property', s
)
1271 def Equals(self
, x
):
1272 if x
is self
: return 1
1273 if self
.has_name_
!= x
.has_name_
: return 0
1274 if self
.has_name_
and self
.name_
!= x
.name_
: return 0
1275 if self
.has_deprecated_multi_
!= x
.has_deprecated_multi_
: return 0
1276 if self
.has_deprecated_multi_
and self
.deprecated_multi_
!= x
.deprecated_multi_
: return 0
1277 if len(self
.deprecated_value_
) != len(x
.deprecated_value_
): return 0
1278 for e1
, e2
in zip(self
.deprecated_value_
, x
.deprecated_value_
):
1279 if e1
!= e2
: return 0
1280 if self
.has_value_
!= x
.has_value_
: return 0
1281 if self
.has_value_
and self
.value_
!= x
.value_
: return 0
1284 def IsInitialized(self
, debug_strs
=None):
1286 if (not self
.has_name_
):
1288 if debug_strs
is not None:
1289 debug_strs
.append('Required field: name not set.')
1290 for p
in self
.deprecated_value_
:
1291 if not p
.IsInitialized(debug_strs
): initialized
=0
1292 if (self
.has_value_
and not self
.value_
.IsInitialized(debug_strs
)): initialized
= 0
1297 n
+= self
.lengthString(len(self
.name_
))
1298 if (self
.has_deprecated_multi_
): n
+= 2
1299 n
+= 1 * len(self
.deprecated_value_
)
1300 for i
in xrange(len(self
.deprecated_value_
)): n
+= self
.lengthString(self
.deprecated_value_
[i
].ByteSize())
1301 if (self
.has_value_
): n
+= 1 + self
.lengthString(self
.value_
.ByteSize())
1304 def ByteSizePartial(self
):
1306 if (self
.has_name_
):
1308 n
+= self
.lengthString(len(self
.name_
))
1309 if (self
.has_deprecated_multi_
): n
+= 2
1310 n
+= 1 * len(self
.deprecated_value_
)
1311 for i
in xrange(len(self
.deprecated_value_
)): n
+= self
.lengthString(self
.deprecated_value_
[i
].ByteSizePartial())
1312 if (self
.has_value_
): n
+= 1 + self
.lengthString(self
.value_
.ByteSizePartial())
1317 self
.clear_deprecated_multi()
1318 self
.clear_deprecated_value()
1321 def OutputUnchecked(self
, out
):
1323 out
.putPrefixedString(self
.name_
)
1324 if (self
.has_deprecated_multi_
):
1326 out
.putBoolean(self
.deprecated_multi_
)
1327 for i
in xrange(len(self
.deprecated_value_
)):
1329 out
.putVarInt32(self
.deprecated_value_
[i
].ByteSize())
1330 self
.deprecated_value_
[i
].OutputUnchecked(out
)
1331 if (self
.has_value_
):
1333 out
.putVarInt32(self
.value_
.ByteSize())
1334 self
.value_
.OutputUnchecked(out
)
1336 def OutputPartial(self
, out
):
1337 if (self
.has_name_
):
1339 out
.putPrefixedString(self
.name_
)
1340 if (self
.has_deprecated_multi_
):
1342 out
.putBoolean(self
.deprecated_multi_
)
1343 for i
in xrange(len(self
.deprecated_value_
)):
1345 out
.putVarInt32(self
.deprecated_value_
[i
].ByteSizePartial())
1346 self
.deprecated_value_
[i
].OutputPartial(out
)
1347 if (self
.has_value_
):
1349 out
.putVarInt32(self
.value_
.ByteSizePartial())
1350 self
.value_
.OutputPartial(out
)
1352 def TryMerge(self
, d
):
1353 while d
.avail() > 0:
1354 tt
= d
.getVarInt32()
1356 self
.set_name(d
.getPrefixedString())
1359 self
.set_deprecated_multi(d
.getBoolean())
1362 length
= d
.getVarInt32()
1363 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1365 self
.add_deprecated_value().TryMerge(tmp
)
1368 length
= d
.getVarInt32()
1369 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1371 self
.mutable_value().TryMerge(tmp
)
1375 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1379 def __str__(self
, prefix
="", printElemNumber
=0):
1381 if self
.has_name_
: res
+=prefix
+("name: %s\n" % self
.DebugFormatString(self
.name_
))
1382 if self
.has_deprecated_multi_
: res
+=prefix
+("deprecated_multi: %s\n" % self
.DebugFormatBool(self
.deprecated_multi_
))
1384 for e
in self
.deprecated_value_
:
1386 if printElemNumber
: elm
="(%d)" % cnt
1387 res
+=prefix
+("deprecated_value%s <\n" % elm
)
1388 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
1392 res
+=prefix
+"value <\n"
1393 res
+=self
.value_
.__str
__(prefix
+ " ", printElemNumber
)
1398 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1399 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1402 kdeprecated_multi
= 2
1403 kdeprecated_value
= 3
1406 _TEXT
= _BuildTagLookupTable({
1409 2: "deprecated_multi",
1410 3: "deprecated_value",
1414 _TYPES
= _BuildTagLookupTable({
1415 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1416 1: ProtocolBuffer
.Encoder
.STRING
,
1417 2: ProtocolBuffer
.Encoder
.NUMERIC
,
1418 3: ProtocolBuffer
.Encoder
.STRING
,
1419 4: ProtocolBuffer
.Encoder
.STRING
,
1420 }, 4, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1424 _STYLE_CONTENT_TYPE
= """"""
1425 _PROTO_DESCRIPTOR_NAME
= 'apphosting.datastore.v4.Property'
1426 _SERIALIZED_DESCRIPTOR
= array
.array('B')
1427 _SERIALIZED_DESCRIPTOR
.fromstring(base64
.decodestring("WiRhcHBob3N0aW5nL2RhdGFzdG9yZS9lbnRpdHlfdjQucHJvdG8KIGFwcGhvc3RpbmcuZGF0YXN0b3JlLnY0LlByb3BlcnR5ExoEbmFtZSABKAIwCTgCFBMaEGRlcHJlY2F0ZWRfbXVsdGkgAigAMAg4AUIFZmFsc2WjAaoBB2RlZmF1bHSyAQVmYWxzZaQBFBMaEGRlcHJlY2F0ZWRfdmFsdWUgAygCMAs4A0odYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuVmFsdWWjAaoBBWN0eXBlsgEGcHJvdG8ypAEUExoFdmFsdWUgBCgCMAs4AUodYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuVmFsdWWjAaoBBWN0eXBlsgEGcHJvdG8ypAEUwgEjYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuUGFydGl0aW9uSWQ="))
1428 if _net_proto___parse__python
is not None:
1429 _net_proto___parse__python
.RegisterType(
1430 _SERIALIZED_DESCRIPTOR
.tostring())
1432 class Entity(ProtocolBuffer
.ProtocolMessage
):
1436 def __init__(self
, contents
=None):
1438 self
.lazy_init_lock_
= thread
.allocate_lock()
1439 if contents
is not None: self
.MergeFromString(contents
)
1442 if self
.key_
is None:
1443 self
.lazy_init_lock_
.acquire()
1445 if self
.key_
is None: self
.key_
= Key()
1447 self
.lazy_init_lock_
.release()
1450 def mutable_key(self
): self
.has_key_
= 1; return self
.key()
1452 def clear_key(self
):
1456 if self
.key_
is not None: self
.key_
.Clear()
1458 def has_key(self
): return self
.has_key_
1460 def property_size(self
): return len(self
.property_
)
1461 def property_list(self
): return self
.property_
1463 def property(self
, i
):
1464 return self
.property_
[i
]
1466 def mutable_property(self
, i
):
1467 return self
.property_
[i
]
1469 def add_property(self
):
1471 self
.property_
.append(x
)
1474 def clear_property(self
):
1477 def MergeFrom(self
, x
):
1478 assert x
is not self
1479 if (x
.has_key()): self
.mutable_key().MergeFrom(x
.key())
1480 for i
in xrange(x
.property_size()): self
.add_property().CopyFrom(x
.property(i
))
1482 if _net_proto___parse__python
is not None:
1483 def _CMergeFromString(self
, s
):
1484 _net_proto___parse__python
.MergeFromString(self
, 'apphosting.datastore.v4.Entity', s
)
1486 if _net_proto___parse__python
is not None:
1488 return _net_proto___parse__python
.Encode(self
, 'apphosting.datastore.v4.Entity')
1490 if _net_proto___parse__python
is not None:
1491 def _CEncodePartial(self
):
1492 return _net_proto___parse__python
.EncodePartial(self
, 'apphosting.datastore.v4.Entity')
1494 if _net_proto___parse__python
is not None:
1495 def _CToASCII(self
, output_format
):
1496 return _net_proto___parse__python
.ToASCII(self
, 'apphosting.datastore.v4.Entity', output_format
)
1499 if _net_proto___parse__python
is not None:
1500 def ParseASCII(self
, s
):
1501 _net_proto___parse__python
.ParseASCII(self
, 'apphosting.datastore.v4.Entity', s
)
1504 if _net_proto___parse__python
is not None:
1505 def ParseASCIIIgnoreUnknown(self
, s
):
1506 _net_proto___parse__python
.ParseASCIIIgnoreUnknown(self
, 'apphosting.datastore.v4.Entity', s
)
1509 def Equals(self
, x
):
1510 if x
is self
: return 1
1511 if self
.has_key_
!= x
.has_key_
: return 0
1512 if self
.has_key_
and self
.key_
!= x
.key_
: return 0
1513 if len(self
.property_
) != len(x
.property_
): return 0
1514 for e1
, e2
in zip(self
.property_
, x
.property_
):
1515 if e1
!= e2
: return 0
1518 def IsInitialized(self
, debug_strs
=None):
1520 if (self
.has_key_
and not self
.key_
.IsInitialized(debug_strs
)): initialized
= 0
1521 for p
in self
.property_
:
1522 if not p
.IsInitialized(debug_strs
): initialized
=0
1527 if (self
.has_key_
): n
+= 1 + self
.lengthString(self
.key_
.ByteSize())
1528 n
+= 1 * len(self
.property_
)
1529 for i
in xrange(len(self
.property_
)): n
+= self
.lengthString(self
.property_
[i
].ByteSize())
1532 def ByteSizePartial(self
):
1534 if (self
.has_key_
): n
+= 1 + self
.lengthString(self
.key_
.ByteSizePartial())
1535 n
+= 1 * len(self
.property_
)
1536 for i
in xrange(len(self
.property_
)): n
+= self
.lengthString(self
.property_
[i
].ByteSizePartial())
1541 self
.clear_property()
1543 def OutputUnchecked(self
, out
):
1546 out
.putVarInt32(self
.key_
.ByteSize())
1547 self
.key_
.OutputUnchecked(out
)
1548 for i
in xrange(len(self
.property_
)):
1550 out
.putVarInt32(self
.property_
[i
].ByteSize())
1551 self
.property_
[i
].OutputUnchecked(out
)
1553 def OutputPartial(self
, out
):
1556 out
.putVarInt32(self
.key_
.ByteSizePartial())
1557 self
.key_
.OutputPartial(out
)
1558 for i
in xrange(len(self
.property_
)):
1560 out
.putVarInt32(self
.property_
[i
].ByteSizePartial())
1561 self
.property_
[i
].OutputPartial(out
)
1563 def TryMerge(self
, d
):
1564 while d
.avail() > 0:
1565 tt
= d
.getVarInt32()
1567 length
= d
.getVarInt32()
1568 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1570 self
.mutable_key().TryMerge(tmp
)
1573 length
= d
.getVarInt32()
1574 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1576 self
.add_property().TryMerge(tmp
)
1580 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1584 def __str__(self
, prefix
="", printElemNumber
=0):
1587 res
+=prefix
+"key <\n"
1588 res
+=self
.key_
.__str
__(prefix
+ " ", printElemNumber
)
1591 for e
in self
.property_
:
1593 if printElemNumber
: elm
="(%d)" % cnt
1594 res
+=prefix
+("property%s <\n" % elm
)
1595 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
1601 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1602 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1607 _TEXT
= _BuildTagLookupTable({
1613 _TYPES
= _BuildTagLookupTable({
1614 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1615 1: ProtocolBuffer
.Encoder
.STRING
,
1616 2: ProtocolBuffer
.Encoder
.STRING
,
1617 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1621 _STYLE_CONTENT_TYPE
= """"""
1622 _PROTO_DESCRIPTOR_NAME
= 'apphosting.datastore.v4.Entity'
1623 _SERIALIZED_DESCRIPTOR
= array
.array('B')
1624 _SERIALIZED_DESCRIPTOR
.fromstring(base64
.decodestring("WiRhcHBob3N0aW5nL2RhdGFzdG9yZS9lbnRpdHlfdjQucHJvdG8KHmFwcGhvc3RpbmcuZGF0YXN0b3JlLnY0LkVudGl0eRMaA2tleSABKAIwCzgBShthcHBob3N0aW5nLmRhdGFzdG9yZS52NC5LZXmjAaoBBWN0eXBlsgEGcHJvdG8ypAEUExoIcHJvcGVydHkgAigCMAs4A0ogYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuUHJvcGVydHmjAaoBBWN0eXBlsgEGcHJvdG8ypAEUwgEjYXBwaG9zdGluZy5kYXRhc3RvcmUudjQuUGFydGl0aW9uSWQ="))
1625 if _net_proto___parse__python
is not None:
1626 _net_proto___parse__python
.RegisterType(
1627 _SERIALIZED_DESCRIPTOR
.tostring())
1629 if _extension_runtime
:
1632 __all__
= ['PartitionId','Key_PathElement','Key','Value','Property','Entity']