|
1 #!/usr/bin/env python |
|
2 # |
|
3 # Copyright 2007 Google Inc. |
|
4 # |
|
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 |
|
8 # |
|
9 # http://www.apache.org/licenses/LICENSE-2.0 |
|
10 # |
|
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. |
|
16 # |
|
17 |
|
18 from google.net.proto import ProtocolBuffer |
|
19 import array |
|
20 import dummy_thread as thread |
|
21 |
|
22 __pychecker__ = """maxreturns=0 maxbranches=0 no-callinit |
|
23 unusednames=printElemNumber,debug_strs no-special""" |
|
24 |
|
25 class PropertyValue_ReferenceValuePathElement(ProtocolBuffer.ProtocolMessage): |
|
26 def __init__(self, contents=None): |
|
27 self.type_ = "" |
|
28 self.id_ = 0 |
|
29 self.name_ = "" |
|
30 self.has_type_ = 0 |
|
31 self.has_id_ = 0 |
|
32 self.has_name_ = 0 |
|
33 if contents is not None: self.MergeFromString(contents) |
|
34 |
|
35 def type(self): return self.type_ |
|
36 |
|
37 def set_type(self, x): |
|
38 self.has_type_ = 1 |
|
39 self.type_ = x |
|
40 |
|
41 def clear_type(self): |
|
42 self.has_type_ = 0 |
|
43 self.type_ = "" |
|
44 |
|
45 def has_type(self): return self.has_type_ |
|
46 |
|
47 def id(self): return self.id_ |
|
48 |
|
49 def set_id(self, x): |
|
50 self.has_id_ = 1 |
|
51 self.id_ = x |
|
52 |
|
53 def clear_id(self): |
|
54 self.has_id_ = 0 |
|
55 self.id_ = 0 |
|
56 |
|
57 def has_id(self): return self.has_id_ |
|
58 |
|
59 def name(self): return self.name_ |
|
60 |
|
61 def set_name(self, x): |
|
62 self.has_name_ = 1 |
|
63 self.name_ = x |
|
64 |
|
65 def clear_name(self): |
|
66 self.has_name_ = 0 |
|
67 self.name_ = "" |
|
68 |
|
69 def has_name(self): return self.has_name_ |
|
70 |
|
71 |
|
72 def MergeFrom(self, x): |
|
73 assert x is not self |
|
74 if (x.has_type()): self.set_type(x.type()) |
|
75 if (x.has_id()): self.set_id(x.id()) |
|
76 if (x.has_name()): self.set_name(x.name()) |
|
77 |
|
78 def Equals(self, x): |
|
79 if x is self: return 1 |
|
80 if self.has_type_ != x.has_type_: return 0 |
|
81 if self.has_type_ and self.type_ != x.type_: return 0 |
|
82 if self.has_id_ != x.has_id_: return 0 |
|
83 if self.has_id_ and self.id_ != x.id_: return 0 |
|
84 if self.has_name_ != x.has_name_: return 0 |
|
85 if self.has_name_ and self.name_ != x.name_: return 0 |
|
86 return 1 |
|
87 |
|
88 def __eq__(self, other): |
|
89 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
90 |
|
91 def __ne__(self, other): |
|
92 return not (self == other) |
|
93 |
|
94 def IsInitialized(self, debug_strs=None): |
|
95 initialized = 1 |
|
96 if (not self.has_type_): |
|
97 initialized = 0 |
|
98 if debug_strs is not None: |
|
99 debug_strs.append('Required field: type not set.') |
|
100 return initialized |
|
101 |
|
102 def ByteSize(self): |
|
103 n = 0 |
|
104 n += self.lengthString(len(self.type_)) |
|
105 if (self.has_id_): n += 2 + self.lengthVarInt64(self.id_) |
|
106 if (self.has_name_): n += 2 + self.lengthString(len(self.name_)) |
|
107 return n + 1 |
|
108 |
|
109 def Clear(self): |
|
110 self.clear_type() |
|
111 self.clear_id() |
|
112 self.clear_name() |
|
113 |
|
114 def OutputUnchecked(self, out): |
|
115 out.putVarInt32(122) |
|
116 out.putPrefixedString(self.type_) |
|
117 if (self.has_id_): |
|
118 out.putVarInt32(128) |
|
119 out.putVarInt64(self.id_) |
|
120 if (self.has_name_): |
|
121 out.putVarInt32(138) |
|
122 out.putPrefixedString(self.name_) |
|
123 |
|
124 def TryMerge(self, d): |
|
125 while 1: |
|
126 tt = d.getVarInt32() |
|
127 if tt == 116: break |
|
128 if tt == 122: |
|
129 self.set_type(d.getPrefixedString()) |
|
130 continue |
|
131 if tt == 128: |
|
132 self.set_id(d.getVarInt64()) |
|
133 continue |
|
134 if tt == 138: |
|
135 self.set_name(d.getPrefixedString()) |
|
136 continue |
|
137 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
138 d.skipData(tt) |
|
139 |
|
140 |
|
141 def __str__(self, prefix="", printElemNumber=0): |
|
142 res="" |
|
143 if self.has_type_: res+=prefix+("type: %s\n" % self.DebugFormatString(self.type_)) |
|
144 if self.has_id_: res+=prefix+("id: %s\n" % self.DebugFormatInt64(self.id_)) |
|
145 if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_)) |
|
146 return res |
|
147 |
|
148 class PropertyValue_PointValue(ProtocolBuffer.ProtocolMessage): |
|
149 def __init__(self, contents=None): |
|
150 self.x_ = 0.0 |
|
151 self.y_ = 0.0 |
|
152 self.has_x_ = 0 |
|
153 self.has_y_ = 0 |
|
154 if contents is not None: self.MergeFromString(contents) |
|
155 |
|
156 def x(self): return self.x_ |
|
157 |
|
158 def set_x(self, x): |
|
159 self.has_x_ = 1 |
|
160 self.x_ = x |
|
161 |
|
162 def clear_x(self): |
|
163 self.has_x_ = 0 |
|
164 self.x_ = 0.0 |
|
165 |
|
166 def has_x(self): return self.has_x_ |
|
167 |
|
168 def y(self): return self.y_ |
|
169 |
|
170 def set_y(self, x): |
|
171 self.has_y_ = 1 |
|
172 self.y_ = x |
|
173 |
|
174 def clear_y(self): |
|
175 self.has_y_ = 0 |
|
176 self.y_ = 0.0 |
|
177 |
|
178 def has_y(self): return self.has_y_ |
|
179 |
|
180 |
|
181 def MergeFrom(self, x): |
|
182 assert x is not self |
|
183 if (x.has_x()): self.set_x(x.x()) |
|
184 if (x.has_y()): self.set_y(x.y()) |
|
185 |
|
186 def Equals(self, x): |
|
187 if x is self: return 1 |
|
188 if self.has_x_ != x.has_x_: return 0 |
|
189 if self.has_x_ and self.x_ != x.x_: return 0 |
|
190 if self.has_y_ != x.has_y_: return 0 |
|
191 if self.has_y_ and self.y_ != x.y_: return 0 |
|
192 return 1 |
|
193 |
|
194 def __eq__(self, other): |
|
195 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
196 |
|
197 def __ne__(self, other): |
|
198 return not (self == other) |
|
199 |
|
200 def IsInitialized(self, debug_strs=None): |
|
201 initialized = 1 |
|
202 if (not self.has_x_): |
|
203 initialized = 0 |
|
204 if debug_strs is not None: |
|
205 debug_strs.append('Required field: x not set.') |
|
206 if (not self.has_y_): |
|
207 initialized = 0 |
|
208 if debug_strs is not None: |
|
209 debug_strs.append('Required field: y not set.') |
|
210 return initialized |
|
211 |
|
212 def ByteSize(self): |
|
213 n = 0 |
|
214 return n + 18 |
|
215 |
|
216 def Clear(self): |
|
217 self.clear_x() |
|
218 self.clear_y() |
|
219 |
|
220 def OutputUnchecked(self, out): |
|
221 out.putVarInt32(49) |
|
222 out.putDouble(self.x_) |
|
223 out.putVarInt32(57) |
|
224 out.putDouble(self.y_) |
|
225 |
|
226 def TryMerge(self, d): |
|
227 while 1: |
|
228 tt = d.getVarInt32() |
|
229 if tt == 44: break |
|
230 if tt == 49: |
|
231 self.set_x(d.getDouble()) |
|
232 continue |
|
233 if tt == 57: |
|
234 self.set_y(d.getDouble()) |
|
235 continue |
|
236 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
237 d.skipData(tt) |
|
238 |
|
239 |
|
240 def __str__(self, prefix="", printElemNumber=0): |
|
241 res="" |
|
242 if self.has_x_: res+=prefix+("x: %s\n" % self.DebugFormat(self.x_)) |
|
243 if self.has_y_: res+=prefix+("y: %s\n" % self.DebugFormat(self.y_)) |
|
244 return res |
|
245 |
|
246 class PropertyValue_UserValue(ProtocolBuffer.ProtocolMessage): |
|
247 def __init__(self, contents=None): |
|
248 self.email_ = "" |
|
249 self.auth_domain_ = "" |
|
250 self.nickname_ = "" |
|
251 self.gaiaid_ = 0 |
|
252 self.has_email_ = 0 |
|
253 self.has_auth_domain_ = 0 |
|
254 self.has_nickname_ = 0 |
|
255 self.has_gaiaid_ = 0 |
|
256 if contents is not None: self.MergeFromString(contents) |
|
257 |
|
258 def email(self): return self.email_ |
|
259 |
|
260 def set_email(self, x): |
|
261 self.has_email_ = 1 |
|
262 self.email_ = x |
|
263 |
|
264 def clear_email(self): |
|
265 self.has_email_ = 0 |
|
266 self.email_ = "" |
|
267 |
|
268 def has_email(self): return self.has_email_ |
|
269 |
|
270 def auth_domain(self): return self.auth_domain_ |
|
271 |
|
272 def set_auth_domain(self, x): |
|
273 self.has_auth_domain_ = 1 |
|
274 self.auth_domain_ = x |
|
275 |
|
276 def clear_auth_domain(self): |
|
277 self.has_auth_domain_ = 0 |
|
278 self.auth_domain_ = "" |
|
279 |
|
280 def has_auth_domain(self): return self.has_auth_domain_ |
|
281 |
|
282 def nickname(self): return self.nickname_ |
|
283 |
|
284 def set_nickname(self, x): |
|
285 self.has_nickname_ = 1 |
|
286 self.nickname_ = x |
|
287 |
|
288 def clear_nickname(self): |
|
289 self.has_nickname_ = 0 |
|
290 self.nickname_ = "" |
|
291 |
|
292 def has_nickname(self): return self.has_nickname_ |
|
293 |
|
294 def gaiaid(self): return self.gaiaid_ |
|
295 |
|
296 def set_gaiaid(self, x): |
|
297 self.has_gaiaid_ = 1 |
|
298 self.gaiaid_ = x |
|
299 |
|
300 def clear_gaiaid(self): |
|
301 self.has_gaiaid_ = 0 |
|
302 self.gaiaid_ = 0 |
|
303 |
|
304 def has_gaiaid(self): return self.has_gaiaid_ |
|
305 |
|
306 |
|
307 def MergeFrom(self, x): |
|
308 assert x is not self |
|
309 if (x.has_email()): self.set_email(x.email()) |
|
310 if (x.has_auth_domain()): self.set_auth_domain(x.auth_domain()) |
|
311 if (x.has_nickname()): self.set_nickname(x.nickname()) |
|
312 if (x.has_gaiaid()): self.set_gaiaid(x.gaiaid()) |
|
313 |
|
314 def Equals(self, x): |
|
315 if x is self: return 1 |
|
316 if self.has_email_ != x.has_email_: return 0 |
|
317 if self.has_email_ and self.email_ != x.email_: return 0 |
|
318 if self.has_auth_domain_ != x.has_auth_domain_: return 0 |
|
319 if self.has_auth_domain_ and self.auth_domain_ != x.auth_domain_: return 0 |
|
320 if self.has_nickname_ != x.has_nickname_: return 0 |
|
321 if self.has_nickname_ and self.nickname_ != x.nickname_: return 0 |
|
322 if self.has_gaiaid_ != x.has_gaiaid_: return 0 |
|
323 if self.has_gaiaid_ and self.gaiaid_ != x.gaiaid_: return 0 |
|
324 return 1 |
|
325 |
|
326 def __eq__(self, other): |
|
327 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
328 |
|
329 def __ne__(self, other): |
|
330 return not (self == other) |
|
331 |
|
332 def IsInitialized(self, debug_strs=None): |
|
333 initialized = 1 |
|
334 if (not self.has_email_): |
|
335 initialized = 0 |
|
336 if debug_strs is not None: |
|
337 debug_strs.append('Required field: email not set.') |
|
338 if (not self.has_auth_domain_): |
|
339 initialized = 0 |
|
340 if debug_strs is not None: |
|
341 debug_strs.append('Required field: auth_domain not set.') |
|
342 if (not self.has_gaiaid_): |
|
343 initialized = 0 |
|
344 if debug_strs is not None: |
|
345 debug_strs.append('Required field: gaiaid not set.') |
|
346 return initialized |
|
347 |
|
348 def ByteSize(self): |
|
349 n = 0 |
|
350 n += self.lengthString(len(self.email_)) |
|
351 n += self.lengthString(len(self.auth_domain_)) |
|
352 if (self.has_nickname_): n += 1 + self.lengthString(len(self.nickname_)) |
|
353 n += self.lengthVarInt64(self.gaiaid_) |
|
354 return n + 4 |
|
355 |
|
356 def Clear(self): |
|
357 self.clear_email() |
|
358 self.clear_auth_domain() |
|
359 self.clear_nickname() |
|
360 self.clear_gaiaid() |
|
361 |
|
362 def OutputUnchecked(self, out): |
|
363 out.putVarInt32(74) |
|
364 out.putPrefixedString(self.email_) |
|
365 out.putVarInt32(82) |
|
366 out.putPrefixedString(self.auth_domain_) |
|
367 if (self.has_nickname_): |
|
368 out.putVarInt32(90) |
|
369 out.putPrefixedString(self.nickname_) |
|
370 out.putVarInt32(144) |
|
371 out.putVarInt64(self.gaiaid_) |
|
372 |
|
373 def TryMerge(self, d): |
|
374 while 1: |
|
375 tt = d.getVarInt32() |
|
376 if tt == 68: break |
|
377 if tt == 74: |
|
378 self.set_email(d.getPrefixedString()) |
|
379 continue |
|
380 if tt == 82: |
|
381 self.set_auth_domain(d.getPrefixedString()) |
|
382 continue |
|
383 if tt == 90: |
|
384 self.set_nickname(d.getPrefixedString()) |
|
385 continue |
|
386 if tt == 144: |
|
387 self.set_gaiaid(d.getVarInt64()) |
|
388 continue |
|
389 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
390 d.skipData(tt) |
|
391 |
|
392 |
|
393 def __str__(self, prefix="", printElemNumber=0): |
|
394 res="" |
|
395 if self.has_email_: res+=prefix+("email: %s\n" % self.DebugFormatString(self.email_)) |
|
396 if self.has_auth_domain_: res+=prefix+("auth_domain: %s\n" % self.DebugFormatString(self.auth_domain_)) |
|
397 if self.has_nickname_: res+=prefix+("nickname: %s\n" % self.DebugFormatString(self.nickname_)) |
|
398 if self.has_gaiaid_: res+=prefix+("gaiaid: %s\n" % self.DebugFormatInt64(self.gaiaid_)) |
|
399 return res |
|
400 |
|
401 class PropertyValue_ReferenceValue(ProtocolBuffer.ProtocolMessage): |
|
402 def __init__(self, contents=None): |
|
403 self.app_ = "" |
|
404 self.pathelement_ = [] |
|
405 self.has_app_ = 0 |
|
406 if contents is not None: self.MergeFromString(contents) |
|
407 |
|
408 def app(self): return self.app_ |
|
409 |
|
410 def set_app(self, x): |
|
411 self.has_app_ = 1 |
|
412 self.app_ = x |
|
413 |
|
414 def clear_app(self): |
|
415 self.has_app_ = 0 |
|
416 self.app_ = "" |
|
417 |
|
418 def has_app(self): return self.has_app_ |
|
419 |
|
420 def pathelement_size(self): return len(self.pathelement_) |
|
421 def pathelement_list(self): return self.pathelement_ |
|
422 |
|
423 def pathelement(self, i): |
|
424 return self.pathelement_[i] |
|
425 |
|
426 def mutable_pathelement(self, i): |
|
427 return self.pathelement_[i] |
|
428 |
|
429 def add_pathelement(self): |
|
430 x = PropertyValue_ReferenceValuePathElement() |
|
431 self.pathelement_.append(x) |
|
432 return x |
|
433 |
|
434 def clear_pathelement(self): |
|
435 self.pathelement_ = [] |
|
436 |
|
437 def MergeFrom(self, x): |
|
438 assert x is not self |
|
439 if (x.has_app()): self.set_app(x.app()) |
|
440 for i in xrange(x.pathelement_size()): self.add_pathelement().CopyFrom(x.pathelement(i)) |
|
441 |
|
442 def Equals(self, x): |
|
443 if x is self: return 1 |
|
444 if self.has_app_ != x.has_app_: return 0 |
|
445 if self.has_app_ and self.app_ != x.app_: return 0 |
|
446 if len(self.pathelement_) != len(x.pathelement_): return 0 |
|
447 for e1, e2 in zip(self.pathelement_, x.pathelement_): |
|
448 if e1 != e2: return 0 |
|
449 return 1 |
|
450 |
|
451 def __eq__(self, other): |
|
452 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
453 |
|
454 def __ne__(self, other): |
|
455 return not (self == other) |
|
456 |
|
457 def IsInitialized(self, debug_strs=None): |
|
458 initialized = 1 |
|
459 if (not self.has_app_): |
|
460 initialized = 0 |
|
461 if debug_strs is not None: |
|
462 debug_strs.append('Required field: app not set.') |
|
463 for i in xrange(len(self.pathelement_)): |
|
464 if (not self.pathelement_[i].IsInitialized(debug_strs)): initialized=0 |
|
465 return initialized |
|
466 |
|
467 def ByteSize(self): |
|
468 n = 0 |
|
469 n += self.lengthString(len(self.app_)) |
|
470 n += 2 * len(self.pathelement_) |
|
471 for i in xrange(len(self.pathelement_)): n += self.pathelement_[i].ByteSize() |
|
472 return n + 1 |
|
473 |
|
474 def Clear(self): |
|
475 self.clear_app() |
|
476 self.clear_pathelement() |
|
477 |
|
478 def OutputUnchecked(self, out): |
|
479 out.putVarInt32(106) |
|
480 out.putPrefixedString(self.app_) |
|
481 for i in xrange(len(self.pathelement_)): |
|
482 out.putVarInt32(115) |
|
483 self.pathelement_[i].OutputUnchecked(out) |
|
484 out.putVarInt32(116) |
|
485 |
|
486 def TryMerge(self, d): |
|
487 while 1: |
|
488 tt = d.getVarInt32() |
|
489 if tt == 100: break |
|
490 if tt == 106: |
|
491 self.set_app(d.getPrefixedString()) |
|
492 continue |
|
493 if tt == 115: |
|
494 self.add_pathelement().TryMerge(d) |
|
495 continue |
|
496 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
497 d.skipData(tt) |
|
498 |
|
499 |
|
500 def __str__(self, prefix="", printElemNumber=0): |
|
501 res="" |
|
502 if self.has_app_: res+=prefix+("app: %s\n" % self.DebugFormatString(self.app_)) |
|
503 cnt=0 |
|
504 for e in self.pathelement_: |
|
505 elm="" |
|
506 if printElemNumber: elm="(%d)" % cnt |
|
507 res+=prefix+("PathElement%s {\n" % elm) |
|
508 res+=e.__str__(prefix + " ", printElemNumber) |
|
509 res+=prefix+"}\n" |
|
510 cnt+=1 |
|
511 return res |
|
512 |
|
513 class PropertyValue(ProtocolBuffer.ProtocolMessage): |
|
514 def __init__(self, contents=None): |
|
515 self.int64value_ = 0 |
|
516 self.booleanvalue_ = 0 |
|
517 self.stringvalue_ = "" |
|
518 self.doublevalue_ = 0.0 |
|
519 self.pointvalue_ = None |
|
520 self.uservalue_ = None |
|
521 self.referencevalue_ = None |
|
522 self.has_int64value_ = 0 |
|
523 self.has_booleanvalue_ = 0 |
|
524 self.has_stringvalue_ = 0 |
|
525 self.has_doublevalue_ = 0 |
|
526 self.has_pointvalue_ = 0 |
|
527 self.has_uservalue_ = 0 |
|
528 self.has_referencevalue_ = 0 |
|
529 self.lazy_init_lock_ = thread.allocate_lock() |
|
530 if contents is not None: self.MergeFromString(contents) |
|
531 |
|
532 def int64value(self): return self.int64value_ |
|
533 |
|
534 def set_int64value(self, x): |
|
535 self.has_int64value_ = 1 |
|
536 self.int64value_ = x |
|
537 |
|
538 def clear_int64value(self): |
|
539 self.has_int64value_ = 0 |
|
540 self.int64value_ = 0 |
|
541 |
|
542 def has_int64value(self): return self.has_int64value_ |
|
543 |
|
544 def booleanvalue(self): return self.booleanvalue_ |
|
545 |
|
546 def set_booleanvalue(self, x): |
|
547 self.has_booleanvalue_ = 1 |
|
548 self.booleanvalue_ = x |
|
549 |
|
550 def clear_booleanvalue(self): |
|
551 self.has_booleanvalue_ = 0 |
|
552 self.booleanvalue_ = 0 |
|
553 |
|
554 def has_booleanvalue(self): return self.has_booleanvalue_ |
|
555 |
|
556 def stringvalue(self): return self.stringvalue_ |
|
557 |
|
558 def set_stringvalue(self, x): |
|
559 self.has_stringvalue_ = 1 |
|
560 self.stringvalue_ = x |
|
561 |
|
562 def clear_stringvalue(self): |
|
563 self.has_stringvalue_ = 0 |
|
564 self.stringvalue_ = "" |
|
565 |
|
566 def has_stringvalue(self): return self.has_stringvalue_ |
|
567 |
|
568 def doublevalue(self): return self.doublevalue_ |
|
569 |
|
570 def set_doublevalue(self, x): |
|
571 self.has_doublevalue_ = 1 |
|
572 self.doublevalue_ = x |
|
573 |
|
574 def clear_doublevalue(self): |
|
575 self.has_doublevalue_ = 0 |
|
576 self.doublevalue_ = 0.0 |
|
577 |
|
578 def has_doublevalue(self): return self.has_doublevalue_ |
|
579 |
|
580 def pointvalue(self): |
|
581 if self.pointvalue_ is None: |
|
582 self.lazy_init_lock_.acquire() |
|
583 try: |
|
584 if self.pointvalue_ is None: self.pointvalue_ = PropertyValue_PointValue() |
|
585 finally: |
|
586 self.lazy_init_lock_.release() |
|
587 return self.pointvalue_ |
|
588 |
|
589 def mutable_pointvalue(self): self.has_pointvalue_ = 1; return self.pointvalue() |
|
590 |
|
591 def clear_pointvalue(self): |
|
592 self.has_pointvalue_ = 0; |
|
593 if self.pointvalue_ is not None: self.pointvalue_.Clear() |
|
594 |
|
595 def has_pointvalue(self): return self.has_pointvalue_ |
|
596 |
|
597 def uservalue(self): |
|
598 if self.uservalue_ is None: |
|
599 self.lazy_init_lock_.acquire() |
|
600 try: |
|
601 if self.uservalue_ is None: self.uservalue_ = PropertyValue_UserValue() |
|
602 finally: |
|
603 self.lazy_init_lock_.release() |
|
604 return self.uservalue_ |
|
605 |
|
606 def mutable_uservalue(self): self.has_uservalue_ = 1; return self.uservalue() |
|
607 |
|
608 def clear_uservalue(self): |
|
609 self.has_uservalue_ = 0; |
|
610 if self.uservalue_ is not None: self.uservalue_.Clear() |
|
611 |
|
612 def has_uservalue(self): return self.has_uservalue_ |
|
613 |
|
614 def referencevalue(self): |
|
615 if self.referencevalue_ is None: |
|
616 self.lazy_init_lock_.acquire() |
|
617 try: |
|
618 if self.referencevalue_ is None: self.referencevalue_ = PropertyValue_ReferenceValue() |
|
619 finally: |
|
620 self.lazy_init_lock_.release() |
|
621 return self.referencevalue_ |
|
622 |
|
623 def mutable_referencevalue(self): self.has_referencevalue_ = 1; return self.referencevalue() |
|
624 |
|
625 def clear_referencevalue(self): |
|
626 self.has_referencevalue_ = 0; |
|
627 if self.referencevalue_ is not None: self.referencevalue_.Clear() |
|
628 |
|
629 def has_referencevalue(self): return self.has_referencevalue_ |
|
630 |
|
631 |
|
632 def MergeFrom(self, x): |
|
633 assert x is not self |
|
634 if (x.has_int64value()): self.set_int64value(x.int64value()) |
|
635 if (x.has_booleanvalue()): self.set_booleanvalue(x.booleanvalue()) |
|
636 if (x.has_stringvalue()): self.set_stringvalue(x.stringvalue()) |
|
637 if (x.has_doublevalue()): self.set_doublevalue(x.doublevalue()) |
|
638 if (x.has_pointvalue()): self.mutable_pointvalue().MergeFrom(x.pointvalue()) |
|
639 if (x.has_uservalue()): self.mutable_uservalue().MergeFrom(x.uservalue()) |
|
640 if (x.has_referencevalue()): self.mutable_referencevalue().MergeFrom(x.referencevalue()) |
|
641 |
|
642 def Equals(self, x): |
|
643 if x is self: return 1 |
|
644 if self.has_int64value_ != x.has_int64value_: return 0 |
|
645 if self.has_int64value_ and self.int64value_ != x.int64value_: return 0 |
|
646 if self.has_booleanvalue_ != x.has_booleanvalue_: return 0 |
|
647 if self.has_booleanvalue_ and self.booleanvalue_ != x.booleanvalue_: return 0 |
|
648 if self.has_stringvalue_ != x.has_stringvalue_: return 0 |
|
649 if self.has_stringvalue_ and self.stringvalue_ != x.stringvalue_: return 0 |
|
650 if self.has_doublevalue_ != x.has_doublevalue_: return 0 |
|
651 if self.has_doublevalue_ and self.doublevalue_ != x.doublevalue_: return 0 |
|
652 if self.has_pointvalue_ != x.has_pointvalue_: return 0 |
|
653 if self.has_pointvalue_ and self.pointvalue_ != x.pointvalue_: return 0 |
|
654 if self.has_uservalue_ != x.has_uservalue_: return 0 |
|
655 if self.has_uservalue_ and self.uservalue_ != x.uservalue_: return 0 |
|
656 if self.has_referencevalue_ != x.has_referencevalue_: return 0 |
|
657 if self.has_referencevalue_ and self.referencevalue_ != x.referencevalue_: return 0 |
|
658 return 1 |
|
659 |
|
660 def __eq__(self, other): |
|
661 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
662 |
|
663 def __ne__(self, other): |
|
664 return not (self == other) |
|
665 |
|
666 def IsInitialized(self, debug_strs=None): |
|
667 initialized = 1 |
|
668 if (self.has_pointvalue_ and not self.pointvalue_.IsInitialized(debug_strs)): initialized = 0 |
|
669 if (self.has_uservalue_ and not self.uservalue_.IsInitialized(debug_strs)): initialized = 0 |
|
670 if (self.has_referencevalue_ and not self.referencevalue_.IsInitialized(debug_strs)): initialized = 0 |
|
671 return initialized |
|
672 |
|
673 def ByteSize(self): |
|
674 n = 0 |
|
675 if (self.has_int64value_): n += 1 + self.lengthVarInt64(self.int64value_) |
|
676 if (self.has_booleanvalue_): n += 2 |
|
677 if (self.has_stringvalue_): n += 1 + self.lengthString(len(self.stringvalue_)) |
|
678 if (self.has_doublevalue_): n += 9 |
|
679 if (self.has_pointvalue_): n += 2 + self.pointvalue_.ByteSize() |
|
680 if (self.has_uservalue_): n += 2 + self.uservalue_.ByteSize() |
|
681 if (self.has_referencevalue_): n += 2 + self.referencevalue_.ByteSize() |
|
682 return n + 0 |
|
683 |
|
684 def Clear(self): |
|
685 self.clear_int64value() |
|
686 self.clear_booleanvalue() |
|
687 self.clear_stringvalue() |
|
688 self.clear_doublevalue() |
|
689 self.clear_pointvalue() |
|
690 self.clear_uservalue() |
|
691 self.clear_referencevalue() |
|
692 |
|
693 def OutputUnchecked(self, out): |
|
694 if (self.has_int64value_): |
|
695 out.putVarInt32(8) |
|
696 out.putVarInt64(self.int64value_) |
|
697 if (self.has_booleanvalue_): |
|
698 out.putVarInt32(16) |
|
699 out.putBoolean(self.booleanvalue_) |
|
700 if (self.has_stringvalue_): |
|
701 out.putVarInt32(26) |
|
702 out.putPrefixedString(self.stringvalue_) |
|
703 if (self.has_doublevalue_): |
|
704 out.putVarInt32(33) |
|
705 out.putDouble(self.doublevalue_) |
|
706 if (self.has_pointvalue_): |
|
707 out.putVarInt32(43) |
|
708 self.pointvalue_.OutputUnchecked(out) |
|
709 out.putVarInt32(44) |
|
710 if (self.has_uservalue_): |
|
711 out.putVarInt32(67) |
|
712 self.uservalue_.OutputUnchecked(out) |
|
713 out.putVarInt32(68) |
|
714 if (self.has_referencevalue_): |
|
715 out.putVarInt32(99) |
|
716 self.referencevalue_.OutputUnchecked(out) |
|
717 out.putVarInt32(100) |
|
718 |
|
719 def TryMerge(self, d): |
|
720 while d.avail() > 0: |
|
721 tt = d.getVarInt32() |
|
722 if tt == 8: |
|
723 self.set_int64value(d.getVarInt64()) |
|
724 continue |
|
725 if tt == 16: |
|
726 self.set_booleanvalue(d.getBoolean()) |
|
727 continue |
|
728 if tt == 26: |
|
729 self.set_stringvalue(d.getPrefixedString()) |
|
730 continue |
|
731 if tt == 33: |
|
732 self.set_doublevalue(d.getDouble()) |
|
733 continue |
|
734 if tt == 43: |
|
735 self.mutable_pointvalue().TryMerge(d) |
|
736 continue |
|
737 if tt == 67: |
|
738 self.mutable_uservalue().TryMerge(d) |
|
739 continue |
|
740 if tt == 99: |
|
741 self.mutable_referencevalue().TryMerge(d) |
|
742 continue |
|
743 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
744 d.skipData(tt) |
|
745 |
|
746 |
|
747 def __str__(self, prefix="", printElemNumber=0): |
|
748 res="" |
|
749 if self.has_int64value_: res+=prefix+("int64Value: %s\n" % self.DebugFormatInt64(self.int64value_)) |
|
750 if self.has_booleanvalue_: res+=prefix+("booleanValue: %s\n" % self.DebugFormatBool(self.booleanvalue_)) |
|
751 if self.has_stringvalue_: res+=prefix+("stringValue: %s\n" % self.DebugFormatString(self.stringvalue_)) |
|
752 if self.has_doublevalue_: res+=prefix+("doubleValue: %s\n" % self.DebugFormat(self.doublevalue_)) |
|
753 if self.has_pointvalue_: |
|
754 res+=prefix+"PointValue {\n" |
|
755 res+=self.pointvalue_.__str__(prefix + " ", printElemNumber) |
|
756 res+=prefix+"}\n" |
|
757 if self.has_uservalue_: |
|
758 res+=prefix+"UserValue {\n" |
|
759 res+=self.uservalue_.__str__(prefix + " ", printElemNumber) |
|
760 res+=prefix+"}\n" |
|
761 if self.has_referencevalue_: |
|
762 res+=prefix+"ReferenceValue {\n" |
|
763 res+=self.referencevalue_.__str__(prefix + " ", printElemNumber) |
|
764 res+=prefix+"}\n" |
|
765 return res |
|
766 |
|
767 kint64Value = 1 |
|
768 kbooleanValue = 2 |
|
769 kstringValue = 3 |
|
770 kdoubleValue = 4 |
|
771 kPointValueGroup = 5 |
|
772 kPointValuex = 6 |
|
773 kPointValuey = 7 |
|
774 kUserValueGroup = 8 |
|
775 kUserValueemail = 9 |
|
776 kUserValueauth_domain = 10 |
|
777 kUserValuenickname = 11 |
|
778 kUserValuegaiaid = 18 |
|
779 kReferenceValueGroup = 12 |
|
780 kReferenceValueapp = 13 |
|
781 kReferenceValuePathElementGroup = 14 |
|
782 kReferenceValuePathElementtype = 15 |
|
783 kReferenceValuePathElementid = 16 |
|
784 kReferenceValuePathElementname = 17 |
|
785 |
|
786 _TEXT = ( |
|
787 "ErrorCode", |
|
788 "int64Value", |
|
789 "booleanValue", |
|
790 "stringValue", |
|
791 "doubleValue", |
|
792 "PointValue", |
|
793 "x", |
|
794 "y", |
|
795 "UserValue", |
|
796 "email", |
|
797 "auth_domain", |
|
798 "nickname", |
|
799 "ReferenceValue", |
|
800 "app", |
|
801 "PathElement", |
|
802 "type", |
|
803 "id", |
|
804 "name", |
|
805 "gaiaid", |
|
806 ) |
|
807 |
|
808 _TYPES = ( |
|
809 ProtocolBuffer.Encoder.NUMERIC, |
|
810 ProtocolBuffer.Encoder.NUMERIC, |
|
811 |
|
812 ProtocolBuffer.Encoder.NUMERIC, |
|
813 |
|
814 ProtocolBuffer.Encoder.STRING, |
|
815 |
|
816 ProtocolBuffer.Encoder.DOUBLE, |
|
817 |
|
818 ProtocolBuffer.Encoder.STARTGROUP, |
|
819 |
|
820 ProtocolBuffer.Encoder.DOUBLE, |
|
821 |
|
822 ProtocolBuffer.Encoder.DOUBLE, |
|
823 |
|
824 ProtocolBuffer.Encoder.STARTGROUP, |
|
825 |
|
826 ProtocolBuffer.Encoder.STRING, |
|
827 |
|
828 ProtocolBuffer.Encoder.STRING, |
|
829 |
|
830 ProtocolBuffer.Encoder.STRING, |
|
831 |
|
832 ProtocolBuffer.Encoder.STARTGROUP, |
|
833 |
|
834 ProtocolBuffer.Encoder.STRING, |
|
835 |
|
836 ProtocolBuffer.Encoder.STARTGROUP, |
|
837 |
|
838 ProtocolBuffer.Encoder.STRING, |
|
839 |
|
840 ProtocolBuffer.Encoder.NUMERIC, |
|
841 |
|
842 ProtocolBuffer.Encoder.STRING, |
|
843 |
|
844 ProtocolBuffer.Encoder.NUMERIC, |
|
845 |
|
846 ) |
|
847 |
|
848 _STYLE = """""" |
|
849 _STYLE_CONTENT_TYPE = """""" |
|
850 class Property(ProtocolBuffer.ProtocolMessage): |
|
851 |
|
852 BLOB = 14 |
|
853 TEXT = 15 |
|
854 ATOM_CATEGORY = 1 |
|
855 ATOM_LINK = 2 |
|
856 ATOM_TITLE = 3 |
|
857 ATOM_CONTENT = 4 |
|
858 ATOM_SUMMARY = 5 |
|
859 ATOM_AUTHOR = 6 |
|
860 GD_WHEN = 7 |
|
861 GD_EMAIL = 8 |
|
862 GEORSS_POINT = 9 |
|
863 GD_IM = 10 |
|
864 GD_PHONENUMBER = 11 |
|
865 GD_POSTALADDRESS = 12 |
|
866 GD_RATING = 13 |
|
867 |
|
868 _Meaning_NAMES = { |
|
869 14: "BLOB", |
|
870 15: "TEXT", |
|
871 1: "ATOM_CATEGORY", |
|
872 2: "ATOM_LINK", |
|
873 3: "ATOM_TITLE", |
|
874 4: "ATOM_CONTENT", |
|
875 5: "ATOM_SUMMARY", |
|
876 6: "ATOM_AUTHOR", |
|
877 7: "GD_WHEN", |
|
878 8: "GD_EMAIL", |
|
879 9: "GEORSS_POINT", |
|
880 10: "GD_IM", |
|
881 11: "GD_PHONENUMBER", |
|
882 12: "GD_POSTALADDRESS", |
|
883 13: "GD_RATING", |
|
884 } |
|
885 |
|
886 def Meaning_Name(cls, x): return cls._Meaning_NAMES.get(x, "") |
|
887 Meaning_Name = classmethod(Meaning_Name) |
|
888 |
|
889 def __init__(self, contents=None): |
|
890 self.meaning_ = 0 |
|
891 self.meaning_uri_ = "" |
|
892 self.name_ = "" |
|
893 self.value_ = PropertyValue() |
|
894 self.multiple_ = 0 |
|
895 self.has_meaning_ = 0 |
|
896 self.has_meaning_uri_ = 0 |
|
897 self.has_name_ = 0 |
|
898 self.has_value_ = 0 |
|
899 self.has_multiple_ = 0 |
|
900 if contents is not None: self.MergeFromString(contents) |
|
901 |
|
902 def meaning(self): return self.meaning_ |
|
903 |
|
904 def set_meaning(self, x): |
|
905 self.has_meaning_ = 1 |
|
906 self.meaning_ = x |
|
907 |
|
908 def clear_meaning(self): |
|
909 self.has_meaning_ = 0 |
|
910 self.meaning_ = 0 |
|
911 |
|
912 def has_meaning(self): return self.has_meaning_ |
|
913 |
|
914 def meaning_uri(self): return self.meaning_uri_ |
|
915 |
|
916 def set_meaning_uri(self, x): |
|
917 self.has_meaning_uri_ = 1 |
|
918 self.meaning_uri_ = x |
|
919 |
|
920 def clear_meaning_uri(self): |
|
921 self.has_meaning_uri_ = 0 |
|
922 self.meaning_uri_ = "" |
|
923 |
|
924 def has_meaning_uri(self): return self.has_meaning_uri_ |
|
925 |
|
926 def name(self): return self.name_ |
|
927 |
|
928 def set_name(self, x): |
|
929 self.has_name_ = 1 |
|
930 self.name_ = x |
|
931 |
|
932 def clear_name(self): |
|
933 self.has_name_ = 0 |
|
934 self.name_ = "" |
|
935 |
|
936 def has_name(self): return self.has_name_ |
|
937 |
|
938 def value(self): return self.value_ |
|
939 |
|
940 def mutable_value(self): self.has_value_ = 1; return self.value_ |
|
941 |
|
942 def clear_value(self):self.has_value_ = 0; self.value_.Clear() |
|
943 |
|
944 def has_value(self): return self.has_value_ |
|
945 |
|
946 def multiple(self): return self.multiple_ |
|
947 |
|
948 def set_multiple(self, x): |
|
949 self.has_multiple_ = 1 |
|
950 self.multiple_ = x |
|
951 |
|
952 def clear_multiple(self): |
|
953 self.has_multiple_ = 0 |
|
954 self.multiple_ = 0 |
|
955 |
|
956 def has_multiple(self): return self.has_multiple_ |
|
957 |
|
958 |
|
959 def MergeFrom(self, x): |
|
960 assert x is not self |
|
961 if (x.has_meaning()): self.set_meaning(x.meaning()) |
|
962 if (x.has_meaning_uri()): self.set_meaning_uri(x.meaning_uri()) |
|
963 if (x.has_name()): self.set_name(x.name()) |
|
964 if (x.has_value()): self.mutable_value().MergeFrom(x.value()) |
|
965 if (x.has_multiple()): self.set_multiple(x.multiple()) |
|
966 |
|
967 def Equals(self, x): |
|
968 if x is self: return 1 |
|
969 if self.has_meaning_ != x.has_meaning_: return 0 |
|
970 if self.has_meaning_ and self.meaning_ != x.meaning_: return 0 |
|
971 if self.has_meaning_uri_ != x.has_meaning_uri_: return 0 |
|
972 if self.has_meaning_uri_ and self.meaning_uri_ != x.meaning_uri_: return 0 |
|
973 if self.has_name_ != x.has_name_: return 0 |
|
974 if self.has_name_ and self.name_ != x.name_: return 0 |
|
975 if self.has_value_ != x.has_value_: return 0 |
|
976 if self.has_value_ and self.value_ != x.value_: return 0 |
|
977 if self.has_multiple_ != x.has_multiple_: return 0 |
|
978 if self.has_multiple_ and self.multiple_ != x.multiple_: return 0 |
|
979 return 1 |
|
980 |
|
981 def __eq__(self, other): |
|
982 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
983 |
|
984 def __ne__(self, other): |
|
985 return not (self == other) |
|
986 |
|
987 def IsInitialized(self, debug_strs=None): |
|
988 initialized = 1 |
|
989 if (not self.has_name_): |
|
990 initialized = 0 |
|
991 if debug_strs is not None: |
|
992 debug_strs.append('Required field: name not set.') |
|
993 if (not self.has_value_): |
|
994 initialized = 0 |
|
995 if debug_strs is not None: |
|
996 debug_strs.append('Required field: value not set.') |
|
997 elif not self.value_.IsInitialized(debug_strs): initialized = 0 |
|
998 return initialized |
|
999 |
|
1000 def ByteSize(self): |
|
1001 n = 0 |
|
1002 if (self.has_meaning_): n += 1 + self.lengthVarInt64(self.meaning_) |
|
1003 if (self.has_meaning_uri_): n += 1 + self.lengthString(len(self.meaning_uri_)) |
|
1004 n += self.lengthString(len(self.name_)) |
|
1005 n += self.lengthString(self.value_.ByteSize()) |
|
1006 if (self.has_multiple_): n += 2 |
|
1007 return n + 2 |
|
1008 |
|
1009 def Clear(self): |
|
1010 self.clear_meaning() |
|
1011 self.clear_meaning_uri() |
|
1012 self.clear_name() |
|
1013 self.clear_value() |
|
1014 self.clear_multiple() |
|
1015 |
|
1016 def OutputUnchecked(self, out): |
|
1017 if (self.has_meaning_): |
|
1018 out.putVarInt32(8) |
|
1019 out.putVarInt32(self.meaning_) |
|
1020 if (self.has_meaning_uri_): |
|
1021 out.putVarInt32(18) |
|
1022 out.putPrefixedString(self.meaning_uri_) |
|
1023 out.putVarInt32(26) |
|
1024 out.putPrefixedString(self.name_) |
|
1025 if (self.has_multiple_): |
|
1026 out.putVarInt32(32) |
|
1027 out.putBoolean(self.multiple_) |
|
1028 out.putVarInt32(42) |
|
1029 out.putVarInt32(self.value_.ByteSize()) |
|
1030 self.value_.OutputUnchecked(out) |
|
1031 |
|
1032 def TryMerge(self, d): |
|
1033 while d.avail() > 0: |
|
1034 tt = d.getVarInt32() |
|
1035 if tt == 8: |
|
1036 self.set_meaning(d.getVarInt32()) |
|
1037 continue |
|
1038 if tt == 18: |
|
1039 self.set_meaning_uri(d.getPrefixedString()) |
|
1040 continue |
|
1041 if tt == 26: |
|
1042 self.set_name(d.getPrefixedString()) |
|
1043 continue |
|
1044 if tt == 32: |
|
1045 self.set_multiple(d.getBoolean()) |
|
1046 continue |
|
1047 if tt == 42: |
|
1048 length = d.getVarInt32() |
|
1049 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1050 d.skip(length) |
|
1051 self.mutable_value().TryMerge(tmp) |
|
1052 continue |
|
1053 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1054 d.skipData(tt) |
|
1055 |
|
1056 |
|
1057 def __str__(self, prefix="", printElemNumber=0): |
|
1058 res="" |
|
1059 if self.has_meaning_: res+=prefix+("meaning: %s\n" % self.DebugFormatInt32(self.meaning_)) |
|
1060 if self.has_meaning_uri_: res+=prefix+("meaning_uri: %s\n" % self.DebugFormatString(self.meaning_uri_)) |
|
1061 if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_)) |
|
1062 if self.has_value_: |
|
1063 res+=prefix+"value <\n" |
|
1064 res+=self.value_.__str__(prefix + " ", printElemNumber) |
|
1065 res+=prefix+">\n" |
|
1066 if self.has_multiple_: res+=prefix+("multiple: %s\n" % self.DebugFormatBool(self.multiple_)) |
|
1067 return res |
|
1068 |
|
1069 kmeaning = 1 |
|
1070 kmeaning_uri = 2 |
|
1071 kname = 3 |
|
1072 kvalue = 5 |
|
1073 kmultiple = 4 |
|
1074 |
|
1075 _TEXT = ( |
|
1076 "ErrorCode", |
|
1077 "meaning", |
|
1078 "meaning_uri", |
|
1079 "name", |
|
1080 "multiple", |
|
1081 "value", |
|
1082 ) |
|
1083 |
|
1084 _TYPES = ( |
|
1085 ProtocolBuffer.Encoder.NUMERIC, |
|
1086 ProtocolBuffer.Encoder.NUMERIC, |
|
1087 |
|
1088 ProtocolBuffer.Encoder.STRING, |
|
1089 |
|
1090 ProtocolBuffer.Encoder.STRING, |
|
1091 |
|
1092 ProtocolBuffer.Encoder.NUMERIC, |
|
1093 |
|
1094 ProtocolBuffer.Encoder.STRING, |
|
1095 |
|
1096 ) |
|
1097 |
|
1098 _STYLE = """""" |
|
1099 _STYLE_CONTENT_TYPE = """""" |
|
1100 class Path_Element(ProtocolBuffer.ProtocolMessage): |
|
1101 def __init__(self, contents=None): |
|
1102 self.type_ = "" |
|
1103 self.id_ = 0 |
|
1104 self.name_ = "" |
|
1105 self.has_type_ = 0 |
|
1106 self.has_id_ = 0 |
|
1107 self.has_name_ = 0 |
|
1108 if contents is not None: self.MergeFromString(contents) |
|
1109 |
|
1110 def type(self): return self.type_ |
|
1111 |
|
1112 def set_type(self, x): |
|
1113 self.has_type_ = 1 |
|
1114 self.type_ = x |
|
1115 |
|
1116 def clear_type(self): |
|
1117 self.has_type_ = 0 |
|
1118 self.type_ = "" |
|
1119 |
|
1120 def has_type(self): return self.has_type_ |
|
1121 |
|
1122 def id(self): return self.id_ |
|
1123 |
|
1124 def set_id(self, x): |
|
1125 self.has_id_ = 1 |
|
1126 self.id_ = x |
|
1127 |
|
1128 def clear_id(self): |
|
1129 self.has_id_ = 0 |
|
1130 self.id_ = 0 |
|
1131 |
|
1132 def has_id(self): return self.has_id_ |
|
1133 |
|
1134 def name(self): return self.name_ |
|
1135 |
|
1136 def set_name(self, x): |
|
1137 self.has_name_ = 1 |
|
1138 self.name_ = x |
|
1139 |
|
1140 def clear_name(self): |
|
1141 self.has_name_ = 0 |
|
1142 self.name_ = "" |
|
1143 |
|
1144 def has_name(self): return self.has_name_ |
|
1145 |
|
1146 |
|
1147 def MergeFrom(self, x): |
|
1148 assert x is not self |
|
1149 if (x.has_type()): self.set_type(x.type()) |
|
1150 if (x.has_id()): self.set_id(x.id()) |
|
1151 if (x.has_name()): self.set_name(x.name()) |
|
1152 |
|
1153 def Equals(self, x): |
|
1154 if x is self: return 1 |
|
1155 if self.has_type_ != x.has_type_: return 0 |
|
1156 if self.has_type_ and self.type_ != x.type_: return 0 |
|
1157 if self.has_id_ != x.has_id_: return 0 |
|
1158 if self.has_id_ and self.id_ != x.id_: return 0 |
|
1159 if self.has_name_ != x.has_name_: return 0 |
|
1160 if self.has_name_ and self.name_ != x.name_: return 0 |
|
1161 return 1 |
|
1162 |
|
1163 def __eq__(self, other): |
|
1164 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
1165 |
|
1166 def __ne__(self, other): |
|
1167 return not (self == other) |
|
1168 |
|
1169 def IsInitialized(self, debug_strs=None): |
|
1170 initialized = 1 |
|
1171 if (not self.has_type_): |
|
1172 initialized = 0 |
|
1173 if debug_strs is not None: |
|
1174 debug_strs.append('Required field: type not set.') |
|
1175 return initialized |
|
1176 |
|
1177 def ByteSize(self): |
|
1178 n = 0 |
|
1179 n += self.lengthString(len(self.type_)) |
|
1180 if (self.has_id_): n += 1 + self.lengthVarInt64(self.id_) |
|
1181 if (self.has_name_): n += 1 + self.lengthString(len(self.name_)) |
|
1182 return n + 1 |
|
1183 |
|
1184 def Clear(self): |
|
1185 self.clear_type() |
|
1186 self.clear_id() |
|
1187 self.clear_name() |
|
1188 |
|
1189 def OutputUnchecked(self, out): |
|
1190 out.putVarInt32(18) |
|
1191 out.putPrefixedString(self.type_) |
|
1192 if (self.has_id_): |
|
1193 out.putVarInt32(24) |
|
1194 out.putVarInt64(self.id_) |
|
1195 if (self.has_name_): |
|
1196 out.putVarInt32(34) |
|
1197 out.putPrefixedString(self.name_) |
|
1198 |
|
1199 def TryMerge(self, d): |
|
1200 while 1: |
|
1201 tt = d.getVarInt32() |
|
1202 if tt == 12: break |
|
1203 if tt == 18: |
|
1204 self.set_type(d.getPrefixedString()) |
|
1205 continue |
|
1206 if tt == 24: |
|
1207 self.set_id(d.getVarInt64()) |
|
1208 continue |
|
1209 if tt == 34: |
|
1210 self.set_name(d.getPrefixedString()) |
|
1211 continue |
|
1212 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1213 d.skipData(tt) |
|
1214 |
|
1215 |
|
1216 def __str__(self, prefix="", printElemNumber=0): |
|
1217 res="" |
|
1218 if self.has_type_: res+=prefix+("type: %s\n" % self.DebugFormatString(self.type_)) |
|
1219 if self.has_id_: res+=prefix+("id: %s\n" % self.DebugFormatInt64(self.id_)) |
|
1220 if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_)) |
|
1221 return res |
|
1222 |
|
1223 class Path(ProtocolBuffer.ProtocolMessage): |
|
1224 def __init__(self, contents=None): |
|
1225 self.element_ = [] |
|
1226 if contents is not None: self.MergeFromString(contents) |
|
1227 |
|
1228 def element_size(self): return len(self.element_) |
|
1229 def element_list(self): return self.element_ |
|
1230 |
|
1231 def element(self, i): |
|
1232 return self.element_[i] |
|
1233 |
|
1234 def mutable_element(self, i): |
|
1235 return self.element_[i] |
|
1236 |
|
1237 def add_element(self): |
|
1238 x = Path_Element() |
|
1239 self.element_.append(x) |
|
1240 return x |
|
1241 |
|
1242 def clear_element(self): |
|
1243 self.element_ = [] |
|
1244 |
|
1245 def MergeFrom(self, x): |
|
1246 assert x is not self |
|
1247 for i in xrange(x.element_size()): self.add_element().CopyFrom(x.element(i)) |
|
1248 |
|
1249 def Equals(self, x): |
|
1250 if x is self: return 1 |
|
1251 if len(self.element_) != len(x.element_): return 0 |
|
1252 for e1, e2 in zip(self.element_, x.element_): |
|
1253 if e1 != e2: return 0 |
|
1254 return 1 |
|
1255 |
|
1256 def __eq__(self, other): |
|
1257 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
1258 |
|
1259 def __ne__(self, other): |
|
1260 return not (self == other) |
|
1261 |
|
1262 def IsInitialized(self, debug_strs=None): |
|
1263 initialized = 1 |
|
1264 for i in xrange(len(self.element_)): |
|
1265 if (not self.element_[i].IsInitialized(debug_strs)): initialized=0 |
|
1266 return initialized |
|
1267 |
|
1268 def ByteSize(self): |
|
1269 n = 0 |
|
1270 n += 2 * len(self.element_) |
|
1271 for i in xrange(len(self.element_)): n += self.element_[i].ByteSize() |
|
1272 return n + 0 |
|
1273 |
|
1274 def Clear(self): |
|
1275 self.clear_element() |
|
1276 |
|
1277 def OutputUnchecked(self, out): |
|
1278 for i in xrange(len(self.element_)): |
|
1279 out.putVarInt32(11) |
|
1280 self.element_[i].OutputUnchecked(out) |
|
1281 out.putVarInt32(12) |
|
1282 |
|
1283 def TryMerge(self, d): |
|
1284 while d.avail() > 0: |
|
1285 tt = d.getVarInt32() |
|
1286 if tt == 11: |
|
1287 self.add_element().TryMerge(d) |
|
1288 continue |
|
1289 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1290 d.skipData(tt) |
|
1291 |
|
1292 |
|
1293 def __str__(self, prefix="", printElemNumber=0): |
|
1294 res="" |
|
1295 cnt=0 |
|
1296 for e in self.element_: |
|
1297 elm="" |
|
1298 if printElemNumber: elm="(%d)" % cnt |
|
1299 res+=prefix+("Element%s {\n" % elm) |
|
1300 res+=e.__str__(prefix + " ", printElemNumber) |
|
1301 res+=prefix+"}\n" |
|
1302 cnt+=1 |
|
1303 return res |
|
1304 |
|
1305 kElementGroup = 1 |
|
1306 kElementtype = 2 |
|
1307 kElementid = 3 |
|
1308 kElementname = 4 |
|
1309 |
|
1310 _TEXT = ( |
|
1311 "ErrorCode", |
|
1312 "Element", |
|
1313 "type", |
|
1314 "id", |
|
1315 "name", |
|
1316 ) |
|
1317 |
|
1318 _TYPES = ( |
|
1319 ProtocolBuffer.Encoder.NUMERIC, |
|
1320 ProtocolBuffer.Encoder.STARTGROUP, |
|
1321 |
|
1322 ProtocolBuffer.Encoder.STRING, |
|
1323 |
|
1324 ProtocolBuffer.Encoder.NUMERIC, |
|
1325 |
|
1326 ProtocolBuffer.Encoder.STRING, |
|
1327 |
|
1328 ) |
|
1329 |
|
1330 _STYLE = """""" |
|
1331 _STYLE_CONTENT_TYPE = """""" |
|
1332 class Reference(ProtocolBuffer.ProtocolMessage): |
|
1333 def __init__(self, contents=None): |
|
1334 self.app_ = "" |
|
1335 self.path_ = Path() |
|
1336 self.has_app_ = 0 |
|
1337 self.has_path_ = 0 |
|
1338 if contents is not None: self.MergeFromString(contents) |
|
1339 |
|
1340 def app(self): return self.app_ |
|
1341 |
|
1342 def set_app(self, x): |
|
1343 self.has_app_ = 1 |
|
1344 self.app_ = x |
|
1345 |
|
1346 def clear_app(self): |
|
1347 self.has_app_ = 0 |
|
1348 self.app_ = "" |
|
1349 |
|
1350 def has_app(self): return self.has_app_ |
|
1351 |
|
1352 def path(self): return self.path_ |
|
1353 |
|
1354 def mutable_path(self): self.has_path_ = 1; return self.path_ |
|
1355 |
|
1356 def clear_path(self):self.has_path_ = 0; self.path_.Clear() |
|
1357 |
|
1358 def has_path(self): return self.has_path_ |
|
1359 |
|
1360 |
|
1361 def MergeFrom(self, x): |
|
1362 assert x is not self |
|
1363 if (x.has_app()): self.set_app(x.app()) |
|
1364 if (x.has_path()): self.mutable_path().MergeFrom(x.path()) |
|
1365 |
|
1366 def Equals(self, x): |
|
1367 if x is self: return 1 |
|
1368 if self.has_app_ != x.has_app_: return 0 |
|
1369 if self.has_app_ and self.app_ != x.app_: return 0 |
|
1370 if self.has_path_ != x.has_path_: return 0 |
|
1371 if self.has_path_ and self.path_ != x.path_: return 0 |
|
1372 return 1 |
|
1373 |
|
1374 def __eq__(self, other): |
|
1375 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
1376 |
|
1377 def __ne__(self, other): |
|
1378 return not (self == other) |
|
1379 |
|
1380 def IsInitialized(self, debug_strs=None): |
|
1381 initialized = 1 |
|
1382 if (not self.has_app_): |
|
1383 initialized = 0 |
|
1384 if debug_strs is not None: |
|
1385 debug_strs.append('Required field: app not set.') |
|
1386 if (not self.has_path_): |
|
1387 initialized = 0 |
|
1388 if debug_strs is not None: |
|
1389 debug_strs.append('Required field: path not set.') |
|
1390 elif not self.path_.IsInitialized(debug_strs): initialized = 0 |
|
1391 return initialized |
|
1392 |
|
1393 def ByteSize(self): |
|
1394 n = 0 |
|
1395 n += self.lengthString(len(self.app_)) |
|
1396 n += self.lengthString(self.path_.ByteSize()) |
|
1397 return n + 2 |
|
1398 |
|
1399 def Clear(self): |
|
1400 self.clear_app() |
|
1401 self.clear_path() |
|
1402 |
|
1403 def OutputUnchecked(self, out): |
|
1404 out.putVarInt32(106) |
|
1405 out.putPrefixedString(self.app_) |
|
1406 out.putVarInt32(114) |
|
1407 out.putVarInt32(self.path_.ByteSize()) |
|
1408 self.path_.OutputUnchecked(out) |
|
1409 |
|
1410 def TryMerge(self, d): |
|
1411 while d.avail() > 0: |
|
1412 tt = d.getVarInt32() |
|
1413 if tt == 106: |
|
1414 self.set_app(d.getPrefixedString()) |
|
1415 continue |
|
1416 if tt == 114: |
|
1417 length = d.getVarInt32() |
|
1418 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1419 d.skip(length) |
|
1420 self.mutable_path().TryMerge(tmp) |
|
1421 continue |
|
1422 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1423 d.skipData(tt) |
|
1424 |
|
1425 |
|
1426 def __str__(self, prefix="", printElemNumber=0): |
|
1427 res="" |
|
1428 if self.has_app_: res+=prefix+("app: %s\n" % self.DebugFormatString(self.app_)) |
|
1429 if self.has_path_: |
|
1430 res+=prefix+"path <\n" |
|
1431 res+=self.path_.__str__(prefix + " ", printElemNumber) |
|
1432 res+=prefix+">\n" |
|
1433 return res |
|
1434 |
|
1435 kapp = 13 |
|
1436 kpath = 14 |
|
1437 |
|
1438 _TEXT = ( |
|
1439 "ErrorCode", |
|
1440 None, |
|
1441 None, |
|
1442 None, |
|
1443 None, |
|
1444 None, |
|
1445 None, |
|
1446 None, |
|
1447 None, |
|
1448 None, |
|
1449 None, |
|
1450 None, |
|
1451 None, |
|
1452 "app", |
|
1453 "path", |
|
1454 ) |
|
1455 |
|
1456 _TYPES = ( |
|
1457 ProtocolBuffer.Encoder.NUMERIC, |
|
1458 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1459 |
|
1460 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1461 |
|
1462 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1463 |
|
1464 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1465 |
|
1466 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1467 |
|
1468 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1469 |
|
1470 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1471 |
|
1472 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1473 |
|
1474 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1475 |
|
1476 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1477 |
|
1478 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1479 |
|
1480 ProtocolBuffer.Encoder.MAX_TYPE, |
|
1481 |
|
1482 ProtocolBuffer.Encoder.STRING, |
|
1483 |
|
1484 ProtocolBuffer.Encoder.STRING, |
|
1485 |
|
1486 ) |
|
1487 |
|
1488 _STYLE = """""" |
|
1489 _STYLE_CONTENT_TYPE = """""" |
|
1490 class User(ProtocolBuffer.ProtocolMessage): |
|
1491 def __init__(self, contents=None): |
|
1492 self.email_ = "" |
|
1493 self.auth_domain_ = "" |
|
1494 self.nickname_ = "" |
|
1495 self.gaiaid_ = 0 |
|
1496 self.has_email_ = 0 |
|
1497 self.has_auth_domain_ = 0 |
|
1498 self.has_nickname_ = 0 |
|
1499 self.has_gaiaid_ = 0 |
|
1500 if contents is not None: self.MergeFromString(contents) |
|
1501 |
|
1502 def email(self): return self.email_ |
|
1503 |
|
1504 def set_email(self, x): |
|
1505 self.has_email_ = 1 |
|
1506 self.email_ = x |
|
1507 |
|
1508 def clear_email(self): |
|
1509 self.has_email_ = 0 |
|
1510 self.email_ = "" |
|
1511 |
|
1512 def has_email(self): return self.has_email_ |
|
1513 |
|
1514 def auth_domain(self): return self.auth_domain_ |
|
1515 |
|
1516 def set_auth_domain(self, x): |
|
1517 self.has_auth_domain_ = 1 |
|
1518 self.auth_domain_ = x |
|
1519 |
|
1520 def clear_auth_domain(self): |
|
1521 self.has_auth_domain_ = 0 |
|
1522 self.auth_domain_ = "" |
|
1523 |
|
1524 def has_auth_domain(self): return self.has_auth_domain_ |
|
1525 |
|
1526 def nickname(self): return self.nickname_ |
|
1527 |
|
1528 def set_nickname(self, x): |
|
1529 self.has_nickname_ = 1 |
|
1530 self.nickname_ = x |
|
1531 |
|
1532 def clear_nickname(self): |
|
1533 self.has_nickname_ = 0 |
|
1534 self.nickname_ = "" |
|
1535 |
|
1536 def has_nickname(self): return self.has_nickname_ |
|
1537 |
|
1538 def gaiaid(self): return self.gaiaid_ |
|
1539 |
|
1540 def set_gaiaid(self, x): |
|
1541 self.has_gaiaid_ = 1 |
|
1542 self.gaiaid_ = x |
|
1543 |
|
1544 def clear_gaiaid(self): |
|
1545 self.has_gaiaid_ = 0 |
|
1546 self.gaiaid_ = 0 |
|
1547 |
|
1548 def has_gaiaid(self): return self.has_gaiaid_ |
|
1549 |
|
1550 |
|
1551 def MergeFrom(self, x): |
|
1552 assert x is not self |
|
1553 if (x.has_email()): self.set_email(x.email()) |
|
1554 if (x.has_auth_domain()): self.set_auth_domain(x.auth_domain()) |
|
1555 if (x.has_nickname()): self.set_nickname(x.nickname()) |
|
1556 if (x.has_gaiaid()): self.set_gaiaid(x.gaiaid()) |
|
1557 |
|
1558 def Equals(self, x): |
|
1559 if x is self: return 1 |
|
1560 if self.has_email_ != x.has_email_: return 0 |
|
1561 if self.has_email_ and self.email_ != x.email_: return 0 |
|
1562 if self.has_auth_domain_ != x.has_auth_domain_: return 0 |
|
1563 if self.has_auth_domain_ and self.auth_domain_ != x.auth_domain_: return 0 |
|
1564 if self.has_nickname_ != x.has_nickname_: return 0 |
|
1565 if self.has_nickname_ and self.nickname_ != x.nickname_: return 0 |
|
1566 if self.has_gaiaid_ != x.has_gaiaid_: return 0 |
|
1567 if self.has_gaiaid_ and self.gaiaid_ != x.gaiaid_: return 0 |
|
1568 return 1 |
|
1569 |
|
1570 def __eq__(self, other): |
|
1571 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
1572 |
|
1573 def __ne__(self, other): |
|
1574 return not (self == other) |
|
1575 |
|
1576 def IsInitialized(self, debug_strs=None): |
|
1577 initialized = 1 |
|
1578 if (not self.has_email_): |
|
1579 initialized = 0 |
|
1580 if debug_strs is not None: |
|
1581 debug_strs.append('Required field: email not set.') |
|
1582 if (not self.has_auth_domain_): |
|
1583 initialized = 0 |
|
1584 if debug_strs is not None: |
|
1585 debug_strs.append('Required field: auth_domain not set.') |
|
1586 if (not self.has_gaiaid_): |
|
1587 initialized = 0 |
|
1588 if debug_strs is not None: |
|
1589 debug_strs.append('Required field: gaiaid not set.') |
|
1590 return initialized |
|
1591 |
|
1592 def ByteSize(self): |
|
1593 n = 0 |
|
1594 n += self.lengthString(len(self.email_)) |
|
1595 n += self.lengthString(len(self.auth_domain_)) |
|
1596 if (self.has_nickname_): n += 1 + self.lengthString(len(self.nickname_)) |
|
1597 n += self.lengthVarInt64(self.gaiaid_) |
|
1598 return n + 3 |
|
1599 |
|
1600 def Clear(self): |
|
1601 self.clear_email() |
|
1602 self.clear_auth_domain() |
|
1603 self.clear_nickname() |
|
1604 self.clear_gaiaid() |
|
1605 |
|
1606 def OutputUnchecked(self, out): |
|
1607 out.putVarInt32(10) |
|
1608 out.putPrefixedString(self.email_) |
|
1609 out.putVarInt32(18) |
|
1610 out.putPrefixedString(self.auth_domain_) |
|
1611 if (self.has_nickname_): |
|
1612 out.putVarInt32(26) |
|
1613 out.putPrefixedString(self.nickname_) |
|
1614 out.putVarInt32(32) |
|
1615 out.putVarInt64(self.gaiaid_) |
|
1616 |
|
1617 def TryMerge(self, d): |
|
1618 while d.avail() > 0: |
|
1619 tt = d.getVarInt32() |
|
1620 if tt == 10: |
|
1621 self.set_email(d.getPrefixedString()) |
|
1622 continue |
|
1623 if tt == 18: |
|
1624 self.set_auth_domain(d.getPrefixedString()) |
|
1625 continue |
|
1626 if tt == 26: |
|
1627 self.set_nickname(d.getPrefixedString()) |
|
1628 continue |
|
1629 if tt == 32: |
|
1630 self.set_gaiaid(d.getVarInt64()) |
|
1631 continue |
|
1632 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1633 d.skipData(tt) |
|
1634 |
|
1635 |
|
1636 def __str__(self, prefix="", printElemNumber=0): |
|
1637 res="" |
|
1638 if self.has_email_: res+=prefix+("email: %s\n" % self.DebugFormatString(self.email_)) |
|
1639 if self.has_auth_domain_: res+=prefix+("auth_domain: %s\n" % self.DebugFormatString(self.auth_domain_)) |
|
1640 if self.has_nickname_: res+=prefix+("nickname: %s\n" % self.DebugFormatString(self.nickname_)) |
|
1641 if self.has_gaiaid_: res+=prefix+("gaiaid: %s\n" % self.DebugFormatInt64(self.gaiaid_)) |
|
1642 return res |
|
1643 |
|
1644 kemail = 1 |
|
1645 kauth_domain = 2 |
|
1646 knickname = 3 |
|
1647 kgaiaid = 4 |
|
1648 |
|
1649 _TEXT = ( |
|
1650 "ErrorCode", |
|
1651 "email", |
|
1652 "auth_domain", |
|
1653 "nickname", |
|
1654 "gaiaid", |
|
1655 ) |
|
1656 |
|
1657 _TYPES = ( |
|
1658 ProtocolBuffer.Encoder.NUMERIC, |
|
1659 ProtocolBuffer.Encoder.STRING, |
|
1660 |
|
1661 ProtocolBuffer.Encoder.STRING, |
|
1662 |
|
1663 ProtocolBuffer.Encoder.STRING, |
|
1664 |
|
1665 ProtocolBuffer.Encoder.NUMERIC, |
|
1666 |
|
1667 ) |
|
1668 |
|
1669 _STYLE = """""" |
|
1670 _STYLE_CONTENT_TYPE = """""" |
|
1671 class EntityProto(ProtocolBuffer.ProtocolMessage): |
|
1672 |
|
1673 GD_CONTACT = 1 |
|
1674 GD_EVENT = 2 |
|
1675 GD_MESSAGE = 3 |
|
1676 |
|
1677 _Kind_NAMES = { |
|
1678 1: "GD_CONTACT", |
|
1679 2: "GD_EVENT", |
|
1680 3: "GD_MESSAGE", |
|
1681 } |
|
1682 |
|
1683 def Kind_Name(cls, x): return cls._Kind_NAMES.get(x, "") |
|
1684 Kind_Name = classmethod(Kind_Name) |
|
1685 |
|
1686 def __init__(self, contents=None): |
|
1687 self.key_ = Reference() |
|
1688 self.entity_group_ = Path() |
|
1689 self.owner_ = None |
|
1690 self.kind_ = 0 |
|
1691 self.kind_uri_ = "" |
|
1692 self.property_ = [] |
|
1693 self.raw_property_ = [] |
|
1694 self.has_key_ = 0 |
|
1695 self.has_entity_group_ = 0 |
|
1696 self.has_owner_ = 0 |
|
1697 self.has_kind_ = 0 |
|
1698 self.has_kind_uri_ = 0 |
|
1699 self.lazy_init_lock_ = thread.allocate_lock() |
|
1700 if contents is not None: self.MergeFromString(contents) |
|
1701 |
|
1702 def key(self): return self.key_ |
|
1703 |
|
1704 def mutable_key(self): self.has_key_ = 1; return self.key_ |
|
1705 |
|
1706 def clear_key(self):self.has_key_ = 0; self.key_.Clear() |
|
1707 |
|
1708 def has_key(self): return self.has_key_ |
|
1709 |
|
1710 def entity_group(self): return self.entity_group_ |
|
1711 |
|
1712 def mutable_entity_group(self): self.has_entity_group_ = 1; return self.entity_group_ |
|
1713 |
|
1714 def clear_entity_group(self):self.has_entity_group_ = 0; self.entity_group_.Clear() |
|
1715 |
|
1716 def has_entity_group(self): return self.has_entity_group_ |
|
1717 |
|
1718 def owner(self): |
|
1719 if self.owner_ is None: |
|
1720 self.lazy_init_lock_.acquire() |
|
1721 try: |
|
1722 if self.owner_ is None: self.owner_ = User() |
|
1723 finally: |
|
1724 self.lazy_init_lock_.release() |
|
1725 return self.owner_ |
|
1726 |
|
1727 def mutable_owner(self): self.has_owner_ = 1; return self.owner() |
|
1728 |
|
1729 def clear_owner(self): |
|
1730 self.has_owner_ = 0; |
|
1731 if self.owner_ is not None: self.owner_.Clear() |
|
1732 |
|
1733 def has_owner(self): return self.has_owner_ |
|
1734 |
|
1735 def kind(self): return self.kind_ |
|
1736 |
|
1737 def set_kind(self, x): |
|
1738 self.has_kind_ = 1 |
|
1739 self.kind_ = x |
|
1740 |
|
1741 def clear_kind(self): |
|
1742 self.has_kind_ = 0 |
|
1743 self.kind_ = 0 |
|
1744 |
|
1745 def has_kind(self): return self.has_kind_ |
|
1746 |
|
1747 def kind_uri(self): return self.kind_uri_ |
|
1748 |
|
1749 def set_kind_uri(self, x): |
|
1750 self.has_kind_uri_ = 1 |
|
1751 self.kind_uri_ = x |
|
1752 |
|
1753 def clear_kind_uri(self): |
|
1754 self.has_kind_uri_ = 0 |
|
1755 self.kind_uri_ = "" |
|
1756 |
|
1757 def has_kind_uri(self): return self.has_kind_uri_ |
|
1758 |
|
1759 def property_size(self): return len(self.property_) |
|
1760 def property_list(self): return self.property_ |
|
1761 |
|
1762 def property(self, i): |
|
1763 return self.property_[i] |
|
1764 |
|
1765 def mutable_property(self, i): |
|
1766 return self.property_[i] |
|
1767 |
|
1768 def add_property(self): |
|
1769 x = Property() |
|
1770 self.property_.append(x) |
|
1771 return x |
|
1772 |
|
1773 def clear_property(self): |
|
1774 self.property_ = [] |
|
1775 def raw_property_size(self): return len(self.raw_property_) |
|
1776 def raw_property_list(self): return self.raw_property_ |
|
1777 |
|
1778 def raw_property(self, i): |
|
1779 return self.raw_property_[i] |
|
1780 |
|
1781 def mutable_raw_property(self, i): |
|
1782 return self.raw_property_[i] |
|
1783 |
|
1784 def add_raw_property(self): |
|
1785 x = Property() |
|
1786 self.raw_property_.append(x) |
|
1787 return x |
|
1788 |
|
1789 def clear_raw_property(self): |
|
1790 self.raw_property_ = [] |
|
1791 |
|
1792 def MergeFrom(self, x): |
|
1793 assert x is not self |
|
1794 if (x.has_key()): self.mutable_key().MergeFrom(x.key()) |
|
1795 if (x.has_entity_group()): self.mutable_entity_group().MergeFrom(x.entity_group()) |
|
1796 if (x.has_owner()): self.mutable_owner().MergeFrom(x.owner()) |
|
1797 if (x.has_kind()): self.set_kind(x.kind()) |
|
1798 if (x.has_kind_uri()): self.set_kind_uri(x.kind_uri()) |
|
1799 for i in xrange(x.property_size()): self.add_property().CopyFrom(x.property(i)) |
|
1800 for i in xrange(x.raw_property_size()): self.add_raw_property().CopyFrom(x.raw_property(i)) |
|
1801 |
|
1802 def Equals(self, x): |
|
1803 if x is self: return 1 |
|
1804 if self.has_key_ != x.has_key_: return 0 |
|
1805 if self.has_key_ and self.key_ != x.key_: return 0 |
|
1806 if self.has_entity_group_ != x.has_entity_group_: return 0 |
|
1807 if self.has_entity_group_ and self.entity_group_ != x.entity_group_: return 0 |
|
1808 if self.has_owner_ != x.has_owner_: return 0 |
|
1809 if self.has_owner_ and self.owner_ != x.owner_: return 0 |
|
1810 if self.has_kind_ != x.has_kind_: return 0 |
|
1811 if self.has_kind_ and self.kind_ != x.kind_: return 0 |
|
1812 if self.has_kind_uri_ != x.has_kind_uri_: return 0 |
|
1813 if self.has_kind_uri_ and self.kind_uri_ != x.kind_uri_: return 0 |
|
1814 if len(self.property_) != len(x.property_): return 0 |
|
1815 for e1, e2 in zip(self.property_, x.property_): |
|
1816 if e1 != e2: return 0 |
|
1817 if len(self.raw_property_) != len(x.raw_property_): return 0 |
|
1818 for e1, e2 in zip(self.raw_property_, x.raw_property_): |
|
1819 if e1 != e2: return 0 |
|
1820 return 1 |
|
1821 |
|
1822 def __eq__(self, other): |
|
1823 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
1824 |
|
1825 def __ne__(self, other): |
|
1826 return not (self == other) |
|
1827 |
|
1828 def IsInitialized(self, debug_strs=None): |
|
1829 initialized = 1 |
|
1830 if (not self.has_key_): |
|
1831 initialized = 0 |
|
1832 if debug_strs is not None: |
|
1833 debug_strs.append('Required field: key not set.') |
|
1834 elif not self.key_.IsInitialized(debug_strs): initialized = 0 |
|
1835 if (not self.has_entity_group_): |
|
1836 initialized = 0 |
|
1837 if debug_strs is not None: |
|
1838 debug_strs.append('Required field: entity_group not set.') |
|
1839 elif not self.entity_group_.IsInitialized(debug_strs): initialized = 0 |
|
1840 if (self.has_owner_ and not self.owner_.IsInitialized(debug_strs)): initialized = 0 |
|
1841 for i in xrange(len(self.property_)): |
|
1842 if (not self.property_[i].IsInitialized(debug_strs)): initialized=0 |
|
1843 for i in xrange(len(self.raw_property_)): |
|
1844 if (not self.raw_property_[i].IsInitialized(debug_strs)): initialized=0 |
|
1845 return initialized |
|
1846 |
|
1847 def ByteSize(self): |
|
1848 n = 0 |
|
1849 n += self.lengthString(self.key_.ByteSize()) |
|
1850 n += self.lengthString(self.entity_group_.ByteSize()) |
|
1851 if (self.has_owner_): n += 2 + self.lengthString(self.owner_.ByteSize()) |
|
1852 if (self.has_kind_): n += 1 + self.lengthVarInt64(self.kind_) |
|
1853 if (self.has_kind_uri_): n += 1 + self.lengthString(len(self.kind_uri_)) |
|
1854 n += 1 * len(self.property_) |
|
1855 for i in xrange(len(self.property_)): n += self.lengthString(self.property_[i].ByteSize()) |
|
1856 n += 1 * len(self.raw_property_) |
|
1857 for i in xrange(len(self.raw_property_)): n += self.lengthString(self.raw_property_[i].ByteSize()) |
|
1858 return n + 3 |
|
1859 |
|
1860 def Clear(self): |
|
1861 self.clear_key() |
|
1862 self.clear_entity_group() |
|
1863 self.clear_owner() |
|
1864 self.clear_kind() |
|
1865 self.clear_kind_uri() |
|
1866 self.clear_property() |
|
1867 self.clear_raw_property() |
|
1868 |
|
1869 def OutputUnchecked(self, out): |
|
1870 if (self.has_kind_): |
|
1871 out.putVarInt32(32) |
|
1872 out.putVarInt32(self.kind_) |
|
1873 if (self.has_kind_uri_): |
|
1874 out.putVarInt32(42) |
|
1875 out.putPrefixedString(self.kind_uri_) |
|
1876 out.putVarInt32(106) |
|
1877 out.putVarInt32(self.key_.ByteSize()) |
|
1878 self.key_.OutputUnchecked(out) |
|
1879 for i in xrange(len(self.property_)): |
|
1880 out.putVarInt32(114) |
|
1881 out.putVarInt32(self.property_[i].ByteSize()) |
|
1882 self.property_[i].OutputUnchecked(out) |
|
1883 for i in xrange(len(self.raw_property_)): |
|
1884 out.putVarInt32(122) |
|
1885 out.putVarInt32(self.raw_property_[i].ByteSize()) |
|
1886 self.raw_property_[i].OutputUnchecked(out) |
|
1887 out.putVarInt32(130) |
|
1888 out.putVarInt32(self.entity_group_.ByteSize()) |
|
1889 self.entity_group_.OutputUnchecked(out) |
|
1890 if (self.has_owner_): |
|
1891 out.putVarInt32(138) |
|
1892 out.putVarInt32(self.owner_.ByteSize()) |
|
1893 self.owner_.OutputUnchecked(out) |
|
1894 |
|
1895 def TryMerge(self, d): |
|
1896 while d.avail() > 0: |
|
1897 tt = d.getVarInt32() |
|
1898 if tt == 32: |
|
1899 self.set_kind(d.getVarInt32()) |
|
1900 continue |
|
1901 if tt == 42: |
|
1902 self.set_kind_uri(d.getPrefixedString()) |
|
1903 continue |
|
1904 if tt == 106: |
|
1905 length = d.getVarInt32() |
|
1906 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1907 d.skip(length) |
|
1908 self.mutable_key().TryMerge(tmp) |
|
1909 continue |
|
1910 if tt == 114: |
|
1911 length = d.getVarInt32() |
|
1912 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1913 d.skip(length) |
|
1914 self.add_property().TryMerge(tmp) |
|
1915 continue |
|
1916 if tt == 122: |
|
1917 length = d.getVarInt32() |
|
1918 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1919 d.skip(length) |
|
1920 self.add_raw_property().TryMerge(tmp) |
|
1921 continue |
|
1922 if tt == 130: |
|
1923 length = d.getVarInt32() |
|
1924 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1925 d.skip(length) |
|
1926 self.mutable_entity_group().TryMerge(tmp) |
|
1927 continue |
|
1928 if tt == 138: |
|
1929 length = d.getVarInt32() |
|
1930 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
1931 d.skip(length) |
|
1932 self.mutable_owner().TryMerge(tmp) |
|
1933 continue |
|
1934 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1935 d.skipData(tt) |
|
1936 |
|
1937 |
|
1938 def __str__(self, prefix="", printElemNumber=0): |
|
1939 res="" |
|
1940 if self.has_key_: |
|
1941 res+=prefix+"key <\n" |
|
1942 res+=self.key_.__str__(prefix + " ", printElemNumber) |
|
1943 res+=prefix+">\n" |
|
1944 if self.has_entity_group_: |
|
1945 res+=prefix+"entity_group <\n" |
|
1946 res+=self.entity_group_.__str__(prefix + " ", printElemNumber) |
|
1947 res+=prefix+">\n" |
|
1948 if self.has_owner_: |
|
1949 res+=prefix+"owner <\n" |
|
1950 res+=self.owner_.__str__(prefix + " ", printElemNumber) |
|
1951 res+=prefix+">\n" |
|
1952 if self.has_kind_: res+=prefix+("kind: %s\n" % self.DebugFormatInt32(self.kind_)) |
|
1953 if self.has_kind_uri_: res+=prefix+("kind_uri: %s\n" % self.DebugFormatString(self.kind_uri_)) |
|
1954 cnt=0 |
|
1955 for e in self.property_: |
|
1956 elm="" |
|
1957 if printElemNumber: elm="(%d)" % cnt |
|
1958 res+=prefix+("property%s <\n" % elm) |
|
1959 res+=e.__str__(prefix + " ", printElemNumber) |
|
1960 res+=prefix+">\n" |
|
1961 cnt+=1 |
|
1962 cnt=0 |
|
1963 for e in self.raw_property_: |
|
1964 elm="" |
|
1965 if printElemNumber: elm="(%d)" % cnt |
|
1966 res+=prefix+("raw_property%s <\n" % elm) |
|
1967 res+=e.__str__(prefix + " ", printElemNumber) |
|
1968 res+=prefix+">\n" |
|
1969 cnt+=1 |
|
1970 return res |
|
1971 |
|
1972 kkey = 13 |
|
1973 kentity_group = 16 |
|
1974 kowner = 17 |
|
1975 kkind = 4 |
|
1976 kkind_uri = 5 |
|
1977 kproperty = 14 |
|
1978 kraw_property = 15 |
|
1979 |
|
1980 _TEXT = ( |
|
1981 "ErrorCode", |
|
1982 None, |
|
1983 None, |
|
1984 None, |
|
1985 "kind", |
|
1986 "kind_uri", |
|
1987 None, |
|
1988 None, |
|
1989 None, |
|
1990 None, |
|
1991 None, |
|
1992 None, |
|
1993 None, |
|
1994 "key", |
|
1995 "property", |
|
1996 "raw_property", |
|
1997 "entity_group", |
|
1998 "owner", |
|
1999 ) |
|
2000 |
|
2001 _TYPES = ( |
|
2002 ProtocolBuffer.Encoder.NUMERIC, |
|
2003 ProtocolBuffer.Encoder.MAX_TYPE, |
|
2004 |
|
2005 ProtocolBuffer.Encoder.MAX_TYPE, |
|
2006 |
|
2007 ProtocolBuffer.Encoder.MAX_TYPE, |
|
2008 |
|
2009 ProtocolBuffer.Encoder.NUMERIC, |
|
2010 |
|
2011 ProtocolBuffer.Encoder.STRING, |
|
2012 |
|
2013 ProtocolBuffer.Encoder.MAX_TYPE, |
|
2014 |
|
2015 ProtocolBuffer.Encoder.MAX_TYPE, |
|
2016 |
|
2017 ProtocolBuffer.Encoder.MAX_TYPE, |
|
2018 |
|
2019 ProtocolBuffer.Encoder.MAX_TYPE, |
|
2020 |
|
2021 ProtocolBuffer.Encoder.MAX_TYPE, |
|
2022 |
|
2023 ProtocolBuffer.Encoder.MAX_TYPE, |
|
2024 |
|
2025 ProtocolBuffer.Encoder.MAX_TYPE, |
|
2026 |
|
2027 ProtocolBuffer.Encoder.STRING, |
|
2028 |
|
2029 ProtocolBuffer.Encoder.STRING, |
|
2030 |
|
2031 ProtocolBuffer.Encoder.STRING, |
|
2032 |
|
2033 ProtocolBuffer.Encoder.STRING, |
|
2034 |
|
2035 ProtocolBuffer.Encoder.STRING, |
|
2036 |
|
2037 ) |
|
2038 |
|
2039 _STYLE = """""" |
|
2040 _STYLE_CONTENT_TYPE = """""" |
|
2041 class CompositeProperty(ProtocolBuffer.ProtocolMessage): |
|
2042 def __init__(self, contents=None): |
|
2043 self.index_id_ = 0 |
|
2044 self.value_ = [] |
|
2045 self.has_index_id_ = 0 |
|
2046 if contents is not None: self.MergeFromString(contents) |
|
2047 |
|
2048 def index_id(self): return self.index_id_ |
|
2049 |
|
2050 def set_index_id(self, x): |
|
2051 self.has_index_id_ = 1 |
|
2052 self.index_id_ = x |
|
2053 |
|
2054 def clear_index_id(self): |
|
2055 self.has_index_id_ = 0 |
|
2056 self.index_id_ = 0 |
|
2057 |
|
2058 def has_index_id(self): return self.has_index_id_ |
|
2059 |
|
2060 def value_size(self): return len(self.value_) |
|
2061 def value_list(self): return self.value_ |
|
2062 |
|
2063 def value(self, i): |
|
2064 return self.value_[i] |
|
2065 |
|
2066 def set_value(self, i, x): |
|
2067 self.value_[i] = x |
|
2068 |
|
2069 def add_value(self, x): |
|
2070 self.value_.append(x) |
|
2071 |
|
2072 def clear_value(self): |
|
2073 self.value_ = [] |
|
2074 |
|
2075 |
|
2076 def MergeFrom(self, x): |
|
2077 assert x is not self |
|
2078 if (x.has_index_id()): self.set_index_id(x.index_id()) |
|
2079 for i in xrange(x.value_size()): self.add_value(x.value(i)) |
|
2080 |
|
2081 def Equals(self, x): |
|
2082 if x is self: return 1 |
|
2083 if self.has_index_id_ != x.has_index_id_: return 0 |
|
2084 if self.has_index_id_ and self.index_id_ != x.index_id_: return 0 |
|
2085 if len(self.value_) != len(x.value_): return 0 |
|
2086 for e1, e2 in zip(self.value_, x.value_): |
|
2087 if e1 != e2: return 0 |
|
2088 return 1 |
|
2089 |
|
2090 def __eq__(self, other): |
|
2091 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
2092 |
|
2093 def __ne__(self, other): |
|
2094 return not (self == other) |
|
2095 |
|
2096 def IsInitialized(self, debug_strs=None): |
|
2097 initialized = 1 |
|
2098 if (not self.has_index_id_): |
|
2099 initialized = 0 |
|
2100 if debug_strs is not None: |
|
2101 debug_strs.append('Required field: index_id not set.') |
|
2102 return initialized |
|
2103 |
|
2104 def ByteSize(self): |
|
2105 n = 0 |
|
2106 n += self.lengthVarInt64(self.index_id_) |
|
2107 n += 1 * len(self.value_) |
|
2108 for i in xrange(len(self.value_)): n += self.lengthString(len(self.value_[i])) |
|
2109 return n + 1 |
|
2110 |
|
2111 def Clear(self): |
|
2112 self.clear_index_id() |
|
2113 self.clear_value() |
|
2114 |
|
2115 def OutputUnchecked(self, out): |
|
2116 out.putVarInt32(8) |
|
2117 out.putVarInt64(self.index_id_) |
|
2118 for i in xrange(len(self.value_)): |
|
2119 out.putVarInt32(18) |
|
2120 out.putPrefixedString(self.value_[i]) |
|
2121 |
|
2122 def TryMerge(self, d): |
|
2123 while d.avail() > 0: |
|
2124 tt = d.getVarInt32() |
|
2125 if tt == 8: |
|
2126 self.set_index_id(d.getVarInt64()) |
|
2127 continue |
|
2128 if tt == 18: |
|
2129 self.add_value(d.getPrefixedString()) |
|
2130 continue |
|
2131 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
2132 d.skipData(tt) |
|
2133 |
|
2134 |
|
2135 def __str__(self, prefix="", printElemNumber=0): |
|
2136 res="" |
|
2137 if self.has_index_id_: res+=prefix+("index_id: %s\n" % self.DebugFormatInt64(self.index_id_)) |
|
2138 cnt=0 |
|
2139 for e in self.value_: |
|
2140 elm="" |
|
2141 if printElemNumber: elm="(%d)" % cnt |
|
2142 res+=prefix+("value%s: %s\n" % (elm, self.DebugFormatString(e))) |
|
2143 cnt+=1 |
|
2144 return res |
|
2145 |
|
2146 kindex_id = 1 |
|
2147 kvalue = 2 |
|
2148 |
|
2149 _TEXT = ( |
|
2150 "ErrorCode", |
|
2151 "index_id", |
|
2152 "value", |
|
2153 ) |
|
2154 |
|
2155 _TYPES = ( |
|
2156 ProtocolBuffer.Encoder.NUMERIC, |
|
2157 ProtocolBuffer.Encoder.NUMERIC, |
|
2158 |
|
2159 ProtocolBuffer.Encoder.STRING, |
|
2160 |
|
2161 ) |
|
2162 |
|
2163 _STYLE = """""" |
|
2164 _STYLE_CONTENT_TYPE = """""" |
|
2165 class Index_Property(ProtocolBuffer.ProtocolMessage): |
|
2166 |
|
2167 ASCENDING = 1 |
|
2168 DESCENDING = 2 |
|
2169 |
|
2170 _Direction_NAMES = { |
|
2171 1: "ASCENDING", |
|
2172 2: "DESCENDING", |
|
2173 } |
|
2174 |
|
2175 def Direction_Name(cls, x): return cls._Direction_NAMES.get(x, "") |
|
2176 Direction_Name = classmethod(Direction_Name) |
|
2177 |
|
2178 def __init__(self, contents=None): |
|
2179 self.name_ = "" |
|
2180 self.direction_ = 1 |
|
2181 self.has_name_ = 0 |
|
2182 self.has_direction_ = 0 |
|
2183 if contents is not None: self.MergeFromString(contents) |
|
2184 |
|
2185 def name(self): return self.name_ |
|
2186 |
|
2187 def set_name(self, x): |
|
2188 self.has_name_ = 1 |
|
2189 self.name_ = x |
|
2190 |
|
2191 def clear_name(self): |
|
2192 self.has_name_ = 0 |
|
2193 self.name_ = "" |
|
2194 |
|
2195 def has_name(self): return self.has_name_ |
|
2196 |
|
2197 def direction(self): return self.direction_ |
|
2198 |
|
2199 def set_direction(self, x): |
|
2200 self.has_direction_ = 1 |
|
2201 self.direction_ = x |
|
2202 |
|
2203 def clear_direction(self): |
|
2204 self.has_direction_ = 0 |
|
2205 self.direction_ = 1 |
|
2206 |
|
2207 def has_direction(self): return self.has_direction_ |
|
2208 |
|
2209 |
|
2210 def MergeFrom(self, x): |
|
2211 assert x is not self |
|
2212 if (x.has_name()): self.set_name(x.name()) |
|
2213 if (x.has_direction()): self.set_direction(x.direction()) |
|
2214 |
|
2215 def Equals(self, x): |
|
2216 if x is self: return 1 |
|
2217 if self.has_name_ != x.has_name_: return 0 |
|
2218 if self.has_name_ and self.name_ != x.name_: return 0 |
|
2219 if self.has_direction_ != x.has_direction_: return 0 |
|
2220 if self.has_direction_ and self.direction_ != x.direction_: return 0 |
|
2221 return 1 |
|
2222 |
|
2223 def __eq__(self, other): |
|
2224 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
2225 |
|
2226 def __ne__(self, other): |
|
2227 return not (self == other) |
|
2228 |
|
2229 def IsInitialized(self, debug_strs=None): |
|
2230 initialized = 1 |
|
2231 if (not self.has_name_): |
|
2232 initialized = 0 |
|
2233 if debug_strs is not None: |
|
2234 debug_strs.append('Required field: name not set.') |
|
2235 return initialized |
|
2236 |
|
2237 def ByteSize(self): |
|
2238 n = 0 |
|
2239 n += self.lengthString(len(self.name_)) |
|
2240 if (self.has_direction_): n += 1 + self.lengthVarInt64(self.direction_) |
|
2241 return n + 1 |
|
2242 |
|
2243 def Clear(self): |
|
2244 self.clear_name() |
|
2245 self.clear_direction() |
|
2246 |
|
2247 def OutputUnchecked(self, out): |
|
2248 out.putVarInt32(26) |
|
2249 out.putPrefixedString(self.name_) |
|
2250 if (self.has_direction_): |
|
2251 out.putVarInt32(32) |
|
2252 out.putVarInt32(self.direction_) |
|
2253 |
|
2254 def TryMerge(self, d): |
|
2255 while 1: |
|
2256 tt = d.getVarInt32() |
|
2257 if tt == 20: break |
|
2258 if tt == 26: |
|
2259 self.set_name(d.getPrefixedString()) |
|
2260 continue |
|
2261 if tt == 32: |
|
2262 self.set_direction(d.getVarInt32()) |
|
2263 continue |
|
2264 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
2265 d.skipData(tt) |
|
2266 |
|
2267 |
|
2268 def __str__(self, prefix="", printElemNumber=0): |
|
2269 res="" |
|
2270 if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_)) |
|
2271 if self.has_direction_: res+=prefix+("direction: %s\n" % self.DebugFormatInt32(self.direction_)) |
|
2272 return res |
|
2273 |
|
2274 class Index(ProtocolBuffer.ProtocolMessage): |
|
2275 def __init__(self, contents=None): |
|
2276 self.entity_type_ = "" |
|
2277 self.ancestor_ = 0 |
|
2278 self.property_ = [] |
|
2279 self.has_entity_type_ = 0 |
|
2280 self.has_ancestor_ = 0 |
|
2281 if contents is not None: self.MergeFromString(contents) |
|
2282 |
|
2283 def entity_type(self): return self.entity_type_ |
|
2284 |
|
2285 def set_entity_type(self, x): |
|
2286 self.has_entity_type_ = 1 |
|
2287 self.entity_type_ = x |
|
2288 |
|
2289 def clear_entity_type(self): |
|
2290 self.has_entity_type_ = 0 |
|
2291 self.entity_type_ = "" |
|
2292 |
|
2293 def has_entity_type(self): return self.has_entity_type_ |
|
2294 |
|
2295 def ancestor(self): return self.ancestor_ |
|
2296 |
|
2297 def set_ancestor(self, x): |
|
2298 self.has_ancestor_ = 1 |
|
2299 self.ancestor_ = x |
|
2300 |
|
2301 def clear_ancestor(self): |
|
2302 self.has_ancestor_ = 0 |
|
2303 self.ancestor_ = 0 |
|
2304 |
|
2305 def has_ancestor(self): return self.has_ancestor_ |
|
2306 |
|
2307 def property_size(self): return len(self.property_) |
|
2308 def property_list(self): return self.property_ |
|
2309 |
|
2310 def property(self, i): |
|
2311 return self.property_[i] |
|
2312 |
|
2313 def mutable_property(self, i): |
|
2314 return self.property_[i] |
|
2315 |
|
2316 def add_property(self): |
|
2317 x = Index_Property() |
|
2318 self.property_.append(x) |
|
2319 return x |
|
2320 |
|
2321 def clear_property(self): |
|
2322 self.property_ = [] |
|
2323 |
|
2324 def MergeFrom(self, x): |
|
2325 assert x is not self |
|
2326 if (x.has_entity_type()): self.set_entity_type(x.entity_type()) |
|
2327 if (x.has_ancestor()): self.set_ancestor(x.ancestor()) |
|
2328 for i in xrange(x.property_size()): self.add_property().CopyFrom(x.property(i)) |
|
2329 |
|
2330 def Equals(self, x): |
|
2331 if x is self: return 1 |
|
2332 if self.has_entity_type_ != x.has_entity_type_: return 0 |
|
2333 if self.has_entity_type_ and self.entity_type_ != x.entity_type_: return 0 |
|
2334 if self.has_ancestor_ != x.has_ancestor_: return 0 |
|
2335 if self.has_ancestor_ and self.ancestor_ != x.ancestor_: return 0 |
|
2336 if len(self.property_) != len(x.property_): return 0 |
|
2337 for e1, e2 in zip(self.property_, x.property_): |
|
2338 if e1 != e2: return 0 |
|
2339 return 1 |
|
2340 |
|
2341 def __eq__(self, other): |
|
2342 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
2343 |
|
2344 def __ne__(self, other): |
|
2345 return not (self == other) |
|
2346 |
|
2347 def IsInitialized(self, debug_strs=None): |
|
2348 initialized = 1 |
|
2349 if (not self.has_entity_type_): |
|
2350 initialized = 0 |
|
2351 if debug_strs is not None: |
|
2352 debug_strs.append('Required field: entity_type not set.') |
|
2353 if (not self.has_ancestor_): |
|
2354 initialized = 0 |
|
2355 if debug_strs is not None: |
|
2356 debug_strs.append('Required field: ancestor not set.') |
|
2357 for i in xrange(len(self.property_)): |
|
2358 if (not self.property_[i].IsInitialized(debug_strs)): initialized=0 |
|
2359 return initialized |
|
2360 |
|
2361 def ByteSize(self): |
|
2362 n = 0 |
|
2363 n += self.lengthString(len(self.entity_type_)) |
|
2364 n += 2 * len(self.property_) |
|
2365 for i in xrange(len(self.property_)): n += self.property_[i].ByteSize() |
|
2366 return n + 3 |
|
2367 |
|
2368 def Clear(self): |
|
2369 self.clear_entity_type() |
|
2370 self.clear_ancestor() |
|
2371 self.clear_property() |
|
2372 |
|
2373 def OutputUnchecked(self, out): |
|
2374 out.putVarInt32(10) |
|
2375 out.putPrefixedString(self.entity_type_) |
|
2376 for i in xrange(len(self.property_)): |
|
2377 out.putVarInt32(19) |
|
2378 self.property_[i].OutputUnchecked(out) |
|
2379 out.putVarInt32(20) |
|
2380 out.putVarInt32(40) |
|
2381 out.putBoolean(self.ancestor_) |
|
2382 |
|
2383 def TryMerge(self, d): |
|
2384 while d.avail() > 0: |
|
2385 tt = d.getVarInt32() |
|
2386 if tt == 10: |
|
2387 self.set_entity_type(d.getPrefixedString()) |
|
2388 continue |
|
2389 if tt == 19: |
|
2390 self.add_property().TryMerge(d) |
|
2391 continue |
|
2392 if tt == 40: |
|
2393 self.set_ancestor(d.getBoolean()) |
|
2394 continue |
|
2395 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
2396 d.skipData(tt) |
|
2397 |
|
2398 |
|
2399 def __str__(self, prefix="", printElemNumber=0): |
|
2400 res="" |
|
2401 if self.has_entity_type_: res+=prefix+("entity_type: %s\n" % self.DebugFormatString(self.entity_type_)) |
|
2402 if self.has_ancestor_: res+=prefix+("ancestor: %s\n" % self.DebugFormatBool(self.ancestor_)) |
|
2403 cnt=0 |
|
2404 for e in self.property_: |
|
2405 elm="" |
|
2406 if printElemNumber: elm="(%d)" % cnt |
|
2407 res+=prefix+("Property%s {\n" % elm) |
|
2408 res+=e.__str__(prefix + " ", printElemNumber) |
|
2409 res+=prefix+"}\n" |
|
2410 cnt+=1 |
|
2411 return res |
|
2412 |
|
2413 kentity_type = 1 |
|
2414 kancestor = 5 |
|
2415 kPropertyGroup = 2 |
|
2416 kPropertyname = 3 |
|
2417 kPropertydirection = 4 |
|
2418 |
|
2419 _TEXT = ( |
|
2420 "ErrorCode", |
|
2421 "entity_type", |
|
2422 "Property", |
|
2423 "name", |
|
2424 "direction", |
|
2425 "ancestor", |
|
2426 ) |
|
2427 |
|
2428 _TYPES = ( |
|
2429 ProtocolBuffer.Encoder.NUMERIC, |
|
2430 ProtocolBuffer.Encoder.STRING, |
|
2431 |
|
2432 ProtocolBuffer.Encoder.STARTGROUP, |
|
2433 |
|
2434 ProtocolBuffer.Encoder.STRING, |
|
2435 |
|
2436 ProtocolBuffer.Encoder.NUMERIC, |
|
2437 |
|
2438 ProtocolBuffer.Encoder.NUMERIC, |
|
2439 |
|
2440 ) |
|
2441 |
|
2442 _STYLE = """""" |
|
2443 _STYLE_CONTENT_TYPE = """""" |
|
2444 class CompositeIndex(ProtocolBuffer.ProtocolMessage): |
|
2445 |
|
2446 WRITE_ONLY = 1 |
|
2447 READ_WRITE = 2 |
|
2448 DELETED = 3 |
|
2449 ERROR = 4 |
|
2450 |
|
2451 _State_NAMES = { |
|
2452 1: "WRITE_ONLY", |
|
2453 2: "READ_WRITE", |
|
2454 3: "DELETED", |
|
2455 4: "ERROR", |
|
2456 } |
|
2457 |
|
2458 def State_Name(cls, x): return cls._State_NAMES.get(x, "") |
|
2459 State_Name = classmethod(State_Name) |
|
2460 |
|
2461 def __init__(self, contents=None): |
|
2462 self.app_id_ = "" |
|
2463 self.id_ = 0 |
|
2464 self.definition_ = Index() |
|
2465 self.state_ = 0 |
|
2466 self.has_app_id_ = 0 |
|
2467 self.has_id_ = 0 |
|
2468 self.has_definition_ = 0 |
|
2469 self.has_state_ = 0 |
|
2470 if contents is not None: self.MergeFromString(contents) |
|
2471 |
|
2472 def app_id(self): return self.app_id_ |
|
2473 |
|
2474 def set_app_id(self, x): |
|
2475 self.has_app_id_ = 1 |
|
2476 self.app_id_ = x |
|
2477 |
|
2478 def clear_app_id(self): |
|
2479 self.has_app_id_ = 0 |
|
2480 self.app_id_ = "" |
|
2481 |
|
2482 def has_app_id(self): return self.has_app_id_ |
|
2483 |
|
2484 def id(self): return self.id_ |
|
2485 |
|
2486 def set_id(self, x): |
|
2487 self.has_id_ = 1 |
|
2488 self.id_ = x |
|
2489 |
|
2490 def clear_id(self): |
|
2491 self.has_id_ = 0 |
|
2492 self.id_ = 0 |
|
2493 |
|
2494 def has_id(self): return self.has_id_ |
|
2495 |
|
2496 def definition(self): return self.definition_ |
|
2497 |
|
2498 def mutable_definition(self): self.has_definition_ = 1; return self.definition_ |
|
2499 |
|
2500 def clear_definition(self):self.has_definition_ = 0; self.definition_.Clear() |
|
2501 |
|
2502 def has_definition(self): return self.has_definition_ |
|
2503 |
|
2504 def state(self): return self.state_ |
|
2505 |
|
2506 def set_state(self, x): |
|
2507 self.has_state_ = 1 |
|
2508 self.state_ = x |
|
2509 |
|
2510 def clear_state(self): |
|
2511 self.has_state_ = 0 |
|
2512 self.state_ = 0 |
|
2513 |
|
2514 def has_state(self): return self.has_state_ |
|
2515 |
|
2516 |
|
2517 def MergeFrom(self, x): |
|
2518 assert x is not self |
|
2519 if (x.has_app_id()): self.set_app_id(x.app_id()) |
|
2520 if (x.has_id()): self.set_id(x.id()) |
|
2521 if (x.has_definition()): self.mutable_definition().MergeFrom(x.definition()) |
|
2522 if (x.has_state()): self.set_state(x.state()) |
|
2523 |
|
2524 def Equals(self, x): |
|
2525 if x is self: return 1 |
|
2526 if self.has_app_id_ != x.has_app_id_: return 0 |
|
2527 if self.has_app_id_ and self.app_id_ != x.app_id_: return 0 |
|
2528 if self.has_id_ != x.has_id_: return 0 |
|
2529 if self.has_id_ and self.id_ != x.id_: return 0 |
|
2530 if self.has_definition_ != x.has_definition_: return 0 |
|
2531 if self.has_definition_ and self.definition_ != x.definition_: return 0 |
|
2532 if self.has_state_ != x.has_state_: return 0 |
|
2533 if self.has_state_ and self.state_ != x.state_: return 0 |
|
2534 return 1 |
|
2535 |
|
2536 def __eq__(self, other): |
|
2537 return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other) |
|
2538 |
|
2539 def __ne__(self, other): |
|
2540 return not (self == other) |
|
2541 |
|
2542 def IsInitialized(self, debug_strs=None): |
|
2543 initialized = 1 |
|
2544 if (not self.has_app_id_): |
|
2545 initialized = 0 |
|
2546 if debug_strs is not None: |
|
2547 debug_strs.append('Required field: app_id not set.') |
|
2548 if (not self.has_id_): |
|
2549 initialized = 0 |
|
2550 if debug_strs is not None: |
|
2551 debug_strs.append('Required field: id not set.') |
|
2552 if (not self.has_definition_): |
|
2553 initialized = 0 |
|
2554 if debug_strs is not None: |
|
2555 debug_strs.append('Required field: definition not set.') |
|
2556 elif not self.definition_.IsInitialized(debug_strs): initialized = 0 |
|
2557 if (not self.has_state_): |
|
2558 initialized = 0 |
|
2559 if debug_strs is not None: |
|
2560 debug_strs.append('Required field: state not set.') |
|
2561 return initialized |
|
2562 |
|
2563 def ByteSize(self): |
|
2564 n = 0 |
|
2565 n += self.lengthString(len(self.app_id_)) |
|
2566 n += self.lengthVarInt64(self.id_) |
|
2567 n += self.lengthString(self.definition_.ByteSize()) |
|
2568 n += self.lengthVarInt64(self.state_) |
|
2569 return n + 4 |
|
2570 |
|
2571 def Clear(self): |
|
2572 self.clear_app_id() |
|
2573 self.clear_id() |
|
2574 self.clear_definition() |
|
2575 self.clear_state() |
|
2576 |
|
2577 def OutputUnchecked(self, out): |
|
2578 out.putVarInt32(10) |
|
2579 out.putPrefixedString(self.app_id_) |
|
2580 out.putVarInt32(16) |
|
2581 out.putVarInt64(self.id_) |
|
2582 out.putVarInt32(26) |
|
2583 out.putVarInt32(self.definition_.ByteSize()) |
|
2584 self.definition_.OutputUnchecked(out) |
|
2585 out.putVarInt32(32) |
|
2586 out.putVarInt32(self.state_) |
|
2587 |
|
2588 def TryMerge(self, d): |
|
2589 while d.avail() > 0: |
|
2590 tt = d.getVarInt32() |
|
2591 if tt == 10: |
|
2592 self.set_app_id(d.getPrefixedString()) |
|
2593 continue |
|
2594 if tt == 16: |
|
2595 self.set_id(d.getVarInt64()) |
|
2596 continue |
|
2597 if tt == 26: |
|
2598 length = d.getVarInt32() |
|
2599 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length) |
|
2600 d.skip(length) |
|
2601 self.mutable_definition().TryMerge(tmp) |
|
2602 continue |
|
2603 if tt == 32: |
|
2604 self.set_state(d.getVarInt32()) |
|
2605 continue |
|
2606 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
2607 d.skipData(tt) |
|
2608 |
|
2609 |
|
2610 def __str__(self, prefix="", printElemNumber=0): |
|
2611 res="" |
|
2612 if self.has_app_id_: res+=prefix+("app_id: %s\n" % self.DebugFormatString(self.app_id_)) |
|
2613 if self.has_id_: res+=prefix+("id: %s\n" % self.DebugFormatInt64(self.id_)) |
|
2614 if self.has_definition_: |
|
2615 res+=prefix+"definition <\n" |
|
2616 res+=self.definition_.__str__(prefix + " ", printElemNumber) |
|
2617 res+=prefix+">\n" |
|
2618 if self.has_state_: res+=prefix+("state: %s\n" % self.DebugFormatInt32(self.state_)) |
|
2619 return res |
|
2620 |
|
2621 kapp_id = 1 |
|
2622 kid = 2 |
|
2623 kdefinition = 3 |
|
2624 kstate = 4 |
|
2625 |
|
2626 _TEXT = ( |
|
2627 "ErrorCode", |
|
2628 "app_id", |
|
2629 "id", |
|
2630 "definition", |
|
2631 "state", |
|
2632 ) |
|
2633 |
|
2634 _TYPES = ( |
|
2635 ProtocolBuffer.Encoder.NUMERIC, |
|
2636 ProtocolBuffer.Encoder.STRING, |
|
2637 |
|
2638 ProtocolBuffer.Encoder.NUMERIC, |
|
2639 |
|
2640 ProtocolBuffer.Encoder.STRING, |
|
2641 |
|
2642 ProtocolBuffer.Encoder.NUMERIC, |
|
2643 |
|
2644 ) |
|
2645 |
|
2646 _STYLE = """""" |
|
2647 _STYLE_CONTENT_TYPE = """""" |
|
2648 |
|
2649 __all__ = ['PropertyValue','PropertyValue_ReferenceValuePathElement','PropertyValue_PointValue','PropertyValue_UserValue','PropertyValue_ReferenceValue','Property','Path','Path_Element','Reference','User','EntityProto','CompositeProperty','Index','Index_Property','CompositeIndex'] |