summaryrefslogtreecommitdiffstats
path: root/google_appengine/google/appengine/api/capabilities/capability_service_pb.py
blob: 9f9ba2925aa486769bce83a8e30f7e38d895d1a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from google.net.proto import ProtocolBuffer
import array
import dummy_thread as thread

__pychecker__ = """maxreturns=0 maxbranches=0 no-callinit
                   unusednames=printElemNumber,debug_strs no-special"""

from google.appengine.base.capabilities_pb import CapabilityConfig
class IsEnabledRequest(ProtocolBuffer.ProtocolMessage):
  has_package_ = 0
  package_ = ""

  def __init__(self, contents=None):
    self.capability_ = []
    self.call_ = []
    if contents is not None: self.MergeFromString(contents)

  def package(self): return self.package_

  def set_package(self, x):
    self.has_package_ = 1
    self.package_ = x

  def clear_package(self):
    if self.has_package_:
      self.has_package_ = 0
      self.package_ = ""

  def has_package(self): return self.has_package_

  def capability_size(self): return len(self.capability_)
  def capability_list(self): return self.capability_

  def capability(self, i):
    return self.capability_[i]

  def set_capability(self, i, x):
    self.capability_[i] = x

  def add_capability(self, x):
    self.capability_.append(x)

  def clear_capability(self):
    self.capability_ = []

  def call_size(self): return len(self.call_)
  def call_list(self): return self.call_

  def call(self, i):
    return self.call_[i]

  def set_call(self, i, x):
    self.call_[i] = x

  def add_call(self, x):
    self.call_.append(x)

  def clear_call(self):
    self.call_ = []


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_package()): self.set_package(x.package())
    for i in xrange(x.capability_size()): self.add_capability(x.capability(i))
    for i in xrange(x.call_size()): self.add_call(x.call(i))

  def Equals(self, x):
    if x is self: return 1
    if self.has_package_ != x.has_package_: return 0
    if self.has_package_ and self.package_ != x.package_: return 0
    if len(self.capability_) != len(x.capability_): return 0
    for e1, e2 in zip(self.capability_, x.capability_):
      if e1 != e2: return 0
    if len(self.call_) != len(x.call_): return 0
    for e1, e2 in zip(self.call_, x.call_):
      if e1 != e2: return 0
    return 1

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_package_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: package not set.')
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthString(len(self.package_))
    n += 1 * len(self.capability_)
    for i in xrange(len(self.capability_)): n += self.lengthString(len(self.capability_[i]))
    n += 1 * len(self.call_)
    for i in xrange(len(self.call_)): n += self.lengthString(len(self.call_[i]))
    return n + 1

  def Clear(self):
    self.clear_package()
    self.clear_capability()
    self.clear_call()

  def OutputUnchecked(self, out):
    out.putVarInt32(10)
    out.putPrefixedString(self.package_)
    for i in xrange(len(self.capability_)):
      out.putVarInt32(18)
      out.putPrefixedString(self.capability_[i])
    for i in xrange(len(self.call_)):
      out.putVarInt32(26)
      out.putPrefixedString(self.call_[i])

  def TryMerge(self, d):
    while d.avail() > 0:
      tt = d.getVarInt32()
      if tt == 10:
        self.set_package(d.getPrefixedString())
        continue
      if tt == 18:
        self.add_capability(d.getPrefixedString())
        continue
      if tt == 26:
        self.add_call(d.getPrefixedString())
        continue
      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
      d.skipData(tt)


  def __str__(self, prefix="", printElemNumber=0):
    res=""
    if self.has_package_: res+=prefix+("package: %s\n" % self.DebugFormatString(self.package_))
    cnt=0
    for e in self.capability_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("capability%s: %s\n" % (elm, self.DebugFormatString(e)))
      cnt+=1
    cnt=0
    for e in self.call_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("call%s: %s\n" % (elm, self.DebugFormatString(e)))
      cnt+=1
    return res


  def _BuildTagLookupTable(sparse, maxtag, default=None):
    return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])

  kpackage = 1
  kcapability = 2
  kcall = 3

  _TEXT = _BuildTagLookupTable({
    0: "ErrorCode",
    1: "package",
    2: "capability",
    3: "call",
  }, 3)

  _TYPES = _BuildTagLookupTable({
    0: ProtocolBuffer.Encoder.NUMERIC,
    1: ProtocolBuffer.Encoder.STRING,
    2: ProtocolBuffer.Encoder.STRING,
    3: ProtocolBuffer.Encoder.STRING,
  }, 3, ProtocolBuffer.Encoder.MAX_TYPE)

  _STYLE = """"""
  _STYLE_CONTENT_TYPE = """"""
class IsEnabledResponse(ProtocolBuffer.ProtocolMessage):

  ENABLED      =    1
  SCHEDULED_FUTURE =    2
  SCHEDULED_NOW =    3
  DISABLED     =    4
  UNKNOWN      =    5

  _SummaryStatus_NAMES = {
    1: "ENABLED",
    2: "SCHEDULED_FUTURE",
    3: "SCHEDULED_NOW",
    4: "DISABLED",
    5: "UNKNOWN",
  }

  def SummaryStatus_Name(cls, x): return cls._SummaryStatus_NAMES.get(x, "")
  SummaryStatus_Name = classmethod(SummaryStatus_Name)

  has_summary_status_ = 0
  summary_status_ = 0
  has_time_until_scheduled_ = 0
  time_until_scheduled_ = 0

  def __init__(self, contents=None):
    self.config_ = []
    if contents is not None: self.MergeFromString(contents)

  def summary_status(self): return self.summary_status_

  def set_summary_status(self, x):
    self.has_summary_status_ = 1
    self.summary_status_ = x

  def clear_summary_status(self):
    if self.has_summary_status_:
      self.has_summary_status_ = 0
      self.summary_status_ = 0

  def has_summary_status(self): return self.has_summary_status_

  def time_until_scheduled(self): return self.time_until_scheduled_

  def set_time_until_scheduled(self, x):
    self.has_time_until_scheduled_ = 1
    self.time_until_scheduled_ = x

  def clear_time_until_scheduled(self):
    if self.has_time_until_scheduled_:
      self.has_time_until_scheduled_ = 0
      self.time_until_scheduled_ = 0

  def has_time_until_scheduled(self): return self.has_time_until_scheduled_

  def config_size(self): return len(self.config_)
  def config_list(self): return self.config_

  def config(self, i):
    return self.config_[i]

  def mutable_config(self, i):
    return self.config_[i]

  def add_config(self):
    x = CapabilityConfig()
    self.config_.append(x)
    return x

  def clear_config(self):
    self.config_ = []

  def MergeFrom(self, x):
    assert x is not self
    if (x.has_summary_status()): self.set_summary_status(x.summary_status())
    if (x.has_time_until_scheduled()): self.set_time_until_scheduled(x.time_until_scheduled())
    for i in xrange(x.config_size()): self.add_config().CopyFrom(x.config(i))

  def Equals(self, x):
    if x is self: return 1
    if self.has_summary_status_ != x.has_summary_status_: return 0
    if self.has_summary_status_ and self.summary_status_ != x.summary_status_: return 0
    if self.has_time_until_scheduled_ != x.has_time_until_scheduled_: return 0
    if self.has_time_until_scheduled_ and self.time_until_scheduled_ != x.time_until_scheduled_: return 0
    if len(self.config_) != len(x.config_): return 0
    for e1, e2 in zip(self.config_, x.config_):
      if e1 != e2: return 0
    return 1

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_summary_status_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: summary_status not set.')
    for p in self.config_:
      if not p.IsInitialized(debug_strs): initialized=0
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthVarInt64(self.summary_status_)
    if (self.has_time_until_scheduled_): n += 1 + self.lengthVarInt64(self.time_until_scheduled_)
    n += 1 * len(self.config_)
    for i in xrange(len(self.config_)): n += self.lengthString(self.config_[i].ByteSize())
    return n + 1

  def Clear(self):
    self.clear_summary_status()
    self.clear_time_until_scheduled()
    self.clear_config()

  def OutputUnchecked(self, out):
    out.putVarInt32(8)
    out.putVarInt32(self.summary_status_)
    if (self.has_time_until_scheduled_):
      out.putVarInt32(16)
      out.putVarInt64(self.time_until_scheduled_)
    for i in xrange(len(self.config_)):
      out.putVarInt32(26)
      out.putVarInt32(self.config_[i].ByteSize())
      self.config_[i].OutputUnchecked(out)

  def TryMerge(self, d):
    while d.avail() > 0:
      tt = d.getVarInt32()
      if tt == 8:
        self.set_summary_status(d.getVarInt32())
        continue
      if tt == 16:
        self.set_time_until_scheduled(d.getVarInt64())
        continue
      if tt == 26:
        length = d.getVarInt32()
        tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
        d.skip(length)
        self.add_config().TryMerge(tmp)
        continue
      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
      d.skipData(tt)


  def __str__(self, prefix="", printElemNumber=0):
    res=""
    if self.has_summary_status_: res+=prefix+("summary_status: %s\n" % self.DebugFormatInt32(self.summary_status_))
    if self.has_time_until_scheduled_: res+=prefix+("time_until_scheduled: %s\n" % self.DebugFormatInt64(self.time_until_scheduled_))
    cnt=0
    for e in self.config_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("config%s <\n" % elm)
      res+=e.__str__(prefix + "  ", printElemNumber)
      res+=prefix+">\n"
      cnt+=1
    return res


  def _BuildTagLookupTable(sparse, maxtag, default=None):
    return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])

  ksummary_status = 1
  ktime_until_scheduled = 2
  kconfig = 3

  _TEXT = _BuildTagLookupTable({
    0: "ErrorCode",
    1: "summary_status",
    2: "time_until_scheduled",
    3: "config",
  }, 3)

  _TYPES = _BuildTagLookupTable({
    0: ProtocolBuffer.Encoder.NUMERIC,
    1: ProtocolBuffer.Encoder.NUMERIC,
    2: ProtocolBuffer.Encoder.NUMERIC,
    3: ProtocolBuffer.Encoder.STRING,
  }, 3, ProtocolBuffer.Encoder.MAX_TYPE)

  _STYLE = """"""
  _STYLE_CONTENT_TYPE = """"""

__all__ = ['IsEnabledRequest','IsEnabledResponse']