thirdparty/google_appengine/google/appengine/api/capabilities/capability_service_pb.py
changeset 828 f5fd65cc3bf3
child 1278 a7766286a7be
equal deleted inserted replaced
827:88c186556a80 828:f5fd65cc3bf3
       
     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 from google.appengine.base.capabilities_pb import CapabilityConfig
       
    26 class IsEnabledRequest(ProtocolBuffer.ProtocolMessage):
       
    27   has_package_ = 0
       
    28   package_ = ""
       
    29 
       
    30   def __init__(self, contents=None):
       
    31     self.capability_ = []
       
    32     self.call_ = []
       
    33     if contents is not None: self.MergeFromString(contents)
       
    34 
       
    35   def package(self): return self.package_
       
    36 
       
    37   def set_package(self, x):
       
    38     self.has_package_ = 1
       
    39     self.package_ = x
       
    40 
       
    41   def clear_package(self):
       
    42     self.has_package_ = 0
       
    43     self.package_ = ""
       
    44 
       
    45   def has_package(self): return self.has_package_
       
    46 
       
    47   def capability_size(self): return len(self.capability_)
       
    48   def capability_list(self): return self.capability_
       
    49 
       
    50   def capability(self, i):
       
    51     return self.capability_[i]
       
    52 
       
    53   def set_capability(self, i, x):
       
    54     self.capability_[i] = x
       
    55 
       
    56   def add_capability(self, x):
       
    57     self.capability_.append(x)
       
    58 
       
    59   def clear_capability(self):
       
    60     self.capability_ = []
       
    61 
       
    62   def call_size(self): return len(self.call_)
       
    63   def call_list(self): return self.call_
       
    64 
       
    65   def call(self, i):
       
    66     return self.call_[i]
       
    67 
       
    68   def set_call(self, i, x):
       
    69     self.call_[i] = x
       
    70 
       
    71   def add_call(self, x):
       
    72     self.call_.append(x)
       
    73 
       
    74   def clear_call(self):
       
    75     self.call_ = []
       
    76 
       
    77 
       
    78   def MergeFrom(self, x):
       
    79     assert x is not self
       
    80     if (x.has_package()): self.set_package(x.package())
       
    81     for i in xrange(x.capability_size()): self.add_capability(x.capability(i))
       
    82     for i in xrange(x.call_size()): self.add_call(x.call(i))
       
    83 
       
    84   def Equals(self, x):
       
    85     if x is self: return 1
       
    86     if self.has_package_ != x.has_package_: return 0
       
    87     if self.has_package_ and self.package_ != x.package_: return 0
       
    88     if len(self.capability_) != len(x.capability_): return 0
       
    89     for e1, e2 in zip(self.capability_, x.capability_):
       
    90       if e1 != e2: return 0
       
    91     if len(self.call_) != len(x.call_): return 0
       
    92     for e1, e2 in zip(self.call_, x.call_):
       
    93       if e1 != e2: return 0
       
    94     return 1
       
    95 
       
    96   def IsInitialized(self, debug_strs=None):
       
    97     initialized = 1
       
    98     if (not self.has_package_):
       
    99       initialized = 0
       
   100       if debug_strs is not None:
       
   101         debug_strs.append('Required field: package not set.')
       
   102     return initialized
       
   103 
       
   104   def ByteSize(self):
       
   105     n = 0
       
   106     n += self.lengthString(len(self.package_))
       
   107     n += 1 * len(self.capability_)
       
   108     for i in xrange(len(self.capability_)): n += self.lengthString(len(self.capability_[i]))
       
   109     n += 1 * len(self.call_)
       
   110     for i in xrange(len(self.call_)): n += self.lengthString(len(self.call_[i]))
       
   111     return n + 1
       
   112 
       
   113   def Clear(self):
       
   114     self.clear_package()
       
   115     self.clear_capability()
       
   116     self.clear_call()
       
   117 
       
   118   def OutputUnchecked(self, out):
       
   119     out.putVarInt32(10)
       
   120     out.putPrefixedString(self.package_)
       
   121     for i in xrange(len(self.capability_)):
       
   122       out.putVarInt32(18)
       
   123       out.putPrefixedString(self.capability_[i])
       
   124     for i in xrange(len(self.call_)):
       
   125       out.putVarInt32(26)
       
   126       out.putPrefixedString(self.call_[i])
       
   127 
       
   128   def TryMerge(self, d):
       
   129     while d.avail() > 0:
       
   130       tt = d.getVarInt32()
       
   131       if tt == 10:
       
   132         self.set_package(d.getPrefixedString())
       
   133         continue
       
   134       if tt == 18:
       
   135         self.add_capability(d.getPrefixedString())
       
   136         continue
       
   137       if tt == 26:
       
   138         self.add_call(d.getPrefixedString())
       
   139         continue
       
   140       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   141       d.skipData(tt)
       
   142 
       
   143 
       
   144   def __str__(self, prefix="", printElemNumber=0):
       
   145     res=""
       
   146     if self.has_package_: res+=prefix+("package: %s\n" % self.DebugFormatString(self.package_))
       
   147     cnt=0
       
   148     for e in self.capability_:
       
   149       elm=""
       
   150       if printElemNumber: elm="(%d)" % cnt
       
   151       res+=prefix+("capability%s: %s\n" % (elm, self.DebugFormatString(e)))
       
   152       cnt+=1
       
   153     cnt=0
       
   154     for e in self.call_:
       
   155       elm=""
       
   156       if printElemNumber: elm="(%d)" % cnt
       
   157       res+=prefix+("call%s: %s\n" % (elm, self.DebugFormatString(e)))
       
   158       cnt+=1
       
   159     return res
       
   160 
       
   161   kpackage = 1
       
   162   kcapability = 2
       
   163   kcall = 3
       
   164 
       
   165   _TEXT = (
       
   166    "ErrorCode",
       
   167    "package",
       
   168    "capability",
       
   169    "call",
       
   170   )
       
   171 
       
   172   _TYPES = (
       
   173    ProtocolBuffer.Encoder.NUMERIC,
       
   174    ProtocolBuffer.Encoder.STRING,
       
   175 
       
   176    ProtocolBuffer.Encoder.STRING,
       
   177 
       
   178    ProtocolBuffer.Encoder.STRING,
       
   179 
       
   180   )
       
   181 
       
   182   _STYLE = """"""
       
   183   _STYLE_CONTENT_TYPE = """"""
       
   184 class IsEnabledResponse(ProtocolBuffer.ProtocolMessage):
       
   185 
       
   186   ENABLED      =    1
       
   187   SCHEDULED_FUTURE =    2
       
   188   SCHEDULED_NOW =    3
       
   189   DISABLED     =    4
       
   190   UNKNOWN      =    5
       
   191 
       
   192   _SummaryStatus_NAMES = {
       
   193     1: "ENABLED",
       
   194     2: "SCHEDULED_FUTURE",
       
   195     3: "SCHEDULED_NOW",
       
   196     4: "DISABLED",
       
   197     5: "UNKNOWN",
       
   198   }
       
   199 
       
   200   def SummaryStatus_Name(cls, x): return cls._SummaryStatus_NAMES.get(x, "")
       
   201   SummaryStatus_Name = classmethod(SummaryStatus_Name)
       
   202 
       
   203   has_summary_status_ = 0
       
   204   summary_status_ = 0
       
   205   has_time_until_scheduled_ = 0
       
   206   time_until_scheduled_ = 0
       
   207 
       
   208   def __init__(self, contents=None):
       
   209     self.config_ = []
       
   210     if contents is not None: self.MergeFromString(contents)
       
   211 
       
   212   def summary_status(self): return self.summary_status_
       
   213 
       
   214   def set_summary_status(self, x):
       
   215     self.has_summary_status_ = 1
       
   216     self.summary_status_ = x
       
   217 
       
   218   def clear_summary_status(self):
       
   219     self.has_summary_status_ = 0
       
   220     self.summary_status_ = 0
       
   221 
       
   222   def has_summary_status(self): return self.has_summary_status_
       
   223 
       
   224   def time_until_scheduled(self): return self.time_until_scheduled_
       
   225 
       
   226   def set_time_until_scheduled(self, x):
       
   227     self.has_time_until_scheduled_ = 1
       
   228     self.time_until_scheduled_ = x
       
   229 
       
   230   def clear_time_until_scheduled(self):
       
   231     self.has_time_until_scheduled_ = 0
       
   232     self.time_until_scheduled_ = 0
       
   233 
       
   234   def has_time_until_scheduled(self): return self.has_time_until_scheduled_
       
   235 
       
   236   def config_size(self): return len(self.config_)
       
   237   def config_list(self): return self.config_
       
   238 
       
   239   def config(self, i):
       
   240     return self.config_[i]
       
   241 
       
   242   def mutable_config(self, i):
       
   243     return self.config_[i]
       
   244 
       
   245   def add_config(self):
       
   246     x = CapabilityConfig()
       
   247     self.config_.append(x)
       
   248     return x
       
   249 
       
   250   def clear_config(self):
       
   251     self.config_ = []
       
   252 
       
   253   def MergeFrom(self, x):
       
   254     assert x is not self
       
   255     if (x.has_summary_status()): self.set_summary_status(x.summary_status())
       
   256     if (x.has_time_until_scheduled()): self.set_time_until_scheduled(x.time_until_scheduled())
       
   257     for i in xrange(x.config_size()): self.add_config().CopyFrom(x.config(i))
       
   258 
       
   259   def Equals(self, x):
       
   260     if x is self: return 1
       
   261     if self.has_summary_status_ != x.has_summary_status_: return 0
       
   262     if self.has_summary_status_ and self.summary_status_ != x.summary_status_: return 0
       
   263     if self.has_time_until_scheduled_ != x.has_time_until_scheduled_: return 0
       
   264     if self.has_time_until_scheduled_ and self.time_until_scheduled_ != x.time_until_scheduled_: return 0
       
   265     if len(self.config_) != len(x.config_): return 0
       
   266     for e1, e2 in zip(self.config_, x.config_):
       
   267       if e1 != e2: return 0
       
   268     return 1
       
   269 
       
   270   def IsInitialized(self, debug_strs=None):
       
   271     initialized = 1
       
   272     if (not self.has_summary_status_):
       
   273       initialized = 0
       
   274       if debug_strs is not None:
       
   275         debug_strs.append('Required field: summary_status not set.')
       
   276     for p in self.config_:
       
   277       if not p.IsInitialized(debug_strs): initialized=0
       
   278     return initialized
       
   279 
       
   280   def ByteSize(self):
       
   281     n = 0
       
   282     n += self.lengthVarInt64(self.summary_status_)
       
   283     if (self.has_time_until_scheduled_): n += 1 + self.lengthVarInt64(self.time_until_scheduled_)
       
   284     n += 1 * len(self.config_)
       
   285     for i in xrange(len(self.config_)): n += self.lengthString(self.config_[i].ByteSize())
       
   286     return n + 1
       
   287 
       
   288   def Clear(self):
       
   289     self.clear_summary_status()
       
   290     self.clear_time_until_scheduled()
       
   291     self.clear_config()
       
   292 
       
   293   def OutputUnchecked(self, out):
       
   294     out.putVarInt32(8)
       
   295     out.putVarInt32(self.summary_status_)
       
   296     if (self.has_time_until_scheduled_):
       
   297       out.putVarInt32(16)
       
   298       out.putVarInt64(self.time_until_scheduled_)
       
   299     for i in xrange(len(self.config_)):
       
   300       out.putVarInt32(26)
       
   301       out.putVarInt32(self.config_[i].ByteSize())
       
   302       self.config_[i].OutputUnchecked(out)
       
   303 
       
   304   def TryMerge(self, d):
       
   305     while d.avail() > 0:
       
   306       tt = d.getVarInt32()
       
   307       if tt == 8:
       
   308         self.set_summary_status(d.getVarInt32())
       
   309         continue
       
   310       if tt == 16:
       
   311         self.set_time_until_scheduled(d.getVarInt64())
       
   312         continue
       
   313       if tt == 26:
       
   314         length = d.getVarInt32()
       
   315         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   316         d.skip(length)
       
   317         self.add_config().TryMerge(tmp)
       
   318         continue
       
   319       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   320       d.skipData(tt)
       
   321 
       
   322 
       
   323   def __str__(self, prefix="", printElemNumber=0):
       
   324     res=""
       
   325     if self.has_summary_status_: res+=prefix+("summary_status: %s\n" % self.DebugFormatInt32(self.summary_status_))
       
   326     if self.has_time_until_scheduled_: res+=prefix+("time_until_scheduled: %s\n" % self.DebugFormatInt64(self.time_until_scheduled_))
       
   327     cnt=0
       
   328     for e in self.config_:
       
   329       elm=""
       
   330       if printElemNumber: elm="(%d)" % cnt
       
   331       res+=prefix+("config%s <\n" % elm)
       
   332       res+=e.__str__(prefix + "  ", printElemNumber)
       
   333       res+=prefix+">\n"
       
   334       cnt+=1
       
   335     return res
       
   336 
       
   337   ksummary_status = 1
       
   338   ktime_until_scheduled = 2
       
   339   kconfig = 3
       
   340 
       
   341   _TEXT = (
       
   342    "ErrorCode",
       
   343    "summary_status",
       
   344    "time_until_scheduled",
       
   345    "config",
       
   346   )
       
   347 
       
   348   _TYPES = (
       
   349    ProtocolBuffer.Encoder.NUMERIC,
       
   350    ProtocolBuffer.Encoder.NUMERIC,
       
   351 
       
   352    ProtocolBuffer.Encoder.NUMERIC,
       
   353 
       
   354    ProtocolBuffer.Encoder.STRING,
       
   355 
       
   356   )
       
   357 
       
   358   _STYLE = """"""
       
   359   _STYLE_CONTENT_TYPE = """"""
       
   360 
       
   361 __all__ = ['IsEnabledRequest','IsEnabledResponse']