# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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.
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: net/proto/protocoltype.proto

from googlecloudsdk.third_party.appengine.proto import ProtocolBuffer
import array
import base64
import thread
try:
  from googlecloudsdk.third_party.appengine.proto import _net_proto___parse__python
except ImportError:
  _net_proto___parse__python = None

if hasattr(ProtocolBuffer, 'ExtendableProtocolMessage'):
  _extension_runtime = True
  _ExtendableProtocolMessage = ProtocolBuffer.ExtendableProtocolMessage
else:
  _extension_runtime = False
  _ExtendableProtocolMessage = ProtocolBuffer.ProtocolMessage

class ProtocolDescriptor_EnumTypeTag(ProtocolBuffer.ProtocolMessage):
  has_name_ = 0
  name_ = ""
  has_value_ = 0
  value_ = 0

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

  def name(self): return self.name_

  def set_name(self, x):
    self.has_name_ = 1
    self.name_ = x

  def clear_name(self):
    if self.has_name_:
      self.has_name_ = 0
      self.name_ = ""

  def has_name(self): return self.has_name_

  def value(self): return self.value_

  def set_value(self, x):
    self.has_value_ = 1
    self.value_ = x

  def clear_value(self):
    if self.has_value_:
      self.has_value_ = 0
      self.value_ = 0

  def has_value(self): return self.has_value_


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_name()): self.set_name(x.name())
    if (x.has_value()): self.set_value(x.value())

  def Equals(self, x):
    if x is self: return 1
    if self.has_name_ != x.has_name_: return 0
    if self.has_name_ and self.name_ != x.name_: return 0
    if self.has_value_ != x.has_value_: return 0
    if self.has_value_ and self.value_ != x.value_: return 0
    return 1

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_name_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: name not set.')
    if (not self.has_value_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: value not set.')
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthString(len(self.name_))
    n += self.lengthVarInt64(self.value_)
    return n + 4

  def ByteSizePartial(self):
    n = 0
    if (self.has_name_):
      n += 2
      n += self.lengthString(len(self.name_))
    if (self.has_value_):
      n += 2
      n += self.lengthVarInt64(self.value_)
    return n

  def Clear(self):
    self.clear_name()
    self.clear_value()

  def OutputUnchecked(self, out):
    out.putVarInt32(146)
    out.putPrefixedString(self.name_)
    out.putVarInt32(152)
    out.putVarInt32(self.value_)

  def OutputPartial(self, out):
    if (self.has_name_):
      out.putVarInt32(146)
      out.putPrefixedString(self.name_)
    if (self.has_value_):
      out.putVarInt32(152)
      out.putVarInt32(self.value_)

  def TryMerge(self, d):
    while 1:
      tt = d.getVarInt32()
      if tt == 140: break
      if tt == 146:
        self.set_name(d.getPrefixedString())
        continue
      if tt == 152:
        self.set_value(d.getVarInt32())
        continue
      # tag 0 is special: it's used to indicate an error.
      # so if we see it we raise an exception.
      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
      d.skipData(tt)


  def __str__(self, prefix="", printElemNumber=0):
    res=""
    if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_))
    if self.has_value_: res+=prefix+("value: %s\n" % self.DebugFormatInt32(self.value_))
    return res

class ProtocolDescriptor_TagOption(ProtocolBuffer.ProtocolMessage):
  has_name_ = 0
  name_ = ""
  has_value_ = 0
  value_ = ""

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

  def name(self): return self.name_

  def set_name(self, x):
    self.has_name_ = 1
    self.name_ = x

  def clear_name(self):
    if self.has_name_:
      self.has_name_ = 0
      self.name_ = ""

  def has_name(self): return self.has_name_

  def value(self): return self.value_

  def set_value(self, x):
    self.has_value_ = 1
    self.value_ = x

  def clear_value(self):
    if self.has_value_:
      self.has_value_ = 0
      self.value_ = ""

  def has_value(self): return self.has_value_


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_name()): self.set_name(x.name())
    if (x.has_value()): self.set_value(x.value())

  def Equals(self, x):
    if x is self: return 1
    if self.has_name_ != x.has_name_: return 0
    if self.has_name_ and self.name_ != x.name_: return 0
    if self.has_value_ != x.has_value_: return 0
    if self.has_value_ and self.value_ != x.value_: return 0
    return 1

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_name_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: name not set.')
    if (not self.has_value_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: value not set.')
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthString(len(self.name_))
    n += self.lengthString(len(self.value_))
    return n + 4

  def ByteSizePartial(self):
    n = 0
    if (self.has_name_):
      n += 2
      n += self.lengthString(len(self.name_))
    if (self.has_value_):
      n += 2
      n += self.lengthString(len(self.value_))
    return n

  def Clear(self):
    self.clear_name()
    self.clear_value()

  def OutputUnchecked(self, out):
    out.putVarInt32(170)
    out.putPrefixedString(self.name_)
    out.putVarInt32(178)
    out.putPrefixedString(self.value_)

  def OutputPartial(self, out):
    if (self.has_name_):
      out.putVarInt32(170)
      out.putPrefixedString(self.name_)
    if (self.has_value_):
      out.putVarInt32(178)
      out.putPrefixedString(self.value_)

  def TryMerge(self, d):
    while 1:
      tt = d.getVarInt32()
      if tt == 164: break
      if tt == 170:
        self.set_name(d.getPrefixedString())
        continue
      if tt == 178:
        self.set_value(d.getPrefixedString())
        continue
      # tag 0 is special: it's used to indicate an error.
      # so if we see it we raise an exception.
      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
      d.skipData(tt)


  def __str__(self, prefix="", printElemNumber=0):
    res=""
    if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_))
    if self.has_value_: res+=prefix+("value: %s\n" % self.DebugFormatString(self.value_))
    return res

class ProtocolDescriptor_Tag(ProtocolBuffer.ProtocolMessage):
  has_name_ = 0
  name_ = ""
  has_number_ = 0
  number_ = 0
  has_wire_type_ = 0
  wire_type_ = 0
  has_declared_type_ = 0
  declared_type_ = 0
  has_label_ = 0
  label_ = 0
  has_default_value_ = 0
  default_value_ = ""
  has_foreign_ = 0
  foreign_ = ""
  has_foreign_proto_name_ = 0
  foreign_proto_name_ = ""
  has_flags_ = 0
  flags_ = 0
  has_parent_ = 0
  parent_ = -1
  has_enum_id_ = 0
  enum_id_ = -1
  has_deprecated_ = 0
  deprecated_ = 0

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

  def name(self): return self.name_

  def set_name(self, x):
    self.has_name_ = 1
    self.name_ = x

  def clear_name(self):
    if self.has_name_:
      self.has_name_ = 0
      self.name_ = ""

  def has_name(self): return self.has_name_

  def number(self): return self.number_

  def set_number(self, x):
    self.has_number_ = 1
    self.number_ = x

  def clear_number(self):
    if self.has_number_:
      self.has_number_ = 0
      self.number_ = 0

  def has_number(self): return self.has_number_

  def wire_type(self): return self.wire_type_

  def set_wire_type(self, x):
    self.has_wire_type_ = 1
    self.wire_type_ = x

  def clear_wire_type(self):
    if self.has_wire_type_:
      self.has_wire_type_ = 0
      self.wire_type_ = 0

  def has_wire_type(self): return self.has_wire_type_

  def declared_type(self): return self.declared_type_

  def set_declared_type(self, x):
    self.has_declared_type_ = 1
    self.declared_type_ = x

  def clear_declared_type(self):
    if self.has_declared_type_:
      self.has_declared_type_ = 0
      self.declared_type_ = 0

  def has_declared_type(self): return self.has_declared_type_

  def label(self): return self.label_

  def set_label(self, x):
    self.has_label_ = 1
    self.label_ = x

  def clear_label(self):
    if self.has_label_:
      self.has_label_ = 0
      self.label_ = 0

  def has_label(self): return self.has_label_

  def default_value(self): return self.default_value_

  def set_default_value(self, x):
    self.has_default_value_ = 1
    self.default_value_ = x

  def clear_default_value(self):
    if self.has_default_value_:
      self.has_default_value_ = 0
      self.default_value_ = ""

  def has_default_value(self): return self.has_default_value_

  def foreign(self): return self.foreign_

  def set_foreign(self, x):
    self.has_foreign_ = 1
    self.foreign_ = x

  def clear_foreign(self):
    if self.has_foreign_:
      self.has_foreign_ = 0
      self.foreign_ = ""

  def has_foreign(self): return self.has_foreign_

  def foreign_proto_name(self): return self.foreign_proto_name_

  def set_foreign_proto_name(self, x):
    self.has_foreign_proto_name_ = 1
    self.foreign_proto_name_ = x

  def clear_foreign_proto_name(self):
    if self.has_foreign_proto_name_:
      self.has_foreign_proto_name_ = 0
      self.foreign_proto_name_ = ""

  def has_foreign_proto_name(self): return self.has_foreign_proto_name_

  def flags(self): return self.flags_

  def set_flags(self, x):
    self.has_flags_ = 1
    self.flags_ = x

  def clear_flags(self):
    if self.has_flags_:
      self.has_flags_ = 0
      self.flags_ = 0

  def has_flags(self): return self.has_flags_

  def parent(self): return self.parent_

  def set_parent(self, x):
    self.has_parent_ = 1
    self.parent_ = x

  def clear_parent(self):
    if self.has_parent_:
      self.has_parent_ = 0
      self.parent_ = -1

  def has_parent(self): return self.has_parent_

  def enum_id(self): return self.enum_id_

  def set_enum_id(self, x):
    self.has_enum_id_ = 1
    self.enum_id_ = x

  def clear_enum_id(self):
    if self.has_enum_id_:
      self.has_enum_id_ = 0
      self.enum_id_ = -1

  def has_enum_id(self): return self.has_enum_id_

  def deprecated(self): return self.deprecated_

  def set_deprecated(self, x):
    self.has_deprecated_ = 1
    self.deprecated_ = x

  def clear_deprecated(self):
    if self.has_deprecated_:
      self.has_deprecated_ = 0
      self.deprecated_ = 0

  def has_deprecated(self): return self.has_deprecated_

  def option_size(self): return len(self.option_)
  def option_list(self): return self.option_

  def option(self, i):
    return self.option_[i]

  def mutable_option(self, i):
    return self.option_[i]

  def add_option(self):
    x = ProtocolDescriptor_TagOption()
    self.option_.append(x)
    return x

  def clear_option(self):
    self.option_ = []

  def MergeFrom(self, x):
    assert x is not self
    if (x.has_name()): self.set_name(x.name())
    if (x.has_number()): self.set_number(x.number())
    if (x.has_wire_type()): self.set_wire_type(x.wire_type())
    if (x.has_declared_type()): self.set_declared_type(x.declared_type())
    if (x.has_label()): self.set_label(x.label())
    if (x.has_default_value()): self.set_default_value(x.default_value())
    if (x.has_foreign()): self.set_foreign(x.foreign())
    if (x.has_foreign_proto_name()): self.set_foreign_proto_name(x.foreign_proto_name())
    if (x.has_flags()): self.set_flags(x.flags())
    if (x.has_parent()): self.set_parent(x.parent())
    if (x.has_enum_id()): self.set_enum_id(x.enum_id())
    if (x.has_deprecated()): self.set_deprecated(x.deprecated())
    for i in xrange(x.option_size()): self.add_option().CopyFrom(x.option(i))

  def Equals(self, x):
    if x is self: return 1
    if self.has_name_ != x.has_name_: return 0
    if self.has_name_ and self.name_ != x.name_: return 0
    if self.has_number_ != x.has_number_: return 0
    if self.has_number_ and self.number_ != x.number_: return 0
    if self.has_wire_type_ != x.has_wire_type_: return 0
    if self.has_wire_type_ and self.wire_type_ != x.wire_type_: return 0
    if self.has_declared_type_ != x.has_declared_type_: return 0
    if self.has_declared_type_ and self.declared_type_ != x.declared_type_: return 0
    if self.has_label_ != x.has_label_: return 0
    if self.has_label_ and self.label_ != x.label_: return 0
    if self.has_default_value_ != x.has_default_value_: return 0
    if self.has_default_value_ and self.default_value_ != x.default_value_: return 0
    if self.has_foreign_ != x.has_foreign_: return 0
    if self.has_foreign_ and self.foreign_ != x.foreign_: return 0
    if self.has_foreign_proto_name_ != x.has_foreign_proto_name_: return 0
    if self.has_foreign_proto_name_ and self.foreign_proto_name_ != x.foreign_proto_name_: return 0
    if self.has_flags_ != x.has_flags_: return 0
    if self.has_flags_ and self.flags_ != x.flags_: return 0
    if self.has_parent_ != x.has_parent_: return 0
    if self.has_parent_ and self.parent_ != x.parent_: return 0
    if self.has_enum_id_ != x.has_enum_id_: return 0
    if self.has_enum_id_ and self.enum_id_ != x.enum_id_: return 0
    if self.has_deprecated_ != x.has_deprecated_: return 0
    if self.has_deprecated_ and self.deprecated_ != x.deprecated_: return 0
    if len(self.option_) != len(x.option_): return 0
    for e1, e2 in zip(self.option_, x.option_):
      if e1 != e2: return 0
    return 1

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_name_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: name not set.')
    if (not self.has_number_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: number not set.')
    if (not self.has_wire_type_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: wire_type not set.')
    if (not self.has_declared_type_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: declared_type not set.')
    if (not self.has_label_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: label not set.')
    for p in self.option_:
      if not p.IsInitialized(debug_strs): initialized=0
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthString(len(self.name_))
    n += self.lengthVarInt64(self.number_)
    n += self.lengthVarInt64(self.wire_type_)
    n += self.lengthVarInt64(self.declared_type_)
    n += self.lengthVarInt64(self.label_)
    if (self.has_default_value_): n += 1 + self.lengthString(len(self.default_value_))
    if (self.has_foreign_): n += 1 + self.lengthString(len(self.foreign_))
    if (self.has_foreign_proto_name_): n += 2 + self.lengthString(len(self.foreign_proto_name_))
    if (self.has_flags_): n += 1 + self.lengthVarInt64(self.flags_)
    if (self.has_parent_): n += 1 + self.lengthVarInt64(self.parent_)
    if (self.has_enum_id_): n += 1 + self.lengthVarInt64(self.enum_id_)
    if (self.has_deprecated_): n += 3
    n += 4 * len(self.option_)
    for i in xrange(len(self.option_)): n += self.option_[i].ByteSize()
    return n + 5

  def ByteSizePartial(self):
    n = 0
    if (self.has_name_):
      n += 1
      n += self.lengthString(len(self.name_))
    if (self.has_number_):
      n += 1
      n += self.lengthVarInt64(self.number_)
    if (self.has_wire_type_):
      n += 1
      n += self.lengthVarInt64(self.wire_type_)
    if (self.has_declared_type_):
      n += 1
      n += self.lengthVarInt64(self.declared_type_)
    if (self.has_label_):
      n += 1
      n += self.lengthVarInt64(self.label_)
    if (self.has_default_value_): n += 1 + self.lengthString(len(self.default_value_))
    if (self.has_foreign_): n += 1 + self.lengthString(len(self.foreign_))
    if (self.has_foreign_proto_name_): n += 2 + self.lengthString(len(self.foreign_proto_name_))
    if (self.has_flags_): n += 1 + self.lengthVarInt64(self.flags_)
    if (self.has_parent_): n += 1 + self.lengthVarInt64(self.parent_)
    if (self.has_enum_id_): n += 1 + self.lengthVarInt64(self.enum_id_)
    if (self.has_deprecated_): n += 3
    n += 4 * len(self.option_)
    for i in xrange(len(self.option_)): n += self.option_[i].ByteSizePartial()
    return n

  def Clear(self):
    self.clear_name()
    self.clear_number()
    self.clear_wire_type()
    self.clear_declared_type()
    self.clear_label()
    self.clear_default_value()
    self.clear_foreign()
    self.clear_foreign_proto_name()
    self.clear_flags()
    self.clear_parent()
    self.clear_enum_id()
    self.clear_deprecated()
    self.clear_option()

  def OutputUnchecked(self, out):
    out.putVarInt32(26)
    out.putPrefixedString(self.name_)
    out.putVarInt32(32)
    out.putVarInt32(self.number_)
    out.putVarInt32(40)
    out.putVarInt32(self.wire_type_)
    out.putVarInt32(48)
    out.putVarInt32(self.declared_type_)
    out.putVarInt32(56)
    out.putVarInt32(self.label_)
    if (self.has_default_value_):
      out.putVarInt32(66)
      out.putPrefixedString(self.default_value_)
    if (self.has_foreign_):
      out.putVarInt32(74)
      out.putPrefixedString(self.foreign_)
    if (self.has_flags_):
      out.putVarInt32(80)
      out.putVarInt32(self.flags_)
    if (self.has_parent_):
      out.putVarInt32(96)
      out.putVarInt32(self.parent_)
    if (self.has_enum_id_):
      out.putVarInt32(104)
      out.putVarInt32(self.enum_id_)
    for i in xrange(len(self.option_)):
      out.putVarInt32(163)
      self.option_[i].OutputUnchecked(out)
      out.putVarInt32(164)
    if (self.has_deprecated_):
      out.putVarInt32(208)
      out.putBoolean(self.deprecated_)
    if (self.has_foreign_proto_name_):
      out.putVarInt32(226)
      out.putPrefixedString(self.foreign_proto_name_)

  def OutputPartial(self, out):
    if (self.has_name_):
      out.putVarInt32(26)
      out.putPrefixedString(self.name_)
    if (self.has_number_):
      out.putVarInt32(32)
      out.putVarInt32(self.number_)
    if (self.has_wire_type_):
      out.putVarInt32(40)
      out.putVarInt32(self.wire_type_)
    if (self.has_declared_type_):
      out.putVarInt32(48)
      out.putVarInt32(self.declared_type_)
    if (self.has_label_):
      out.putVarInt32(56)
      out.putVarInt32(self.label_)
    if (self.has_default_value_):
      out.putVarInt32(66)
      out.putPrefixedString(self.default_value_)
    if (self.has_foreign_):
      out.putVarInt32(74)
      out.putPrefixedString(self.foreign_)
    if (self.has_flags_):
      out.putVarInt32(80)
      out.putVarInt32(self.flags_)
    if (self.has_parent_):
      out.putVarInt32(96)
      out.putVarInt32(self.parent_)
    if (self.has_enum_id_):
      out.putVarInt32(104)
      out.putVarInt32(self.enum_id_)
    for i in xrange(len(self.option_)):
      out.putVarInt32(163)
      self.option_[i].OutputPartial(out)
      out.putVarInt32(164)
    if (self.has_deprecated_):
      out.putVarInt32(208)
      out.putBoolean(self.deprecated_)
    if (self.has_foreign_proto_name_):
      out.putVarInt32(226)
      out.putPrefixedString(self.foreign_proto_name_)

  def TryMerge(self, d):
    while 1:
      tt = d.getVarInt32()
      if tt == 20: break
      if tt == 26:
        self.set_name(d.getPrefixedString())
        continue
      if tt == 32:
        self.set_number(d.getVarInt32())
        continue
      if tt == 40:
        self.set_wire_type(d.getVarInt32())
        continue
      if tt == 48:
        self.set_declared_type(d.getVarInt32())
        continue
      if tt == 56:
        self.set_label(d.getVarInt32())
        continue
      if tt == 66:
        self.set_default_value(d.getPrefixedString())
        continue
      if tt == 74:
        self.set_foreign(d.getPrefixedString())
        continue
      if tt == 80:
        self.set_flags(d.getVarInt32())
        continue
      if tt == 96:
        self.set_parent(d.getVarInt32())
        continue
      if tt == 104:
        self.set_enum_id(d.getVarInt32())
        continue
      if tt == 163:
        self.add_option().TryMerge(d)
        continue
      if tt == 208:
        self.set_deprecated(d.getBoolean())
        continue
      if tt == 226:
        self.set_foreign_proto_name(d.getPrefixedString())
        continue
      # tag 0 is special: it's used to indicate an error.
      # so if we see it we raise an exception.
      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
      d.skipData(tt)


  def __str__(self, prefix="", printElemNumber=0):
    res=""
    if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_))
    if self.has_number_: res+=prefix+("number: %s\n" % self.DebugFormatInt32(self.number_))
    if self.has_wire_type_: res+=prefix+("wire_type: %s\n" % self.DebugFormatInt32(self.wire_type_))
    if self.has_declared_type_: res+=prefix+("declared_type: %s\n" % self.DebugFormatInt32(self.declared_type_))
    if self.has_label_: res+=prefix+("label: %s\n" % self.DebugFormatInt32(self.label_))
    if self.has_default_value_: res+=prefix+("default_value: %s\n" % self.DebugFormatString(self.default_value_))
    if self.has_foreign_: res+=prefix+("foreign: %s\n" % self.DebugFormatString(self.foreign_))
    if self.has_foreign_proto_name_: res+=prefix+("foreign_proto_name: %s\n" % self.DebugFormatString(self.foreign_proto_name_))
    if self.has_flags_: res+=prefix+("flags: %s\n" % self.DebugFormatInt32(self.flags_))
    if self.has_parent_: res+=prefix+("parent: %s\n" % self.DebugFormatInt32(self.parent_))
    if self.has_enum_id_: res+=prefix+("enum_id: %s\n" % self.DebugFormatInt32(self.enum_id_))
    if self.has_deprecated_: res+=prefix+("deprecated: %s\n" % self.DebugFormatBool(self.deprecated_))
    cnt=0
    for e in self.option_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("Option%s {\n" % elm)
      res+=e.__str__(prefix + "  ", printElemNumber)
      res+=prefix+"}\n"
      cnt+=1
    return res

class ProtocolDescriptor_EnumType(ProtocolBuffer.ProtocolMessage):
  has_name_ = 0
  name_ = ""
  has_parent_ = 0
  parent_ = 0
  has_proto2_name_ = 0
  proto2_name_ = ""
  has_allow_alias_ = 0
  allow_alias_ = 0

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

  def name(self): return self.name_

  def set_name(self, x):
    self.has_name_ = 1
    self.name_ = x

  def clear_name(self):
    if self.has_name_:
      self.has_name_ = 0
      self.name_ = ""

  def has_name(self): return self.has_name_

  def parent(self): return self.parent_

  def set_parent(self, x):
    self.has_parent_ = 1
    self.parent_ = x

  def clear_parent(self):
    if self.has_parent_:
      self.has_parent_ = 0
      self.parent_ = 0

  def has_parent(self): return self.has_parent_

  def tag_size(self): return len(self.tag_)
  def tag_list(self): return self.tag_

  def tag(self, i):
    return self.tag_[i]

  def mutable_tag(self, i):
    return self.tag_[i]

  def add_tag(self):
    x = ProtocolDescriptor_EnumTypeTag()
    self.tag_.append(x)
    return x

  def clear_tag(self):
    self.tag_ = []
  def proto2_name(self): return self.proto2_name_

  def set_proto2_name(self, x):
    self.has_proto2_name_ = 1
    self.proto2_name_ = x

  def clear_proto2_name(self):
    if self.has_proto2_name_:
      self.has_proto2_name_ = 0
      self.proto2_name_ = ""

  def has_proto2_name(self): return self.has_proto2_name_

  def allow_alias(self): return self.allow_alias_

  def set_allow_alias(self, x):
    self.has_allow_alias_ = 1
    self.allow_alias_ = x

  def clear_allow_alias(self):
    if self.has_allow_alias_:
      self.has_allow_alias_ = 0
      self.allow_alias_ = 0

  def has_allow_alias(self): return self.has_allow_alias_


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_name()): self.set_name(x.name())
    if (x.has_parent()): self.set_parent(x.parent())
    for i in xrange(x.tag_size()): self.add_tag().CopyFrom(x.tag(i))
    if (x.has_proto2_name()): self.set_proto2_name(x.proto2_name())
    if (x.has_allow_alias()): self.set_allow_alias(x.allow_alias())

  def Equals(self, x):
    if x is self: return 1
    if self.has_name_ != x.has_name_: return 0
    if self.has_name_ and self.name_ != x.name_: return 0
    if self.has_parent_ != x.has_parent_: return 0
    if self.has_parent_ and self.parent_ != x.parent_: return 0
    if len(self.tag_) != len(x.tag_): return 0
    for e1, e2 in zip(self.tag_, x.tag_):
      if e1 != e2: return 0
    if self.has_proto2_name_ != x.has_proto2_name_: return 0
    if self.has_proto2_name_ and self.proto2_name_ != x.proto2_name_: return 0
    if self.has_allow_alias_ != x.has_allow_alias_: return 0
    if self.has_allow_alias_ and self.allow_alias_ != x.allow_alias_: return 0
    return 1

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

  def ByteSize(self):
    n = 0
    n += self.lengthString(len(self.name_))
    if (self.has_parent_): n += 2 + self.lengthVarInt64(self.parent_)
    n += 4 * len(self.tag_)
    for i in xrange(len(self.tag_)): n += self.tag_[i].ByteSize()
    if (self.has_proto2_name_): n += 2 + self.lengthString(len(self.proto2_name_))
    if (self.has_allow_alias_): n += 3
    return n + 1

  def ByteSizePartial(self):
    n = 0
    if (self.has_name_):
      n += 1
      n += self.lengthString(len(self.name_))
    if (self.has_parent_): n += 2 + self.lengthVarInt64(self.parent_)
    n += 4 * len(self.tag_)
    for i in xrange(len(self.tag_)): n += self.tag_[i].ByteSizePartial()
    if (self.has_proto2_name_): n += 2 + self.lengthString(len(self.proto2_name_))
    if (self.has_allow_alias_): n += 3
    return n

  def Clear(self):
    self.clear_name()
    self.clear_parent()
    self.clear_tag()
    self.clear_proto2_name()
    self.clear_allow_alias()

  def OutputUnchecked(self, out):
    out.putVarInt32(122)
    out.putPrefixedString(self.name_)
    if (self.has_parent_):
      out.putVarInt32(128)
      out.putVarInt32(self.parent_)
    for i in xrange(len(self.tag_)):
      out.putVarInt32(139)
      self.tag_[i].OutputUnchecked(out)
      out.putVarInt32(140)
    if (self.has_proto2_name_):
      out.putVarInt32(250)
      out.putPrefixedString(self.proto2_name_)
    if (self.has_allow_alias_):
      out.putVarInt32(264)
      out.putBoolean(self.allow_alias_)

  def OutputPartial(self, out):
    if (self.has_name_):
      out.putVarInt32(122)
      out.putPrefixedString(self.name_)
    if (self.has_parent_):
      out.putVarInt32(128)
      out.putVarInt32(self.parent_)
    for i in xrange(len(self.tag_)):
      out.putVarInt32(139)
      self.tag_[i].OutputPartial(out)
      out.putVarInt32(140)
    if (self.has_proto2_name_):
      out.putVarInt32(250)
      out.putPrefixedString(self.proto2_name_)
    if (self.has_allow_alias_):
      out.putVarInt32(264)
      out.putBoolean(self.allow_alias_)

  def TryMerge(self, d):
    while 1:
      tt = d.getVarInt32()
      if tt == 116: break
      if tt == 122:
        self.set_name(d.getPrefixedString())
        continue
      if tt == 128:
        self.set_parent(d.getVarInt32())
        continue
      if tt == 139:
        self.add_tag().TryMerge(d)
        continue
      if tt == 250:
        self.set_proto2_name(d.getPrefixedString())
        continue
      if tt == 264:
        self.set_allow_alias(d.getBoolean())
        continue
      # tag 0 is special: it's used to indicate an error.
      # so if we see it we raise an exception.
      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
      d.skipData(tt)


  def __str__(self, prefix="", printElemNumber=0):
    res=""
    if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_))
    if self.has_parent_: res+=prefix+("parent: %s\n" % self.DebugFormatInt32(self.parent_))
    cnt=0
    for e in self.tag_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("Tag%s {\n" % elm)
      res+=e.__str__(prefix + "  ", printElemNumber)
      res+=prefix+"}\n"
      cnt+=1
    if self.has_proto2_name_: res+=prefix+("proto2_name: %s\n" % self.DebugFormatString(self.proto2_name_))
    if self.has_allow_alias_: res+=prefix+("allow_alias: %s\n" % self.DebugFormatBool(self.allow_alias_))
    return res

class ProtocolDescriptor(ProtocolBuffer.ProtocolMessage):

  # WireType values
  WIRETYPE_NUMERIC =    0 
  WIRETYPE_DOUBLE =    1 
  WIRETYPE_STRING =    2 
  WIRETYPE_STARTGROUP =    3 
  WIRETYPE_ENDGROUP =    4 
  WIRETYPE_FLOAT =    5 

  _WireType_NAMES = {
    0: "WIRETYPE_NUMERIC",
    1: "WIRETYPE_DOUBLE",
    2: "WIRETYPE_STRING",
    3: "WIRETYPE_STARTGROUP",
    4: "WIRETYPE_ENDGROUP",
    5: "WIRETYPE_FLOAT",
  }

  def WireType_Name(cls, x): return cls._WireType_NAMES.get(x, "")
  WireType_Name = classmethod(WireType_Name)


  # Label values
  LABEL_OPTIONAL =    1 
  LABEL_REQUIRED =    2 
  LABEL_REPEATED =    3 

  _Label_NAMES = {
    1: "LABEL_OPTIONAL",
    2: "LABEL_REQUIRED",
    3: "LABEL_REPEATED",
  }

  def Label_Name(cls, x): return cls._Label_NAMES.get(x, "")
  Label_Name = classmethod(Label_Name)


  # DeclaredType values
  TYPE_DOUBLE  =    1 
  TYPE_FLOAT   =    2 
  TYPE_INT64   =    3 
  TYPE_UINT64  =    4 
  TYPE_INT32   =    5 
  TYPE_FIXED64 =    6 
  TYPE_FIXED32 =    7 
  TYPE_BOOL    =    8 
  TYPE_STRING  =    9 
  TYPE_GROUP   =   10 
  TYPE_FOREIGN =   11 

  _DeclaredType_NAMES = {
    1: "TYPE_DOUBLE",
    2: "TYPE_FLOAT",
    3: "TYPE_INT64",
    4: "TYPE_UINT64",
    5: "TYPE_INT32",
    6: "TYPE_FIXED64",
    7: "TYPE_FIXED32",
    8: "TYPE_BOOL",
    9: "TYPE_STRING",
    10: "TYPE_GROUP",
    11: "TYPE_FOREIGN",
  }

  def DeclaredType_Name(cls, x): return cls._DeclaredType_NAMES.get(x, "")
  DeclaredType_Name = classmethod(DeclaredType_Name)

  has_filename_ = 0
  filename_ = ""
  has_name_ = 0
  name_ = ""
  has_proto_name_ = 0
  proto_name_ = ""
  has_proto2_file_descriptor_ = 0
  proto2_file_descriptor_ = ""
  has_proto2_file_master_ = 0
  proto2_file_master_ = ""
  has_proto2_name_ = 0
  proto2_name_ = ""
  has_proto2_extension_info_ = 0
  proto2_extension_info_ = ""
  has_proto2_file_scope_info_ = 0
  proto2_file_scope_info_ = ""

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

  def filename(self): return self.filename_

  def set_filename(self, x):
    self.has_filename_ = 1
    self.filename_ = x

  def clear_filename(self):
    if self.has_filename_:
      self.has_filename_ = 0
      self.filename_ = ""

  def has_filename(self): return self.has_filename_

  def name(self): return self.name_

  def set_name(self, x):
    self.has_name_ = 1
    self.name_ = x

  def clear_name(self):
    if self.has_name_:
      self.has_name_ = 0
      self.name_ = ""

  def has_name(self): return self.has_name_

  def proto_name(self): return self.proto_name_

  def set_proto_name(self, x):
    self.has_proto_name_ = 1
    self.proto_name_ = x

  def clear_proto_name(self):
    if self.has_proto_name_:
      self.has_proto_name_ = 0
      self.proto_name_ = ""

  def has_proto_name(self): return self.has_proto_name_

  def tag_size(self): return len(self.tag_)
  def tag_list(self): return self.tag_

  def tag(self, i):
    return self.tag_[i]

  def mutable_tag(self, i):
    return self.tag_[i]

  def add_tag(self):
    x = ProtocolDescriptor_Tag()
    self.tag_.append(x)
    return x

  def clear_tag(self):
    self.tag_ = []
  def enumtype_size(self): return len(self.enumtype_)
  def enumtype_list(self): return self.enumtype_

  def enumtype(self, i):
    return self.enumtype_[i]

  def mutable_enumtype(self, i):
    return self.enumtype_[i]

  def add_enumtype(self):
    x = ProtocolDescriptor_EnumType()
    self.enumtype_.append(x)
    return x

  def clear_enumtype(self):
    self.enumtype_ = []
  def proto2_file_descriptor(self): return self.proto2_file_descriptor_

  def set_proto2_file_descriptor(self, x):
    self.has_proto2_file_descriptor_ = 1
    self.proto2_file_descriptor_ = x

  def clear_proto2_file_descriptor(self):
    if self.has_proto2_file_descriptor_:
      self.has_proto2_file_descriptor_ = 0
      self.proto2_file_descriptor_ = ""

  def has_proto2_file_descriptor(self): return self.has_proto2_file_descriptor_

  def proto2_file_master(self): return self.proto2_file_master_

  def set_proto2_file_master(self, x):
    self.has_proto2_file_master_ = 1
    self.proto2_file_master_ = x

  def clear_proto2_file_master(self):
    if self.has_proto2_file_master_:
      self.has_proto2_file_master_ = 0
      self.proto2_file_master_ = ""

  def has_proto2_file_master(self): return self.has_proto2_file_master_

  def proto2_name(self): return self.proto2_name_

  def set_proto2_name(self, x):
    self.has_proto2_name_ = 1
    self.proto2_name_ = x

  def clear_proto2_name(self):
    if self.has_proto2_name_:
      self.has_proto2_name_ = 0
      self.proto2_name_ = ""

  def has_proto2_name(self): return self.has_proto2_name_

  def proto2_extension_info(self): return self.proto2_extension_info_

  def set_proto2_extension_info(self, x):
    self.has_proto2_extension_info_ = 1
    self.proto2_extension_info_ = x

  def clear_proto2_extension_info(self):
    if self.has_proto2_extension_info_:
      self.has_proto2_extension_info_ = 0
      self.proto2_extension_info_ = ""

  def has_proto2_extension_info(self): return self.has_proto2_extension_info_

  def proto2_file_scope_info(self): return self.proto2_file_scope_info_

  def set_proto2_file_scope_info(self, x):
    self.has_proto2_file_scope_info_ = 1
    self.proto2_file_scope_info_ = x

  def clear_proto2_file_scope_info(self):
    if self.has_proto2_file_scope_info_:
      self.has_proto2_file_scope_info_ = 0
      self.proto2_file_scope_info_ = ""

  def has_proto2_file_scope_info(self): return self.has_proto2_file_scope_info_


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_filename()): self.set_filename(x.filename())
    if (x.has_name()): self.set_name(x.name())
    if (x.has_proto_name()): self.set_proto_name(x.proto_name())
    for i in xrange(x.tag_size()): self.add_tag().CopyFrom(x.tag(i))
    for i in xrange(x.enumtype_size()): self.add_enumtype().CopyFrom(x.enumtype(i))
    if (x.has_proto2_file_descriptor()): self.set_proto2_file_descriptor(x.proto2_file_descriptor())
    if (x.has_proto2_file_master()): self.set_proto2_file_master(x.proto2_file_master())
    if (x.has_proto2_name()): self.set_proto2_name(x.proto2_name())
    if (x.has_proto2_extension_info()): self.set_proto2_extension_info(x.proto2_extension_info())
    if (x.has_proto2_file_scope_info()): self.set_proto2_file_scope_info(x.proto2_file_scope_info())

  if _net_proto___parse__python is not None:
    def _CMergeFromString(self, s):
      _net_proto___parse__python.MergeFromString(self, 'ProtocolDescriptor', s)

  if _net_proto___parse__python is not None:
    def _CEncode(self):
      return _net_proto___parse__python.Encode(self, 'ProtocolDescriptor')

  if _net_proto___parse__python is not None:
    def _CEncodePartial(self):
      return _net_proto___parse__python.EncodePartial(self, 'ProtocolDescriptor')

  if _net_proto___parse__python is not None:
    def _CToASCII(self, output_format):
      return _net_proto___parse__python.ToASCII(self, 'ProtocolDescriptor', output_format)


  if _net_proto___parse__python is not None:
    def ParseASCII(self, s):
      _net_proto___parse__python.ParseASCII(self, 'ProtocolDescriptor', s)


  if _net_proto___parse__python is not None:
    def ParseASCIIIgnoreUnknown(self, s):
      _net_proto___parse__python.ParseASCIIIgnoreUnknown(self, 'ProtocolDescriptor', s)


  def Equals(self, x):
    if x is self: return 1
    if self.has_filename_ != x.has_filename_: return 0
    if self.has_filename_ and self.filename_ != x.filename_: return 0
    if self.has_name_ != x.has_name_: return 0
    if self.has_name_ and self.name_ != x.name_: return 0
    if self.has_proto_name_ != x.has_proto_name_: return 0
    if self.has_proto_name_ and self.proto_name_ != x.proto_name_: return 0
    if len(self.tag_) != len(x.tag_): return 0
    for e1, e2 in zip(self.tag_, x.tag_):
      if e1 != e2: return 0
    if len(self.enumtype_) != len(x.enumtype_): return 0
    for e1, e2 in zip(self.enumtype_, x.enumtype_):
      if e1 != e2: return 0
    if self.has_proto2_file_descriptor_ != x.has_proto2_file_descriptor_: return 0
    if self.has_proto2_file_descriptor_ and self.proto2_file_descriptor_ != x.proto2_file_descriptor_: return 0
    if self.has_proto2_file_master_ != x.has_proto2_file_master_: return 0
    if self.has_proto2_file_master_ and self.proto2_file_master_ != x.proto2_file_master_: return 0
    if self.has_proto2_name_ != x.has_proto2_name_: return 0
    if self.has_proto2_name_ and self.proto2_name_ != x.proto2_name_: return 0
    if self.has_proto2_extension_info_ != x.has_proto2_extension_info_: return 0
    if self.has_proto2_extension_info_ and self.proto2_extension_info_ != x.proto2_extension_info_: return 0
    if self.has_proto2_file_scope_info_ != x.has_proto2_file_scope_info_: return 0
    if self.has_proto2_file_scope_info_ and self.proto2_file_scope_info_ != x.proto2_file_scope_info_: return 0
    return 1

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_filename_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: filename not set.')
    if (not self.has_name_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: name not set.')
    for p in self.tag_:
      if not p.IsInitialized(debug_strs): initialized=0
    for p in self.enumtype_:
      if not p.IsInitialized(debug_strs): initialized=0
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthString(len(self.filename_))
    n += self.lengthString(len(self.name_))
    if (self.has_proto_name_): n += 2 + self.lengthString(len(self.proto_name_))
    n += 2 * len(self.tag_)
    for i in xrange(len(self.tag_)): n += self.tag_[i].ByteSize()
    n += 2 * len(self.enumtype_)
    for i in xrange(len(self.enumtype_)): n += self.enumtype_[i].ByteSize()
    if (self.has_proto2_file_descriptor_): n += 2 + self.lengthString(len(self.proto2_file_descriptor_))
    if (self.has_proto2_file_master_): n += 2 + self.lengthString(len(self.proto2_file_master_))
    if (self.has_proto2_name_): n += 2 + self.lengthString(len(self.proto2_name_))
    if (self.has_proto2_extension_info_): n += 2 + self.lengthString(len(self.proto2_extension_info_))
    if (self.has_proto2_file_scope_info_): n += 2 + self.lengthString(len(self.proto2_file_scope_info_))
    return n + 2

  def ByteSizePartial(self):
    n = 0
    if (self.has_filename_):
      n += 1
      n += self.lengthString(len(self.filename_))
    if (self.has_name_):
      n += 1
      n += self.lengthString(len(self.name_))
    if (self.has_proto_name_): n += 2 + self.lengthString(len(self.proto_name_))
    n += 2 * len(self.tag_)
    for i in xrange(len(self.tag_)): n += self.tag_[i].ByteSizePartial()
    n += 2 * len(self.enumtype_)
    for i in xrange(len(self.enumtype_)): n += self.enumtype_[i].ByteSizePartial()
    if (self.has_proto2_file_descriptor_): n += 2 + self.lengthString(len(self.proto2_file_descriptor_))
    if (self.has_proto2_file_master_): n += 2 + self.lengthString(len(self.proto2_file_master_))
    if (self.has_proto2_name_): n += 2 + self.lengthString(len(self.proto2_name_))
    if (self.has_proto2_extension_info_): n += 2 + self.lengthString(len(self.proto2_extension_info_))
    if (self.has_proto2_file_scope_info_): n += 2 + self.lengthString(len(self.proto2_file_scope_info_))
    return n

  def Clear(self):
    self.clear_filename()
    self.clear_name()
    self.clear_proto_name()
    self.clear_tag()
    self.clear_enumtype()
    self.clear_proto2_file_descriptor()
    self.clear_proto2_file_master()
    self.clear_proto2_name()
    self.clear_proto2_extension_info()
    self.clear_proto2_file_scope_info()

  def OutputUnchecked(self, out):
    out.putVarInt32(10)
    out.putPrefixedString(self.name_)
    for i in xrange(len(self.tag_)):
      out.putVarInt32(19)
      self.tag_[i].OutputUnchecked(out)
      out.putVarInt32(20)
    out.putVarInt32(90)
    out.putPrefixedString(self.filename_)
    for i in xrange(len(self.enumtype_)):
      out.putVarInt32(115)
      self.enumtype_[i].OutputUnchecked(out)
      out.putVarInt32(116)
    if (self.has_proto2_file_descriptor_):
      out.putVarInt32(186)
      out.putPrefixedString(self.proto2_file_descriptor_)
    if (self.has_proto2_file_master_):
      out.putVarInt32(194)
      out.putPrefixedString(self.proto2_file_master_)
    if (self.has_proto2_name_):
      out.putVarInt32(202)
      out.putPrefixedString(self.proto2_name_)
    if (self.has_proto_name_):
      out.putVarInt32(218)
      out.putPrefixedString(self.proto_name_)
    if (self.has_proto2_extension_info_):
      out.putVarInt32(234)
      out.putPrefixedString(self.proto2_extension_info_)
    if (self.has_proto2_file_scope_info_):
      out.putVarInt32(242)
      out.putPrefixedString(self.proto2_file_scope_info_)

  def OutputPartial(self, out):
    if (self.has_name_):
      out.putVarInt32(10)
      out.putPrefixedString(self.name_)
    for i in xrange(len(self.tag_)):
      out.putVarInt32(19)
      self.tag_[i].OutputPartial(out)
      out.putVarInt32(20)
    if (self.has_filename_):
      out.putVarInt32(90)
      out.putPrefixedString(self.filename_)
    for i in xrange(len(self.enumtype_)):
      out.putVarInt32(115)
      self.enumtype_[i].OutputPartial(out)
      out.putVarInt32(116)
    if (self.has_proto2_file_descriptor_):
      out.putVarInt32(186)
      out.putPrefixedString(self.proto2_file_descriptor_)
    if (self.has_proto2_file_master_):
      out.putVarInt32(194)
      out.putPrefixedString(self.proto2_file_master_)
    if (self.has_proto2_name_):
      out.putVarInt32(202)
      out.putPrefixedString(self.proto2_name_)
    if (self.has_proto_name_):
      out.putVarInt32(218)
      out.putPrefixedString(self.proto_name_)
    if (self.has_proto2_extension_info_):
      out.putVarInt32(234)
      out.putPrefixedString(self.proto2_extension_info_)
    if (self.has_proto2_file_scope_info_):
      out.putVarInt32(242)
      out.putPrefixedString(self.proto2_file_scope_info_)

  def TryMerge(self, d):
    while d.avail() > 0:
      tt = d.getVarInt32()
      if tt == 10:
        self.set_name(d.getPrefixedString())
        continue
      if tt == 19:
        self.add_tag().TryMerge(d)
        continue
      if tt == 90:
        self.set_filename(d.getPrefixedString())
        continue
      if tt == 115:
        self.add_enumtype().TryMerge(d)
        continue
      if tt == 186:
        self.set_proto2_file_descriptor(d.getPrefixedString())
        continue
      if tt == 194:
        self.set_proto2_file_master(d.getPrefixedString())
        continue
      if tt == 202:
        self.set_proto2_name(d.getPrefixedString())
        continue
      if tt == 218:
        self.set_proto_name(d.getPrefixedString())
        continue
      if tt == 234:
        self.set_proto2_extension_info(d.getPrefixedString())
        continue
      if tt == 242:
        self.set_proto2_file_scope_info(d.getPrefixedString())
        continue
      # tag 0 is special: it's used to indicate an error.
      # so if we see it we raise an exception.
      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
      d.skipData(tt)


  def __str__(self, prefix="", printElemNumber=0):
    res=""
    if self.has_filename_: res+=prefix+("filename: %s\n" % self.DebugFormatString(self.filename_))
    if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_))
    if self.has_proto_name_: res+=prefix+("proto_name: %s\n" % self.DebugFormatString(self.proto_name_))
    cnt=0
    for e in self.tag_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("Tag%s {\n" % elm)
      res+=e.__str__(prefix + "  ", printElemNumber)
      res+=prefix+"}\n"
      cnt+=1
    cnt=0
    for e in self.enumtype_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("EnumType%s {\n" % elm)
      res+=e.__str__(prefix + "  ", printElemNumber)
      res+=prefix+"}\n"
      cnt+=1
    if self.has_proto2_file_descriptor_: res+=prefix+("proto2_file_descriptor: %s\n" % self.DebugFormatString(self.proto2_file_descriptor_))
    if self.has_proto2_file_master_: res+=prefix+("proto2_file_master: %s\n" % self.DebugFormatString(self.proto2_file_master_))
    if self.has_proto2_name_: res+=prefix+("proto2_name: %s\n" % self.DebugFormatString(self.proto2_name_))
    if self.has_proto2_extension_info_: res+=prefix+("proto2_extension_info: %s\n" % self.DebugFormatString(self.proto2_extension_info_))
    if self.has_proto2_file_scope_info_: res+=prefix+("proto2_file_scope_info: %s\n" % self.DebugFormatString(self.proto2_file_scope_info_))
    return res


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

  kfilename = 11
  kname = 1
  kproto_name = 27
  kTagGroup = 2
  kTagname = 3
  kTagnumber = 4
  kTagwire_type = 5
  kTagdeclared_type = 6
  kTaglabel = 7
  kTagdefault_value = 8
  kTagforeign = 9
  kTagforeign_proto_name = 28
  kTagflags = 10
  kTagparent = 12
  kTagenum_id = 13
  kTagdeprecated = 26
  kTagOptionGroup = 20
  kTagOptionname = 21
  kTagOptionvalue = 22
  kEnumTypeGroup = 14
  kEnumTypename = 15
  kEnumTypeparent = 16
  kEnumTypeTagGroup = 17
  kEnumTypeTagname = 18
  kEnumTypeTagvalue = 19
  kEnumTypeproto2_name = 31
  kEnumTypeallow_alias = 33
  kproto2_file_descriptor = 23
  kproto2_file_master = 24
  kproto2_name = 25
  kproto2_extension_info = 29
  kproto2_file_scope_info = 30

  _TEXT = _BuildTagLookupTable({
    0: "ErrorCode",
    1: "name",
    2: "Tag",
    3: "name",
    4: "number",
    5: "wire_type",
    6: "declared_type",
    7: "label",
    8: "default_value",
    9: "foreign",
    10: "flags",
    11: "filename",
    12: "parent",
    13: "enum_id",
    14: "EnumType",
    15: "name",
    16: "parent",
    17: "Tag",
    18: "name",
    19: "value",
    20: "Option",
    21: "name",
    22: "value",
    23: "proto2_file_descriptor",
    24: "proto2_file_master",
    25: "proto2_name",
    26: "deprecated",
    27: "proto_name",
    28: "foreign_proto_name",
    29: "proto2_extension_info",
    30: "proto2_file_scope_info",
    31: "proto2_name",
    33: "allow_alias",
  }, 33)

  _TYPES = _BuildTagLookupTable({
    0: ProtocolBuffer.Encoder.NUMERIC,
    1: ProtocolBuffer.Encoder.STRING,
    2: ProtocolBuffer.Encoder.STARTGROUP,
    3: ProtocolBuffer.Encoder.STRING,
    4: ProtocolBuffer.Encoder.NUMERIC,
    5: ProtocolBuffer.Encoder.NUMERIC,
    6: ProtocolBuffer.Encoder.NUMERIC,
    7: ProtocolBuffer.Encoder.NUMERIC,
    8: ProtocolBuffer.Encoder.STRING,
    9: ProtocolBuffer.Encoder.STRING,
    10: ProtocolBuffer.Encoder.NUMERIC,
    11: ProtocolBuffer.Encoder.STRING,
    12: ProtocolBuffer.Encoder.NUMERIC,
    13: ProtocolBuffer.Encoder.NUMERIC,
    14: ProtocolBuffer.Encoder.STARTGROUP,
    15: ProtocolBuffer.Encoder.STRING,
    16: ProtocolBuffer.Encoder.NUMERIC,
    17: ProtocolBuffer.Encoder.STARTGROUP,
    18: ProtocolBuffer.Encoder.STRING,
    19: ProtocolBuffer.Encoder.NUMERIC,
    20: ProtocolBuffer.Encoder.STARTGROUP,
    21: ProtocolBuffer.Encoder.STRING,
    22: ProtocolBuffer.Encoder.STRING,
    23: ProtocolBuffer.Encoder.STRING,
    24: ProtocolBuffer.Encoder.STRING,
    25: ProtocolBuffer.Encoder.STRING,
    26: ProtocolBuffer.Encoder.NUMERIC,
    27: ProtocolBuffer.Encoder.STRING,
    28: ProtocolBuffer.Encoder.STRING,
    29: ProtocolBuffer.Encoder.STRING,
    30: ProtocolBuffer.Encoder.STRING,
    31: ProtocolBuffer.Encoder.STRING,
    33: ProtocolBuffer.Encoder.NUMERIC,
  }, 33, ProtocolBuffer.Encoder.MAX_TYPE)

  # stylesheet for XML output
  _STYLE = \
   """"""
  _STYLE_CONTENT_TYPE = \
   """"""
  _PROTO_DESCRIPTOR_NAME = 'ProtocolDescriptor'
  _SERIALIZED_DESCRIPTOR = array.array('B')
  _SERIALIZED_DESCRIPTOR.fromstring(base64.decodestring(" "))
  if _net_proto___parse__python is not None:
    _net_proto___parse__python.RegisterType(
        _SERIALIZED_DESCRIPTOR.tostring())

class ProtocolFileDescriptor(ProtocolBuffer.ProtocolMessage):
  has_filename_ = 0
  filename_ = ""

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

  def filename(self): return self.filename_

  def set_filename(self, x):
    self.has_filename_ = 1
    self.filename_ = x

  def clear_filename(self):
    if self.has_filename_:
      self.has_filename_ = 0
      self.filename_ = ""

  def has_filename(self): return self.has_filename_

  def type_size(self): return len(self.type_)
  def type_list(self): return self.type_

  def type(self, i):
    return self.type_[i]

  def set_type(self, i, x):
    self.type_[i] = x

  def add_type(self, x):
    self.type_.append(x)

  def clear_type(self):
    self.type_ = []

  def service_size(self): return len(self.service_)
  def service_list(self): return self.service_

  def service(self, i):
    return self.service_[i]

  def set_service(self, i, x):
    self.service_[i] = x

  def add_service(self, x):
    self.service_.append(x)

  def clear_service(self):
    self.service_ = []


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_filename()): self.set_filename(x.filename())
    for i in xrange(x.type_size()): self.add_type(x.type(i))
    for i in xrange(x.service_size()): self.add_service(x.service(i))

  if _net_proto___parse__python is not None:
    def _CMergeFromString(self, s):
      _net_proto___parse__python.MergeFromString(self, 'ProtocolFileDescriptor', s)

  if _net_proto___parse__python is not None:
    def _CEncode(self):
      return _net_proto___parse__python.Encode(self, 'ProtocolFileDescriptor')

  if _net_proto___parse__python is not None:
    def _CEncodePartial(self):
      return _net_proto___parse__python.EncodePartial(self, 'ProtocolFileDescriptor')

  if _net_proto___parse__python is not None:
    def _CToASCII(self, output_format):
      return _net_proto___parse__python.ToASCII(self, 'ProtocolFileDescriptor', output_format)


  if _net_proto___parse__python is not None:
    def ParseASCII(self, s):
      _net_proto___parse__python.ParseASCII(self, 'ProtocolFileDescriptor', s)


  if _net_proto___parse__python is not None:
    def ParseASCIIIgnoreUnknown(self, s):
      _net_proto___parse__python.ParseASCIIIgnoreUnknown(self, 'ProtocolFileDescriptor', s)


  def Equals(self, x):
    if x is self: return 1
    if self.has_filename_ != x.has_filename_: return 0
    if self.has_filename_ and self.filename_ != x.filename_: return 0
    if len(self.type_) != len(x.type_): return 0
    for e1, e2 in zip(self.type_, x.type_):
      if e1 != e2: return 0
    if len(self.service_) != len(x.service_): return 0
    for e1, e2 in zip(self.service_, x.service_):
      if e1 != e2: return 0
    return 1

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

  def ByteSize(self):
    n = 0
    n += self.lengthString(len(self.filename_))
    n += 1 * len(self.type_)
    for i in xrange(len(self.type_)): n += self.lengthString(len(self.type_[i]))
    n += 1 * len(self.service_)
    for i in xrange(len(self.service_)): n += self.lengthString(len(self.service_[i]))
    return n + 1

  def ByteSizePartial(self):
    n = 0
    if (self.has_filename_):
      n += 1
      n += self.lengthString(len(self.filename_))
    n += 1 * len(self.type_)
    for i in xrange(len(self.type_)): n += self.lengthString(len(self.type_[i]))
    n += 1 * len(self.service_)
    for i in xrange(len(self.service_)): n += self.lengthString(len(self.service_[i]))
    return n

  def Clear(self):
    self.clear_filename()
    self.clear_type()
    self.clear_service()

  def OutputUnchecked(self, out):
    out.putVarInt32(10)
    out.putPrefixedString(self.filename_)
    for i in xrange(len(self.type_)):
      out.putVarInt32(18)
      out.putPrefixedString(self.type_[i])
    for i in xrange(len(self.service_)):
      out.putVarInt32(26)
      out.putPrefixedString(self.service_[i])

  def OutputPartial(self, out):
    if (self.has_filename_):
      out.putVarInt32(10)
      out.putPrefixedString(self.filename_)
    for i in xrange(len(self.type_)):
      out.putVarInt32(18)
      out.putPrefixedString(self.type_[i])
    for i in xrange(len(self.service_)):
      out.putVarInt32(26)
      out.putPrefixedString(self.service_[i])

  def TryMerge(self, d):
    while d.avail() > 0:
      tt = d.getVarInt32()
      if tt == 10:
        self.set_filename(d.getPrefixedString())
        continue
      if tt == 18:
        self.add_type(d.getPrefixedString())
        continue
      if tt == 26:
        self.add_service(d.getPrefixedString())
        continue
      # tag 0 is special: it's used to indicate an error.
      # so if we see it we raise an exception.
      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
      d.skipData(tt)


  def __str__(self, prefix="", printElemNumber=0):
    res=""
    if self.has_filename_: res+=prefix+("filename: %s\n" % self.DebugFormatString(self.filename_))
    cnt=0
    for e in self.type_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("type%s: %s\n" % (elm, self.DebugFormatString(e)))
      cnt+=1
    cnt=0
    for e in self.service_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("service%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)])

  kfilename = 1
  ktype = 2
  kservice = 3

  _TEXT = _BuildTagLookupTable({
    0: "ErrorCode",
    1: "filename",
    2: "type",
    3: "service",
  }, 3)

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

  # stylesheet for XML output
  _STYLE = \
   """"""
  _STYLE_CONTENT_TYPE = \
   """"""
  _PROTO_DESCRIPTOR_NAME = 'ProtocolFileDescriptor'
  _SERIALIZED_DESCRIPTOR = array.array('B')
  _SERIALIZED_DESCRIPTOR.fromstring(base64.decodestring("WhxuZXQvcHJvdG8vcHJvdG9jb2x0eXBlLnByb3RvChZQcm90b2NvbEZpbGVEZXNjcmlwdG9yExoIZmlsZW5hbWUgASgCMAk4AhQTGgR0eXBlIAIoAjAJOAMUExoHc2VydmljZSADKAIwCTgDFMIBElByb3RvY29sRGVzY3JpcHRvcg=="))
  if _net_proto___parse__python is not None:
    _net_proto___parse__python.RegisterType(
        _SERIALIZED_DESCRIPTOR.tostring())

class RPC_ServiceDescriptor_Method(ProtocolBuffer.ProtocolMessage):
  has_name_ = 0
  name_ = ""
  has_argument_type_ = 0
  argument_type_ = ""
  has_result_type_ = 0
  result_type_ = ""
  has_stream_type_ = 0
  stream_type_ = ""
  has_protocol_ = 0
  protocol_ = ""
  has_deadline_ = 0
  deadline_ = 0.0
  has_duplicate_suppression_ = 0
  duplicate_suppression_ = 0
  has_fail_fast_ = 0
  fail_fast_ = 0
  has_end_user_creds_requested_ = 0
  end_user_creds_requested_ = 0
  has_client_logging_ = 0
  client_logging_ = 0
  has_server_logging_ = 0
  server_logging_ = 0
  has_security_level_ = 0
  security_level_ = ""
  has_security_label_ = 0
  security_label_ = ""
  has_response_format_ = 0
  response_format_ = ""
  has_request_format_ = 0
  request_format_ = ""
  has_log_level_ = 0
  log_level_ = ""

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

  def name(self): return self.name_

  def set_name(self, x):
    self.has_name_ = 1
    self.name_ = x

  def clear_name(self):
    if self.has_name_:
      self.has_name_ = 0
      self.name_ = ""

  def has_name(self): return self.has_name_

  def argument_type(self): return self.argument_type_

  def set_argument_type(self, x):
    self.has_argument_type_ = 1
    self.argument_type_ = x

  def clear_argument_type(self):
    if self.has_argument_type_:
      self.has_argument_type_ = 0
      self.argument_type_ = ""

  def has_argument_type(self): return self.has_argument_type_

  def result_type(self): return self.result_type_

  def set_result_type(self, x):
    self.has_result_type_ = 1
    self.result_type_ = x

  def clear_result_type(self):
    if self.has_result_type_:
      self.has_result_type_ = 0
      self.result_type_ = ""

  def has_result_type(self): return self.has_result_type_

  def stream_type(self): return self.stream_type_

  def set_stream_type(self, x):
    self.has_stream_type_ = 1
    self.stream_type_ = x

  def clear_stream_type(self):
    if self.has_stream_type_:
      self.has_stream_type_ = 0
      self.stream_type_ = ""

  def has_stream_type(self): return self.has_stream_type_

  def protocol(self): return self.protocol_

  def set_protocol(self, x):
    self.has_protocol_ = 1
    self.protocol_ = x

  def clear_protocol(self):
    if self.has_protocol_:
      self.has_protocol_ = 0
      self.protocol_ = ""

  def has_protocol(self): return self.has_protocol_

  def deadline(self): return self.deadline_

  def set_deadline(self, x):
    self.has_deadline_ = 1
    self.deadline_ = x

  def clear_deadline(self):
    if self.has_deadline_:
      self.has_deadline_ = 0
      self.deadline_ = 0.0

  def has_deadline(self): return self.has_deadline_

  def duplicate_suppression(self): return self.duplicate_suppression_

  def set_duplicate_suppression(self, x):
    self.has_duplicate_suppression_ = 1
    self.duplicate_suppression_ = x

  def clear_duplicate_suppression(self):
    if self.has_duplicate_suppression_:
      self.has_duplicate_suppression_ = 0
      self.duplicate_suppression_ = 0

  def has_duplicate_suppression(self): return self.has_duplicate_suppression_

  def fail_fast(self): return self.fail_fast_

  def set_fail_fast(self, x):
    self.has_fail_fast_ = 1
    self.fail_fast_ = x

  def clear_fail_fast(self):
    if self.has_fail_fast_:
      self.has_fail_fast_ = 0
      self.fail_fast_ = 0

  def has_fail_fast(self): return self.has_fail_fast_

  def end_user_creds_requested(self): return self.end_user_creds_requested_

  def set_end_user_creds_requested(self, x):
    self.has_end_user_creds_requested_ = 1
    self.end_user_creds_requested_ = x

  def clear_end_user_creds_requested(self):
    if self.has_end_user_creds_requested_:
      self.has_end_user_creds_requested_ = 0
      self.end_user_creds_requested_ = 0

  def has_end_user_creds_requested(self): return self.has_end_user_creds_requested_

  def client_logging(self): return self.client_logging_

  def set_client_logging(self, x):
    self.has_client_logging_ = 1
    self.client_logging_ = x

  def clear_client_logging(self):
    if self.has_client_logging_:
      self.has_client_logging_ = 0
      self.client_logging_ = 0

  def has_client_logging(self): return self.has_client_logging_

  def server_logging(self): return self.server_logging_

  def set_server_logging(self, x):
    self.has_server_logging_ = 1
    self.server_logging_ = x

  def clear_server_logging(self):
    if self.has_server_logging_:
      self.has_server_logging_ = 0
      self.server_logging_ = 0

  def has_server_logging(self): return self.has_server_logging_

  def security_level(self): return self.security_level_

  def set_security_level(self, x):
    self.has_security_level_ = 1
    self.security_level_ = x

  def clear_security_level(self):
    if self.has_security_level_:
      self.has_security_level_ = 0
      self.security_level_ = ""

  def has_security_level(self): return self.has_security_level_

  def security_label(self): return self.security_label_

  def set_security_label(self, x):
    self.has_security_label_ = 1
    self.security_label_ = x

  def clear_security_label(self):
    if self.has_security_label_:
      self.has_security_label_ = 0
      self.security_label_ = ""

  def has_security_label(self): return self.has_security_label_

  def response_format(self): return self.response_format_

  def set_response_format(self, x):
    self.has_response_format_ = 1
    self.response_format_ = x

  def clear_response_format(self):
    if self.has_response_format_:
      self.has_response_format_ = 0
      self.response_format_ = ""

  def has_response_format(self): return self.has_response_format_

  def request_format(self): return self.request_format_

  def set_request_format(self, x):
    self.has_request_format_ = 1
    self.request_format_ = x

  def clear_request_format(self):
    if self.has_request_format_:
      self.has_request_format_ = 0
      self.request_format_ = ""

  def has_request_format(self): return self.has_request_format_

  def log_level(self): return self.log_level_

  def set_log_level(self, x):
    self.has_log_level_ = 1
    self.log_level_ = x

  def clear_log_level(self):
    if self.has_log_level_:
      self.has_log_level_ = 0
      self.log_level_ = ""

  def has_log_level(self): return self.has_log_level_


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_name()): self.set_name(x.name())
    if (x.has_argument_type()): self.set_argument_type(x.argument_type())
    if (x.has_result_type()): self.set_result_type(x.result_type())
    if (x.has_stream_type()): self.set_stream_type(x.stream_type())
    if (x.has_protocol()): self.set_protocol(x.protocol())
    if (x.has_deadline()): self.set_deadline(x.deadline())
    if (x.has_duplicate_suppression()): self.set_duplicate_suppression(x.duplicate_suppression())
    if (x.has_fail_fast()): self.set_fail_fast(x.fail_fast())
    if (x.has_end_user_creds_requested()): self.set_end_user_creds_requested(x.end_user_creds_requested())
    if (x.has_client_logging()): self.set_client_logging(x.client_logging())
    if (x.has_server_logging()): self.set_server_logging(x.server_logging())
    if (x.has_security_level()): self.set_security_level(x.security_level())
    if (x.has_security_label()): self.set_security_label(x.security_label())
    if (x.has_response_format()): self.set_response_format(x.response_format())
    if (x.has_request_format()): self.set_request_format(x.request_format())
    if (x.has_log_level()): self.set_log_level(x.log_level())

  def Equals(self, x):
    if x is self: return 1
    if self.has_name_ != x.has_name_: return 0
    if self.has_name_ and self.name_ != x.name_: return 0
    if self.has_argument_type_ != x.has_argument_type_: return 0
    if self.has_argument_type_ and self.argument_type_ != x.argument_type_: return 0
    if self.has_result_type_ != x.has_result_type_: return 0
    if self.has_result_type_ and self.result_type_ != x.result_type_: return 0
    if self.has_stream_type_ != x.has_stream_type_: return 0
    if self.has_stream_type_ and self.stream_type_ != x.stream_type_: return 0
    if self.has_protocol_ != x.has_protocol_: return 0
    if self.has_protocol_ and self.protocol_ != x.protocol_: return 0
    if self.has_deadline_ != x.has_deadline_: return 0
    if self.has_deadline_ and self.deadline_ != x.deadline_: return 0
    if self.has_duplicate_suppression_ != x.has_duplicate_suppression_: return 0
    if self.has_duplicate_suppression_ and self.duplicate_suppression_ != x.duplicate_suppression_: return 0
    if self.has_fail_fast_ != x.has_fail_fast_: return 0
    if self.has_fail_fast_ and self.fail_fast_ != x.fail_fast_: return 0
    if self.has_end_user_creds_requested_ != x.has_end_user_creds_requested_: return 0
    if self.has_end_user_creds_requested_ and self.end_user_creds_requested_ != x.end_user_creds_requested_: return 0
    if self.has_client_logging_ != x.has_client_logging_: return 0
    if self.has_client_logging_ and self.client_logging_ != x.client_logging_: return 0
    if self.has_server_logging_ != x.has_server_logging_: return 0
    if self.has_server_logging_ and self.server_logging_ != x.server_logging_: return 0
    if self.has_security_level_ != x.has_security_level_: return 0
    if self.has_security_level_ and self.security_level_ != x.security_level_: return 0
    if self.has_security_label_ != x.has_security_label_: return 0
    if self.has_security_label_ and self.security_label_ != x.security_label_: return 0
    if self.has_response_format_ != x.has_response_format_: return 0
    if self.has_response_format_ and self.response_format_ != x.response_format_: return 0
    if self.has_request_format_ != x.has_request_format_: return 0
    if self.has_request_format_ and self.request_format_ != x.request_format_: return 0
    if self.has_log_level_ != x.has_log_level_: return 0
    if self.has_log_level_ and self.log_level_ != x.log_level_: return 0
    return 1

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_name_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: name not set.')
    if (not self.has_argument_type_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: argument_type not set.')
    if (not self.has_result_type_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: result_type not set.')
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthString(len(self.name_))
    n += self.lengthString(len(self.argument_type_))
    n += self.lengthString(len(self.result_type_))
    if (self.has_stream_type_): n += 1 + self.lengthString(len(self.stream_type_))
    if (self.has_protocol_): n += 1 + self.lengthString(len(self.protocol_))
    if (self.has_deadline_): n += 9
    if (self.has_duplicate_suppression_): n += 2
    if (self.has_fail_fast_): n += 2
    if (self.has_end_user_creds_requested_): n += 3
    if (self.has_client_logging_): n += 1 + self.lengthVarInt64(self.client_logging_)
    if (self.has_server_logging_): n += 1 + self.lengthVarInt64(self.server_logging_)
    if (self.has_security_level_): n += 1 + self.lengthString(len(self.security_level_))
    if (self.has_security_label_): n += 2 + self.lengthString(len(self.security_label_))
    if (self.has_response_format_): n += 1 + self.lengthString(len(self.response_format_))
    if (self.has_request_format_): n += 2 + self.lengthString(len(self.request_format_))
    if (self.has_log_level_): n += 2 + self.lengthString(len(self.log_level_))
    return n + 3

  def ByteSizePartial(self):
    n = 0
    if (self.has_name_):
      n += 1
      n += self.lengthString(len(self.name_))
    if (self.has_argument_type_):
      n += 1
      n += self.lengthString(len(self.argument_type_))
    if (self.has_result_type_):
      n += 1
      n += self.lengthString(len(self.result_type_))
    if (self.has_stream_type_): n += 1 + self.lengthString(len(self.stream_type_))
    if (self.has_protocol_): n += 1 + self.lengthString(len(self.protocol_))
    if (self.has_deadline_): n += 9
    if (self.has_duplicate_suppression_): n += 2
    if (self.has_fail_fast_): n += 2
    if (self.has_end_user_creds_requested_): n += 3
    if (self.has_client_logging_): n += 1 + self.lengthVarInt64(self.client_logging_)
    if (self.has_server_logging_): n += 1 + self.lengthVarInt64(self.server_logging_)
    if (self.has_security_level_): n += 1 + self.lengthString(len(self.security_level_))
    if (self.has_security_label_): n += 2 + self.lengthString(len(self.security_label_))
    if (self.has_response_format_): n += 1 + self.lengthString(len(self.response_format_))
    if (self.has_request_format_): n += 2 + self.lengthString(len(self.request_format_))
    if (self.has_log_level_): n += 2 + self.lengthString(len(self.log_level_))
    return n

  def Clear(self):
    self.clear_name()
    self.clear_argument_type()
    self.clear_result_type()
    self.clear_stream_type()
    self.clear_protocol()
    self.clear_deadline()
    self.clear_duplicate_suppression()
    self.clear_fail_fast()
    self.clear_end_user_creds_requested()
    self.clear_client_logging()
    self.clear_server_logging()
    self.clear_security_level()
    self.clear_security_label()
    self.clear_response_format()
    self.clear_request_format()
    self.clear_log_level()

  def OutputUnchecked(self, out):
    out.putVarInt32(34)
    out.putPrefixedString(self.name_)
    out.putVarInt32(42)
    out.putPrefixedString(self.argument_type_)
    out.putVarInt32(50)
    out.putPrefixedString(self.result_type_)
    if (self.has_protocol_):
      out.putVarInt32(58)
      out.putPrefixedString(self.protocol_)
    if (self.has_deadline_):
      out.putVarInt32(65)
      out.putDouble(self.deadline_)
    if (self.has_duplicate_suppression_):
      out.putVarInt32(72)
      out.putBoolean(self.duplicate_suppression_)
    if (self.has_fail_fast_):
      out.putVarInt32(80)
      out.putBoolean(self.fail_fast_)
    if (self.has_client_logging_):
      out.putVarInt32(88)
      out.putVarInt32(self.client_logging_)
    if (self.has_server_logging_):
      out.putVarInt32(96)
      out.putVarInt32(self.server_logging_)
    if (self.has_security_level_):
      out.putVarInt32(106)
      out.putPrefixedString(self.security_level_)
    if (self.has_stream_type_):
      out.putVarInt32(114)
      out.putPrefixedString(self.stream_type_)
    if (self.has_response_format_):
      out.putVarInt32(122)
      out.putPrefixedString(self.response_format_)
    if (self.has_request_format_):
      out.putVarInt32(138)
      out.putPrefixedString(self.request_format_)
    if (self.has_security_label_):
      out.putVarInt32(154)
      out.putPrefixedString(self.security_label_)
    if (self.has_end_user_creds_requested_):
      out.putVarInt32(272)
      out.putBoolean(self.end_user_creds_requested_)
    if (self.has_log_level_):
      out.putVarInt32(290)
      out.putPrefixedString(self.log_level_)

  def OutputPartial(self, out):
    if (self.has_name_):
      out.putVarInt32(34)
      out.putPrefixedString(self.name_)
    if (self.has_argument_type_):
      out.putVarInt32(42)
      out.putPrefixedString(self.argument_type_)
    if (self.has_result_type_):
      out.putVarInt32(50)
      out.putPrefixedString(self.result_type_)
    if (self.has_protocol_):
      out.putVarInt32(58)
      out.putPrefixedString(self.protocol_)
    if (self.has_deadline_):
      out.putVarInt32(65)
      out.putDouble(self.deadline_)
    if (self.has_duplicate_suppression_):
      out.putVarInt32(72)
      out.putBoolean(self.duplicate_suppression_)
    if (self.has_fail_fast_):
      out.putVarInt32(80)
      out.putBoolean(self.fail_fast_)
    if (self.has_client_logging_):
      out.putVarInt32(88)
      out.putVarInt32(self.client_logging_)
    if (self.has_server_logging_):
      out.putVarInt32(96)
      out.putVarInt32(self.server_logging_)
    if (self.has_security_level_):
      out.putVarInt32(106)
      out.putPrefixedString(self.security_level_)
    if (self.has_stream_type_):
      out.putVarInt32(114)
      out.putPrefixedString(self.stream_type_)
    if (self.has_response_format_):
      out.putVarInt32(122)
      out.putPrefixedString(self.response_format_)
    if (self.has_request_format_):
      out.putVarInt32(138)
      out.putPrefixedString(self.request_format_)
    if (self.has_security_label_):
      out.putVarInt32(154)
      out.putPrefixedString(self.security_label_)
    if (self.has_end_user_creds_requested_):
      out.putVarInt32(272)
      out.putBoolean(self.end_user_creds_requested_)
    if (self.has_log_level_):
      out.putVarInt32(290)
      out.putPrefixedString(self.log_level_)

  def TryMerge(self, d):
    while 1:
      tt = d.getVarInt32()
      if tt == 28: break
      if tt == 34:
        self.set_name(d.getPrefixedString())
        continue
      if tt == 42:
        self.set_argument_type(d.getPrefixedString())
        continue
      if tt == 50:
        self.set_result_type(d.getPrefixedString())
        continue
      if tt == 58:
        self.set_protocol(d.getPrefixedString())
        continue
      if tt == 65:
        self.set_deadline(d.getDouble())
        continue
      if tt == 72:
        self.set_duplicate_suppression(d.getBoolean())
        continue
      if tt == 80:
        self.set_fail_fast(d.getBoolean())
        continue
      if tt == 88:
        self.set_client_logging(d.getVarInt32())
        continue
      if tt == 96:
        self.set_server_logging(d.getVarInt32())
        continue
      if tt == 106:
        self.set_security_level(d.getPrefixedString())
        continue
      if tt == 114:
        self.set_stream_type(d.getPrefixedString())
        continue
      if tt == 122:
        self.set_response_format(d.getPrefixedString())
        continue
      if tt == 138:
        self.set_request_format(d.getPrefixedString())
        continue
      if tt == 154:
        self.set_security_label(d.getPrefixedString())
        continue
      if tt == 272:
        self.set_end_user_creds_requested(d.getBoolean())
        continue
      if tt == 290:
        self.set_log_level(d.getPrefixedString())
        continue
      # tag 0 is special: it's used to indicate an error.
      # so if we see it we raise an exception.
      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
      d.skipData(tt)


  def __str__(self, prefix="", printElemNumber=0):
    res=""
    if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_))
    if self.has_argument_type_: res+=prefix+("argument_type: %s\n" % self.DebugFormatString(self.argument_type_))
    if self.has_result_type_: res+=prefix+("result_type: %s\n" % self.DebugFormatString(self.result_type_))
    if self.has_stream_type_: res+=prefix+("stream_type: %s\n" % self.DebugFormatString(self.stream_type_))
    if self.has_protocol_: res+=prefix+("protocol: %s\n" % self.DebugFormatString(self.protocol_))
    if self.has_deadline_: res+=prefix+("deadline: %s\n" % self.DebugFormat(self.deadline_))
    if self.has_duplicate_suppression_: res+=prefix+("duplicate_suppression: %s\n" % self.DebugFormatBool(self.duplicate_suppression_))
    if self.has_fail_fast_: res+=prefix+("fail_fast: %s\n" % self.DebugFormatBool(self.fail_fast_))
    if self.has_end_user_creds_requested_: res+=prefix+("end_user_creds_requested: %s\n" % self.DebugFormatBool(self.end_user_creds_requested_))
    if self.has_client_logging_: res+=prefix+("client_logging: %s\n" % self.DebugFormatInt32(self.client_logging_))
    if self.has_server_logging_: res+=prefix+("server_logging: %s\n" % self.DebugFormatInt32(self.server_logging_))
    if self.has_security_level_: res+=prefix+("security_level: %s\n" % self.DebugFormatString(self.security_level_))
    if self.has_security_label_: res+=prefix+("security_label: %s\n" % self.DebugFormatString(self.security_label_))
    if self.has_response_format_: res+=prefix+("response_format: %s\n" % self.DebugFormatString(self.response_format_))
    if self.has_request_format_: res+=prefix+("request_format: %s\n" % self.DebugFormatString(self.request_format_))
    if self.has_log_level_: res+=prefix+("log_level: %s\n" % self.DebugFormatString(self.log_level_))
    return res

class RPC_ServiceDescriptor_Stream(ProtocolBuffer.ProtocolMessage):
  has_name_ = 0
  name_ = ""
  has_client_message_type_ = 0
  client_message_type_ = ""
  has_server_message_type_ = 0
  server_message_type_ = ""
  has_client_initial_tokens_ = 0
  client_initial_tokens_ = 0
  has_server_initial_tokens_ = 0
  server_initial_tokens_ = 0
  has_token_unit_ = 0
  token_unit_ = ""
  has_security_level_ = 0
  security_level_ = ""
  has_security_label_ = 0
  security_label_ = ""
  has_client_logging_ = 0
  client_logging_ = 0
  has_server_logging_ = 0
  server_logging_ = 0
  has_deadline_ = 0
  deadline_ = 0.0
  has_fail_fast_ = 0
  fail_fast_ = 0
  has_end_user_creds_requested_ = 0
  end_user_creds_requested_ = 0
  has_log_level_ = 0
  log_level_ = ""

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

  def name(self): return self.name_

  def set_name(self, x):
    self.has_name_ = 1
    self.name_ = x

  def clear_name(self):
    if self.has_name_:
      self.has_name_ = 0
      self.name_ = ""

  def has_name(self): return self.has_name_

  def client_message_type(self): return self.client_message_type_

  def set_client_message_type(self, x):
    self.has_client_message_type_ = 1
    self.client_message_type_ = x

  def clear_client_message_type(self):
    if self.has_client_message_type_:
      self.has_client_message_type_ = 0
      self.client_message_type_ = ""

  def has_client_message_type(self): return self.has_client_message_type_

  def server_message_type(self): return self.server_message_type_

  def set_server_message_type(self, x):
    self.has_server_message_type_ = 1
    self.server_message_type_ = x

  def clear_server_message_type(self):
    if self.has_server_message_type_:
      self.has_server_message_type_ = 0
      self.server_message_type_ = ""

  def has_server_message_type(self): return self.has_server_message_type_

  def client_initial_tokens(self): return self.client_initial_tokens_

  def set_client_initial_tokens(self, x):
    self.has_client_initial_tokens_ = 1
    self.client_initial_tokens_ = x

  def clear_client_initial_tokens(self):
    if self.has_client_initial_tokens_:
      self.has_client_initial_tokens_ = 0
      self.client_initial_tokens_ = 0

  def has_client_initial_tokens(self): return self.has_client_initial_tokens_

  def server_initial_tokens(self): return self.server_initial_tokens_

  def set_server_initial_tokens(self, x):
    self.has_server_initial_tokens_ = 1
    self.server_initial_tokens_ = x

  def clear_server_initial_tokens(self):
    if self.has_server_initial_tokens_:
      self.has_server_initial_tokens_ = 0
      self.server_initial_tokens_ = 0

  def has_server_initial_tokens(self): return self.has_server_initial_tokens_

  def token_unit(self): return self.token_unit_

  def set_token_unit(self, x):
    self.has_token_unit_ = 1
    self.token_unit_ = x

  def clear_token_unit(self):
    if self.has_token_unit_:
      self.has_token_unit_ = 0
      self.token_unit_ = ""

  def has_token_unit(self): return self.has_token_unit_

  def security_level(self): return self.security_level_

  def set_security_level(self, x):
    self.has_security_level_ = 1
    self.security_level_ = x

  def clear_security_level(self):
    if self.has_security_level_:
      self.has_security_level_ = 0
      self.security_level_ = ""

  def has_security_level(self): return self.has_security_level_

  def security_label(self): return self.security_label_

  def set_security_label(self, x):
    self.has_security_label_ = 1
    self.security_label_ = x

  def clear_security_label(self):
    if self.has_security_label_:
      self.has_security_label_ = 0
      self.security_label_ = ""

  def has_security_label(self): return self.has_security_label_

  def client_logging(self): return self.client_logging_

  def set_client_logging(self, x):
    self.has_client_logging_ = 1
    self.client_logging_ = x

  def clear_client_logging(self):
    if self.has_client_logging_:
      self.has_client_logging_ = 0
      self.client_logging_ = 0

  def has_client_logging(self): return self.has_client_logging_

  def server_logging(self): return self.server_logging_

  def set_server_logging(self, x):
    self.has_server_logging_ = 1
    self.server_logging_ = x

  def clear_server_logging(self):
    if self.has_server_logging_:
      self.has_server_logging_ = 0
      self.server_logging_ = 0

  def has_server_logging(self): return self.has_server_logging_

  def deadline(self): return self.deadline_

  def set_deadline(self, x):
    self.has_deadline_ = 1
    self.deadline_ = x

  def clear_deadline(self):
    if self.has_deadline_:
      self.has_deadline_ = 0
      self.deadline_ = 0.0

  def has_deadline(self): return self.has_deadline_

  def fail_fast(self): return self.fail_fast_

  def set_fail_fast(self, x):
    self.has_fail_fast_ = 1
    self.fail_fast_ = x

  def clear_fail_fast(self):
    if self.has_fail_fast_:
      self.has_fail_fast_ = 0
      self.fail_fast_ = 0

  def has_fail_fast(self): return self.has_fail_fast_

  def end_user_creds_requested(self): return self.end_user_creds_requested_

  def set_end_user_creds_requested(self, x):
    self.has_end_user_creds_requested_ = 1
    self.end_user_creds_requested_ = x

  def clear_end_user_creds_requested(self):
    if self.has_end_user_creds_requested_:
      self.has_end_user_creds_requested_ = 0
      self.end_user_creds_requested_ = 0

  def has_end_user_creds_requested(self): return self.has_end_user_creds_requested_

  def log_level(self): return self.log_level_

  def set_log_level(self, x):
    self.has_log_level_ = 1
    self.log_level_ = x

  def clear_log_level(self):
    if self.has_log_level_:
      self.has_log_level_ = 0
      self.log_level_ = ""

  def has_log_level(self): return self.has_log_level_


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_name()): self.set_name(x.name())
    if (x.has_client_message_type()): self.set_client_message_type(x.client_message_type())
    if (x.has_server_message_type()): self.set_server_message_type(x.server_message_type())
    if (x.has_client_initial_tokens()): self.set_client_initial_tokens(x.client_initial_tokens())
    if (x.has_server_initial_tokens()): self.set_server_initial_tokens(x.server_initial_tokens())
    if (x.has_token_unit()): self.set_token_unit(x.token_unit())
    if (x.has_security_level()): self.set_security_level(x.security_level())
    if (x.has_security_label()): self.set_security_label(x.security_label())
    if (x.has_client_logging()): self.set_client_logging(x.client_logging())
    if (x.has_server_logging()): self.set_server_logging(x.server_logging())
    if (x.has_deadline()): self.set_deadline(x.deadline())
    if (x.has_fail_fast()): self.set_fail_fast(x.fail_fast())
    if (x.has_end_user_creds_requested()): self.set_end_user_creds_requested(x.end_user_creds_requested())
    if (x.has_log_level()): self.set_log_level(x.log_level())

  def Equals(self, x):
    if x is self: return 1
    if self.has_name_ != x.has_name_: return 0
    if self.has_name_ and self.name_ != x.name_: return 0
    if self.has_client_message_type_ != x.has_client_message_type_: return 0
    if self.has_client_message_type_ and self.client_message_type_ != x.client_message_type_: return 0
    if self.has_server_message_type_ != x.has_server_message_type_: return 0
    if self.has_server_message_type_ and self.server_message_type_ != x.server_message_type_: return 0
    if self.has_client_initial_tokens_ != x.has_client_initial_tokens_: return 0
    if self.has_client_initial_tokens_ and self.client_initial_tokens_ != x.client_initial_tokens_: return 0
    if self.has_server_initial_tokens_ != x.has_server_initial_tokens_: return 0
    if self.has_server_initial_tokens_ and self.server_initial_tokens_ != x.server_initial_tokens_: return 0
    if self.has_token_unit_ != x.has_token_unit_: return 0
    if self.has_token_unit_ and self.token_unit_ != x.token_unit_: return 0
    if self.has_security_level_ != x.has_security_level_: return 0
    if self.has_security_level_ and self.security_level_ != x.security_level_: return 0
    if self.has_security_label_ != x.has_security_label_: return 0
    if self.has_security_label_ and self.security_label_ != x.security_label_: return 0
    if self.has_client_logging_ != x.has_client_logging_: return 0
    if self.has_client_logging_ and self.client_logging_ != x.client_logging_: return 0
    if self.has_server_logging_ != x.has_server_logging_: return 0
    if self.has_server_logging_ and self.server_logging_ != x.server_logging_: return 0
    if self.has_deadline_ != x.has_deadline_: return 0
    if self.has_deadline_ and self.deadline_ != x.deadline_: return 0
    if self.has_fail_fast_ != x.has_fail_fast_: return 0
    if self.has_fail_fast_ and self.fail_fast_ != x.fail_fast_: return 0
    if self.has_end_user_creds_requested_ != x.has_end_user_creds_requested_: return 0
    if self.has_end_user_creds_requested_ and self.end_user_creds_requested_ != x.end_user_creds_requested_: return 0
    if self.has_log_level_ != x.has_log_level_: return 0
    if self.has_log_level_ and self.log_level_ != x.log_level_: return 0
    return 1

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_name_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: name not set.')
    if (not self.has_client_message_type_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: client_message_type not set.')
    if (not self.has_server_message_type_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: server_message_type not set.')
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthString(len(self.name_))
    n += self.lengthString(len(self.client_message_type_))
    n += self.lengthString(len(self.server_message_type_))
    if (self.has_client_initial_tokens_): n += 2 + self.lengthVarInt64(self.client_initial_tokens_)
    if (self.has_server_initial_tokens_): n += 2 + self.lengthVarInt64(self.server_initial_tokens_)
    if (self.has_token_unit_): n += 2 + self.lengthString(len(self.token_unit_))
    if (self.has_security_level_): n += 2 + self.lengthString(len(self.security_level_))
    if (self.has_security_label_): n += 2 + self.lengthString(len(self.security_label_))
    if (self.has_client_logging_): n += 2 + self.lengthVarInt64(self.client_logging_)
    if (self.has_server_logging_): n += 2 + self.lengthVarInt64(self.server_logging_)
    if (self.has_deadline_): n += 10
    if (self.has_fail_fast_): n += 3
    if (self.has_end_user_creds_requested_): n += 3
    if (self.has_log_level_): n += 2 + self.lengthString(len(self.log_level_))
    return n + 6

  def ByteSizePartial(self):
    n = 0
    if (self.has_name_):
      n += 2
      n += self.lengthString(len(self.name_))
    if (self.has_client_message_type_):
      n += 2
      n += self.lengthString(len(self.client_message_type_))
    if (self.has_server_message_type_):
      n += 2
      n += self.lengthString(len(self.server_message_type_))
    if (self.has_client_initial_tokens_): n += 2 + self.lengthVarInt64(self.client_initial_tokens_)
    if (self.has_server_initial_tokens_): n += 2 + self.lengthVarInt64(self.server_initial_tokens_)
    if (self.has_token_unit_): n += 2 + self.lengthString(len(self.token_unit_))
    if (self.has_security_level_): n += 2 + self.lengthString(len(self.security_level_))
    if (self.has_security_label_): n += 2 + self.lengthString(len(self.security_label_))
    if (self.has_client_logging_): n += 2 + self.lengthVarInt64(self.client_logging_)
    if (self.has_server_logging_): n += 2 + self.lengthVarInt64(self.server_logging_)
    if (self.has_deadline_): n += 10
    if (self.has_fail_fast_): n += 3
    if (self.has_end_user_creds_requested_): n += 3
    if (self.has_log_level_): n += 2 + self.lengthString(len(self.log_level_))
    return n

  def Clear(self):
    self.clear_name()
    self.clear_client_message_type()
    self.clear_server_message_type()
    self.clear_client_initial_tokens()
    self.clear_server_initial_tokens()
    self.clear_token_unit()
    self.clear_security_level()
    self.clear_security_label()
    self.clear_client_logging()
    self.clear_server_logging()
    self.clear_deadline()
    self.clear_fail_fast()
    self.clear_end_user_creds_requested()
    self.clear_log_level()

  def OutputUnchecked(self, out):
    out.putVarInt32(178)
    out.putPrefixedString(self.name_)
    out.putVarInt32(186)
    out.putPrefixedString(self.client_message_type_)
    out.putVarInt32(194)
    out.putPrefixedString(self.server_message_type_)
    if (self.has_client_initial_tokens_):
      out.putVarInt32(200)
      out.putVarInt64(self.client_initial_tokens_)
    if (self.has_server_initial_tokens_):
      out.putVarInt32(208)
      out.putVarInt64(self.server_initial_tokens_)
    if (self.has_token_unit_):
      out.putVarInt32(218)
      out.putPrefixedString(self.token_unit_)
    if (self.has_security_level_):
      out.putVarInt32(226)
      out.putPrefixedString(self.security_level_)
    if (self.has_security_label_):
      out.putVarInt32(234)
      out.putPrefixedString(self.security_label_)
    if (self.has_client_logging_):
      out.putVarInt32(240)
      out.putVarInt32(self.client_logging_)
    if (self.has_server_logging_):
      out.putVarInt32(248)
      out.putVarInt32(self.server_logging_)
    if (self.has_deadline_):
      out.putVarInt32(257)
      out.putDouble(self.deadline_)
    if (self.has_fail_fast_):
      out.putVarInt32(264)
      out.putBoolean(self.fail_fast_)
    if (self.has_end_user_creds_requested_):
      out.putVarInt32(280)
      out.putBoolean(self.end_user_creds_requested_)
    if (self.has_log_level_):
      out.putVarInt32(298)
      out.putPrefixedString(self.log_level_)

  def OutputPartial(self, out):
    if (self.has_name_):
      out.putVarInt32(178)
      out.putPrefixedString(self.name_)
    if (self.has_client_message_type_):
      out.putVarInt32(186)
      out.putPrefixedString(self.client_message_type_)
    if (self.has_server_message_type_):
      out.putVarInt32(194)
      out.putPrefixedString(self.server_message_type_)
    if (self.has_client_initial_tokens_):
      out.putVarInt32(200)
      out.putVarInt64(self.client_initial_tokens_)
    if (self.has_server_initial_tokens_):
      out.putVarInt32(208)
      out.putVarInt64(self.server_initial_tokens_)
    if (self.has_token_unit_):
      out.putVarInt32(218)
      out.putPrefixedString(self.token_unit_)
    if (self.has_security_level_):
      out.putVarInt32(226)
      out.putPrefixedString(self.security_level_)
    if (self.has_security_label_):
      out.putVarInt32(234)
      out.putPrefixedString(self.security_label_)
    if (self.has_client_logging_):
      out.putVarInt32(240)
      out.putVarInt32(self.client_logging_)
    if (self.has_server_logging_):
      out.putVarInt32(248)
      out.putVarInt32(self.server_logging_)
    if (self.has_deadline_):
      out.putVarInt32(257)
      out.putDouble(self.deadline_)
    if (self.has_fail_fast_):
      out.putVarInt32(264)
      out.putBoolean(self.fail_fast_)
    if (self.has_end_user_creds_requested_):
      out.putVarInt32(280)
      out.putBoolean(self.end_user_creds_requested_)
    if (self.has_log_level_):
      out.putVarInt32(298)
      out.putPrefixedString(self.log_level_)

  def TryMerge(self, d):
    while 1:
      tt = d.getVarInt32()
      if tt == 172: break
      if tt == 178:
        self.set_name(d.getPrefixedString())
        continue
      if tt == 186:
        self.set_client_message_type(d.getPrefixedString())
        continue
      if tt == 194:
        self.set_server_message_type(d.getPrefixedString())
        continue
      if tt == 200:
        self.set_client_initial_tokens(d.getVarInt64())
        continue
      if tt == 208:
        self.set_server_initial_tokens(d.getVarInt64())
        continue
      if tt == 218:
        self.set_token_unit(d.getPrefixedString())
        continue
      if tt == 226:
        self.set_security_level(d.getPrefixedString())
        continue
      if tt == 234:
        self.set_security_label(d.getPrefixedString())
        continue
      if tt == 240:
        self.set_client_logging(d.getVarInt32())
        continue
      if tt == 248:
        self.set_server_logging(d.getVarInt32())
        continue
      if tt == 257:
        self.set_deadline(d.getDouble())
        continue
      if tt == 264:
        self.set_fail_fast(d.getBoolean())
        continue
      if tt == 280:
        self.set_end_user_creds_requested(d.getBoolean())
        continue
      if tt == 298:
        self.set_log_level(d.getPrefixedString())
        continue
      # tag 0 is special: it's used to indicate an error.
      # so if we see it we raise an exception.
      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
      d.skipData(tt)


  def __str__(self, prefix="", printElemNumber=0):
    res=""
    if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_))
    if self.has_client_message_type_: res+=prefix+("client_message_type: %s\n" % self.DebugFormatString(self.client_message_type_))
    if self.has_server_message_type_: res+=prefix+("server_message_type: %s\n" % self.DebugFormatString(self.server_message_type_))
    if self.has_client_initial_tokens_: res+=prefix+("client_initial_tokens: %s\n" % self.DebugFormatInt64(self.client_initial_tokens_))
    if self.has_server_initial_tokens_: res+=prefix+("server_initial_tokens: %s\n" % self.DebugFormatInt64(self.server_initial_tokens_))
    if self.has_token_unit_: res+=prefix+("token_unit: %s\n" % self.DebugFormatString(self.token_unit_))
    if self.has_security_level_: res+=prefix+("security_level: %s\n" % self.DebugFormatString(self.security_level_))
    if self.has_security_label_: res+=prefix+("security_label: %s\n" % self.DebugFormatString(self.security_label_))
    if self.has_client_logging_: res+=prefix+("client_logging: %s\n" % self.DebugFormatInt32(self.client_logging_))
    if self.has_server_logging_: res+=prefix+("server_logging: %s\n" % self.DebugFormatInt32(self.server_logging_))
    if self.has_deadline_: res+=prefix+("deadline: %s\n" % self.DebugFormat(self.deadline_))
    if self.has_fail_fast_: res+=prefix+("fail_fast: %s\n" % self.DebugFormatBool(self.fail_fast_))
    if self.has_end_user_creds_requested_: res+=prefix+("end_user_creds_requested: %s\n" % self.DebugFormatBool(self.end_user_creds_requested_))
    if self.has_log_level_: res+=prefix+("log_level: %s\n" % self.DebugFormatString(self.log_level_))
    return res

class RPC_ServiceDescriptor(ProtocolBuffer.ProtocolMessage):
  has_filename_ = 0
  filename_ = ""
  has_name_ = 0
  name_ = ""
  has_full_name_ = 0
  full_name_ = ""
  has_failure_detection_delay_ = 0
  failure_detection_delay_ = 0.0
  has_multicast_stub_ = 0
  multicast_stub_ = 0

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

  def filename(self): return self.filename_

  def set_filename(self, x):
    self.has_filename_ = 1
    self.filename_ = x

  def clear_filename(self):
    if self.has_filename_:
      self.has_filename_ = 0
      self.filename_ = ""

  def has_filename(self): return self.has_filename_

  def name(self): return self.name_

  def set_name(self, x):
    self.has_name_ = 1
    self.name_ = x

  def clear_name(self):
    if self.has_name_:
      self.has_name_ = 0
      self.name_ = ""

  def has_name(self): return self.has_name_

  def full_name(self): return self.full_name_

  def set_full_name(self, x):
    self.has_full_name_ = 1
    self.full_name_ = x

  def clear_full_name(self):
    if self.has_full_name_:
      self.has_full_name_ = 0
      self.full_name_ = ""

  def has_full_name(self): return self.has_full_name_

  def failure_detection_delay(self): return self.failure_detection_delay_

  def set_failure_detection_delay(self, x):
    self.has_failure_detection_delay_ = 1
    self.failure_detection_delay_ = x

  def clear_failure_detection_delay(self):
    if self.has_failure_detection_delay_:
      self.has_failure_detection_delay_ = 0
      self.failure_detection_delay_ = 0.0

  def has_failure_detection_delay(self): return self.has_failure_detection_delay_

  def multicast_stub(self): return self.multicast_stub_

  def set_multicast_stub(self, x):
    self.has_multicast_stub_ = 1
    self.multicast_stub_ = x

  def clear_multicast_stub(self):
    if self.has_multicast_stub_:
      self.has_multicast_stub_ = 0
      self.multicast_stub_ = 0

  def has_multicast_stub(self): return self.has_multicast_stub_

  def method_size(self): return len(self.method_)
  def method_list(self): return self.method_

  def method(self, i):
    return self.method_[i]

  def mutable_method(self, i):
    return self.method_[i]

  def add_method(self):
    x = RPC_ServiceDescriptor_Method()
    self.method_.append(x)
    return x

  def clear_method(self):
    self.method_ = []
  def stream_size(self): return len(self.stream_)
  def stream_list(self): return self.stream_

  def stream(self, i):
    return self.stream_[i]

  def mutable_stream(self, i):
    return self.stream_[i]

  def add_stream(self):
    x = RPC_ServiceDescriptor_Stream()
    self.stream_.append(x)
    return x

  def clear_stream(self):
    self.stream_ = []

  def MergeFrom(self, x):
    assert x is not self
    if (x.has_filename()): self.set_filename(x.filename())
    if (x.has_name()): self.set_name(x.name())
    if (x.has_full_name()): self.set_full_name(x.full_name())
    if (x.has_failure_detection_delay()): self.set_failure_detection_delay(x.failure_detection_delay())
    if (x.has_multicast_stub()): self.set_multicast_stub(x.multicast_stub())
    for i in xrange(x.method_size()): self.add_method().CopyFrom(x.method(i))
    for i in xrange(x.stream_size()): self.add_stream().CopyFrom(x.stream(i))

  if _net_proto___parse__python is not None:
    def _CMergeFromString(self, s):
      _net_proto___parse__python.MergeFromString(self, 'RPC_ServiceDescriptor', s)

  if _net_proto___parse__python is not None:
    def _CEncode(self):
      return _net_proto___parse__python.Encode(self, 'RPC_ServiceDescriptor')

  if _net_proto___parse__python is not None:
    def _CEncodePartial(self):
      return _net_proto___parse__python.EncodePartial(self, 'RPC_ServiceDescriptor')

  if _net_proto___parse__python is not None:
    def _CToASCII(self, output_format):
      return _net_proto___parse__python.ToASCII(self, 'RPC_ServiceDescriptor', output_format)


  if _net_proto___parse__python is not None:
    def ParseASCII(self, s):
      _net_proto___parse__python.ParseASCII(self, 'RPC_ServiceDescriptor', s)


  if _net_proto___parse__python is not None:
    def ParseASCIIIgnoreUnknown(self, s):
      _net_proto___parse__python.ParseASCIIIgnoreUnknown(self, 'RPC_ServiceDescriptor', s)


  def Equals(self, x):
    if x is self: return 1
    if self.has_filename_ != x.has_filename_: return 0
    if self.has_filename_ and self.filename_ != x.filename_: return 0
    if self.has_name_ != x.has_name_: return 0
    if self.has_name_ and self.name_ != x.name_: return 0
    if self.has_full_name_ != x.has_full_name_: return 0
    if self.has_full_name_ and self.full_name_ != x.full_name_: return 0
    if self.has_failure_detection_delay_ != x.has_failure_detection_delay_: return 0
    if self.has_failure_detection_delay_ and self.failure_detection_delay_ != x.failure_detection_delay_: return 0
    if self.has_multicast_stub_ != x.has_multicast_stub_: return 0
    if self.has_multicast_stub_ and self.multicast_stub_ != x.multicast_stub_: return 0
    if len(self.method_) != len(x.method_): return 0
    for e1, e2 in zip(self.method_, x.method_):
      if e1 != e2: return 0
    if len(self.stream_) != len(x.stream_): return 0
    for e1, e2 in zip(self.stream_, x.stream_):
      if e1 != e2: return 0
    return 1

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_filename_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: filename not set.')
    if (not self.has_name_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: name not set.')
    for p in self.method_:
      if not p.IsInitialized(debug_strs): initialized=0
    for p in self.stream_:
      if not p.IsInitialized(debug_strs): initialized=0
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthString(len(self.filename_))
    n += self.lengthString(len(self.name_))
    if (self.has_full_name_): n += 2 + self.lengthString(len(self.full_name_))
    if (self.has_failure_detection_delay_): n += 10
    if (self.has_multicast_stub_): n += 3
    n += 2 * len(self.method_)
    for i in xrange(len(self.method_)): n += self.method_[i].ByteSize()
    n += 4 * len(self.stream_)
    for i in xrange(len(self.stream_)): n += self.stream_[i].ByteSize()
    return n + 2

  def ByteSizePartial(self):
    n = 0
    if (self.has_filename_):
      n += 1
      n += self.lengthString(len(self.filename_))
    if (self.has_name_):
      n += 1
      n += self.lengthString(len(self.name_))
    if (self.has_full_name_): n += 2 + self.lengthString(len(self.full_name_))
    if (self.has_failure_detection_delay_): n += 10
    if (self.has_multicast_stub_): n += 3
    n += 2 * len(self.method_)
    for i in xrange(len(self.method_)): n += self.method_[i].ByteSizePartial()
    n += 4 * len(self.stream_)
    for i in xrange(len(self.stream_)): n += self.stream_[i].ByteSizePartial()
    return n

  def Clear(self):
    self.clear_filename()
    self.clear_name()
    self.clear_full_name()
    self.clear_failure_detection_delay()
    self.clear_multicast_stub()
    self.clear_method()
    self.clear_stream()

  def OutputUnchecked(self, out):
    out.putVarInt32(10)
    out.putPrefixedString(self.filename_)
    out.putVarInt32(18)
    out.putPrefixedString(self.name_)
    for i in xrange(len(self.method_)):
      out.putVarInt32(27)
      self.method_[i].OutputUnchecked(out)
      out.putVarInt32(28)
    if (self.has_failure_detection_delay_):
      out.putVarInt32(129)
      out.putDouble(self.failure_detection_delay_)
    if (self.has_full_name_):
      out.putVarInt32(146)
      out.putPrefixedString(self.full_name_)
    if (self.has_multicast_stub_):
      out.putVarInt32(160)
      out.putBoolean(self.multicast_stub_)
    for i in xrange(len(self.stream_)):
      out.putVarInt32(171)
      self.stream_[i].OutputUnchecked(out)
      out.putVarInt32(172)

  def OutputPartial(self, out):
    if (self.has_filename_):
      out.putVarInt32(10)
      out.putPrefixedString(self.filename_)
    if (self.has_name_):
      out.putVarInt32(18)
      out.putPrefixedString(self.name_)
    for i in xrange(len(self.method_)):
      out.putVarInt32(27)
      self.method_[i].OutputPartial(out)
      out.putVarInt32(28)
    if (self.has_failure_detection_delay_):
      out.putVarInt32(129)
      out.putDouble(self.failure_detection_delay_)
    if (self.has_full_name_):
      out.putVarInt32(146)
      out.putPrefixedString(self.full_name_)
    if (self.has_multicast_stub_):
      out.putVarInt32(160)
      out.putBoolean(self.multicast_stub_)
    for i in xrange(len(self.stream_)):
      out.putVarInt32(171)
      self.stream_[i].OutputPartial(out)
      out.putVarInt32(172)

  def TryMerge(self, d):
    while d.avail() > 0:
      tt = d.getVarInt32()
      if tt == 10:
        self.set_filename(d.getPrefixedString())
        continue
      if tt == 18:
        self.set_name(d.getPrefixedString())
        continue
      if tt == 27:
        self.add_method().TryMerge(d)
        continue
      if tt == 129:
        self.set_failure_detection_delay(d.getDouble())
        continue
      if tt == 146:
        self.set_full_name(d.getPrefixedString())
        continue
      if tt == 160:
        self.set_multicast_stub(d.getBoolean())
        continue
      if tt == 171:
        self.add_stream().TryMerge(d)
        continue
      # tag 0 is special: it's used to indicate an error.
      # so if we see it we raise an exception.
      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
      d.skipData(tt)


  def __str__(self, prefix="", printElemNumber=0):
    res=""
    if self.has_filename_: res+=prefix+("filename: %s\n" % self.DebugFormatString(self.filename_))
    if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_))
    if self.has_full_name_: res+=prefix+("full_name: %s\n" % self.DebugFormatString(self.full_name_))
    if self.has_failure_detection_delay_: res+=prefix+("failure_detection_delay: %s\n" % self.DebugFormat(self.failure_detection_delay_))
    if self.has_multicast_stub_: res+=prefix+("multicast_stub: %s\n" % self.DebugFormatBool(self.multicast_stub_))
    cnt=0
    for e in self.method_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("Method%s {\n" % elm)
      res+=e.__str__(prefix + "  ", printElemNumber)
      res+=prefix+"}\n"
      cnt+=1
    cnt=0
    for e in self.stream_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("Stream%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)])

  kfilename = 1
  kname = 2
  kfull_name = 18
  kfailure_detection_delay = 16
  kmulticast_stub = 20
  kMethodGroup = 3
  kMethodname = 4
  kMethodargument_type = 5
  kMethodresult_type = 6
  kMethodstream_type = 14
  kMethodprotocol = 7
  kMethoddeadline = 8
  kMethodduplicate_suppression = 9
  kMethodfail_fast = 10
  kMethodend_user_creds_requested = 34
  kMethodclient_logging = 11
  kMethodserver_logging = 12
  kMethodsecurity_level = 13
  kMethodsecurity_label = 19
  kMethodresponse_format = 15
  kMethodrequest_format = 17
  kMethodlog_level = 36
  kStreamGroup = 21
  kStreamname = 22
  kStreamclient_message_type = 23
  kStreamserver_message_type = 24
  kStreamclient_initial_tokens = 25
  kStreamserver_initial_tokens = 26
  kStreamtoken_unit = 27
  kStreamsecurity_level = 28
  kStreamsecurity_label = 29
  kStreamclient_logging = 30
  kStreamserver_logging = 31
  kStreamdeadline = 32
  kStreamfail_fast = 33
  kStreamend_user_creds_requested = 35
  kStreamlog_level = 37

  _TEXT = _BuildTagLookupTable({
    0: "ErrorCode",
    1: "filename",
    2: "name",
    3: "Method",
    4: "name",
    5: "argument_type",
    6: "result_type",
    7: "protocol",
    8: "deadline",
    9: "duplicate_suppression",
    10: "fail_fast",
    11: "client_logging",
    12: "server_logging",
    13: "security_level",
    14: "stream_type",
    15: "response_format",
    16: "failure_detection_delay",
    17: "request_format",
    18: "full_name",
    19: "security_label",
    20: "multicast_stub",
    21: "Stream",
    22: "name",
    23: "client_message_type",
    24: "server_message_type",
    25: "client_initial_tokens",
    26: "server_initial_tokens",
    27: "token_unit",
    28: "security_level",
    29: "security_label",
    30: "client_logging",
    31: "server_logging",
    32: "deadline",
    33: "fail_fast",
    34: "end_user_creds_requested",
    35: "end_user_creds_requested",
    36: "log_level",
    37: "log_level",
  }, 37)

  _TYPES = _BuildTagLookupTable({
    0: ProtocolBuffer.Encoder.NUMERIC,
    1: ProtocolBuffer.Encoder.STRING,
    2: ProtocolBuffer.Encoder.STRING,
    3: ProtocolBuffer.Encoder.STARTGROUP,
    4: ProtocolBuffer.Encoder.STRING,
    5: ProtocolBuffer.Encoder.STRING,
    6: ProtocolBuffer.Encoder.STRING,
    7: ProtocolBuffer.Encoder.STRING,
    8: ProtocolBuffer.Encoder.DOUBLE,
    9: ProtocolBuffer.Encoder.NUMERIC,
    10: ProtocolBuffer.Encoder.NUMERIC,
    11: ProtocolBuffer.Encoder.NUMERIC,
    12: ProtocolBuffer.Encoder.NUMERIC,
    13: ProtocolBuffer.Encoder.STRING,
    14: ProtocolBuffer.Encoder.STRING,
    15: ProtocolBuffer.Encoder.STRING,
    16: ProtocolBuffer.Encoder.DOUBLE,
    17: ProtocolBuffer.Encoder.STRING,
    18: ProtocolBuffer.Encoder.STRING,
    19: ProtocolBuffer.Encoder.STRING,
    20: ProtocolBuffer.Encoder.NUMERIC,
    21: ProtocolBuffer.Encoder.STARTGROUP,
    22: ProtocolBuffer.Encoder.STRING,
    23: ProtocolBuffer.Encoder.STRING,
    24: ProtocolBuffer.Encoder.STRING,
    25: ProtocolBuffer.Encoder.NUMERIC,
    26: ProtocolBuffer.Encoder.NUMERIC,
    27: ProtocolBuffer.Encoder.STRING,
    28: ProtocolBuffer.Encoder.STRING,
    29: ProtocolBuffer.Encoder.STRING,
    30: ProtocolBuffer.Encoder.NUMERIC,
    31: ProtocolBuffer.Encoder.NUMERIC,
    32: ProtocolBuffer.Encoder.DOUBLE,
    33: ProtocolBuffer.Encoder.NUMERIC,
    34: ProtocolBuffer.Encoder.NUMERIC,
    35: ProtocolBuffer.Encoder.NUMERIC,
    36: ProtocolBuffer.Encoder.STRING,
    37: ProtocolBuffer.Encoder.STRING,
  }, 37, ProtocolBuffer.Encoder.MAX_TYPE)

  # stylesheet for XML output
  _STYLE = \
   """"""
  _STYLE_CONTENT_TYPE = \
   """"""
  _PROTO_DESCRIPTOR_NAME = 'RPC_ServiceDescriptor'
  _SERIALIZED_DESCRIPTOR = array.array('B')
  _SERIALIZED_DESCRIPTOR.fromstring(base64.decodestring("WhxuZXQvcHJvdG8vcHJvdG9jb2x0eXBlLnByb3RvChVSUENfU2VydmljZURlc2NyaXB0b3ITGghmaWxlbmFtZSABKAIwCTgCFBMaBG5hbWUgAigCMAk4AhQTGglmdWxsX25hbWUgEigCMAk4ARQTGhdmYWlsdXJlX2RldGVjdGlvbl9kZWxheSAQKAEwATgBFBMaDm11bHRpY2FzdF9zdHViIBQoADAIOAEUExoGTWV0aG9kIAMoAzAKOAMUExoLTWV0aG9kLm5hbWUgBCgCMAk4AmAFFBMaFE1ldGhvZC5hcmd1bWVudF90eXBlIAUoAjAJOAJgBRQTGhJNZXRob2QucmVzdWx0X3R5cGUgBigCMAk4AmAFFBMaEk1ldGhvZC5zdHJlYW1fdHlwZSAOKAIwCTgBYAUUExoPTWV0aG9kLnByb3RvY29sIAcoAjAJOAFgBRQTGg9NZXRob2QuZGVhZGxpbmUgCCgBMAE4AWAFFBMaHE1ldGhvZC5kdXBsaWNhdGVfc3VwcHJlc3Npb24gCSgAMAg4AWAFFBMaEE1ldGhvZC5mYWlsX2Zhc3QgCigAMAg4AWAFFBMaH01ldGhvZC5lbmRfdXNlcl9jcmVkc19yZXF1ZXN0ZWQgIigAMAg4AWAFFBMaFU1ldGhvZC5jbGllbnRfbG9nZ2luZyALKAAwBTgBYAUUExoVTWV0aG9kLnNlcnZlcl9sb2dnaW5nIAwoADAFOAFgBRQTGhVNZXRob2Quc2VjdXJpdHlfbGV2ZWwgDSgCMAk4AWAFFBMaFU1ldGhvZC5zZWN1cml0eV9sYWJlbCATKAIwCTgBYAUUExoWTWV0aG9kLnJlc3BvbnNlX2Zvcm1hdCAPKAIwCTgBYAUUExoVTWV0aG9kLnJlcXVlc3RfZm9ybWF0IBEoAjAJOAFgBRQTGhBNZXRob2QubG9nX2xldmVsICQoAjAJOAFgBRQTGgZTdHJlYW0gFSgDMAo4AxQTGgtTdHJlYW0ubmFtZSAWKAIwCTgCYBYUExoaU3RyZWFtLmNsaWVudF9tZXNzYWdlX3R5cGUgFygCMAk4AmAWFBMaGlN0cmVhbS5zZXJ2ZXJfbWVzc2FnZV90eXBlIBgoAjAJOAJgFhQTGhxTdHJlYW0uY2xpZW50X2luaXRpYWxfdG9rZW5zIBkoADADOAFgFhQTGhxTdHJlYW0uc2VydmVyX2luaXRpYWxfdG9rZW5zIBooADADOAFgFhQTGhFTdHJlYW0udG9rZW5fdW5pdCAbKAIwCTgBYBYUExoVU3RyZWFtLnNlY3VyaXR5X2xldmVsIBwoAjAJOAFgFhQTGhVTdHJlYW0uc2VjdXJpdHlfbGFiZWwgHSgCMAk4AWAWFBMaFVN0cmVhbS5jbGllbnRfbG9nZ2luZyAeKAAwBTgBYBYUExoVU3RyZWFtLnNlcnZlcl9sb2dnaW5nIB8oADAFOAFgFhQTGg9TdHJlYW0uZGVhZGxpbmUgICgBMAE4AWAWFBMaEFN0cmVhbS5mYWlsX2Zhc3QgISgAMAg4AWAWFBMaH1N0cmVhbS5lbmRfdXNlcl9jcmVkc19yZXF1ZXN0ZWQgIygAMAg4AWAWFBMaEFN0cmVhbS5sb2dfbGV2ZWwgJSgCMAk4AWAWFMIBElByb3RvY29sRGVzY3JpcHRvcg=="))
  if _net_proto___parse__python is not None:
    _net_proto___parse__python.RegisterType(
        _SERIALIZED_DESCRIPTOR.tostring())

if _extension_runtime:
  pass

__all__ = ['ProtocolDescriptor','ProtocolDescriptor_EnumTypeTag','ProtocolDescriptor_TagOption','ProtocolDescriptor_Tag','ProtocolDescriptor_EnumType','ProtocolFileDescriptor','RPC_ServiceDescriptor','RPC_ServiceDescriptor_Method','RPC_ServiceDescriptor_Stream']
