Exemplo n.º 1
0
class MicroRepmap(ProtocolBuffer.ProtocolMessage):
    def __init__(self, contents=None):
        self.urlfp96_deprecated_ = ""
        self.url_ = ""
        self.timestamp_ = 0
        self.linkinfo_ = []
        self.has_urlfp96_deprecated_ = 0
        self.has_url_ = 0
        self.has_timestamp_ = 0
        if contents is not None: self.MergeFromString(contents)

    def urlfp96_deprecated(self):
        return self.urlfp96_deprecated_

    def set_urlfp96_deprecated(self, x):
        self.has_urlfp96_deprecated_ = 1
        self.urlfp96_deprecated_ = x

    def clear_urlfp96_deprecated(self):
        self.has_urlfp96_deprecated_ = 0
        self.urlfp96_deprecated_ = ""

    def has_urlfp96_deprecated(self):
        return self.has_urlfp96_deprecated_

    def url(self):
        return self.url_

    def set_url(self, x):
        self.has_url_ = 1
        self.url_ = x

    def clear_url(self):
        self.has_url_ = 0
        self.url_ = ""

    def has_url(self):
        return self.has_url_

    def timestamp(self):
        return self.timestamp_

    def set_timestamp(self, x):
        self.has_timestamp_ = 1
        self.timestamp_ = x

    def clear_timestamp(self):
        self.has_timestamp_ = 0
        self.timestamp_ = 0

    def has_timestamp(self):
        return self.has_timestamp_

    def linkinfo_size(self):
        return len(self.linkinfo_)

    def linkinfo_list(self):
        return self.linkinfo_

    def linkinfo(self, i):
        return self.linkinfo_[i]

    def mutable_linkinfo(self, i):
        return self.linkinfo_[i]

    def add_linkinfo(self):
        x = MicroRepmap_LinkInfo()
        self.linkinfo_.append(x)
        return x

    def clear_linkinfo(self):
        self.linkinfo_ = []

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_urlfp96_deprecated()):
            self.set_urlfp96_deprecated(x.urlfp96_deprecated())
        if (x.has_url()): self.set_url(x.url())
        if (x.has_timestamp()): self.set_timestamp(x.timestamp())
        for i in xrange(x.linkinfo_size()):
            self.add_linkinfo().CopyFrom(x.linkinfo(i))

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(
            self, 'repository_updater.MicroRepmap', s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(
            self, 'repository_updater.MicroRepmap')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(
            self, 'repository_updater.MicroRepmap', output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(
            self, 'repository_updater.MicroRepmap', s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'repository_updater.MicroRepmap', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_urlfp96_deprecated_ != x.has_urlfp96_deprecated_: return 0
        if self.has_urlfp96_deprecated_ and self.urlfp96_deprecated_ != x.urlfp96_deprecated_:
            return 0
        if self.has_url_ != x.has_url_: return 0
        if self.has_url_ and self.url_ != x.url_: return 0
        if self.has_timestamp_ != x.has_timestamp_: return 0
        if self.has_timestamp_ and self.timestamp_ != x.timestamp_: return 0
        if len(self.linkinfo_) != len(x.linkinfo_): return 0
        for e1, e2 in zip(self.linkinfo_, x.linkinfo_):
            if e1 != e2: return 0
        return 1

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        if (not self.has_timestamp_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: timestamp not set.')
        for i in xrange(len(self.linkinfo_)):
            if (not self.linkinfo_[i].IsInitialized(debug_strs)):
                initialized = 0
        return initialized

    def ByteSize(self):
        n = 0
        if (self.has_urlfp96_deprecated_):
            n += 1 + self.lengthString(len(self.urlfp96_deprecated_))
        if (self.has_url_): n += 1 + self.lengthString(len(self.url_))
        n += self.lengthVarInt64(self.timestamp_)
        n += 2 * len(self.linkinfo_)
        for i in xrange(len(self.linkinfo_)):
            n += self.linkinfo_[i].ByteSize()
        return n + 1

    def Clear(self):
        self.clear_urlfp96_deprecated()
        self.clear_url()
        self.clear_timestamp()
        self.clear_linkinfo()

    def OutputUnchecked(self, out):
        out.putVarInt32(8)
        out.putVarInt32(self.timestamp_)
        for i in xrange(len(self.linkinfo_)):
            out.putVarInt32(19)
            self.linkinfo_[i].OutputUnchecked(out)
            out.putVarInt32(20)
        if (self.has_urlfp96_deprecated_):
            out.putVarInt32(42)
            out.putPrefixedString(self.urlfp96_deprecated_)
        if (self.has_url_):
            out.putVarInt32(50)
            out.putPrefixedString(self.url_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 8:
                self.set_timestamp(d.getVarInt32())
                continue
            if tt == 19:
                self.add_linkinfo().TryMerge(d)
                continue
            if tt == 42:
                self.set_urlfp96_deprecated(d.getPrefixedString())
                continue
            if tt == 50:
                self.set_url(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_urlfp96_deprecated_:
            res += prefix + ("UrlFp96_DEPRECATED: %s\n" %
                             self.DebugFormatString(self.urlfp96_deprecated_))
        if self.has_url_:
            res += prefix + ("Url: %s\n" % self.DebugFormatString(self.url_))
        if self.has_timestamp_:
            res += prefix + ("TimeStamp: %s\n" %
                             self.DebugFormatInt32(self.timestamp_))
        cnt = 0
        for e in self.linkinfo_:
            elm = ""
            if printElemNumber: elm = "(%d)" % cnt
            res += prefix + ("LinkInfo%s {\n" % elm)
            res += e.__str__(prefix + "  ", printElemNumber)
            res += prefix + "}\n"
            cnt += 1
        return res

    kUrlFp96_DEPRECATED = 5
    kUrl = 6
    kTimeStamp = 1
    kLinkInfoGroup = 2
    kLinkInfoUrl = 3
    kLinkInfoRepresentativeUrlFp96 = 4

    _TEXT = (
        "ErrorCode",  #   0
        "TimeStamp",  #   1
        "LinkInfo",  #   2
        "Url",  #   3
        "RepresentativeUrlFp96",  #   4
        "UrlFp96_DEPRECATED",  #   5
        "Url",  #   6
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.NUMERIC,  #   1
        ProtocolBuffer.Encoder.STARTGROUP,  #   2
        ProtocolBuffer.Encoder.STRING,  #   3
        ProtocolBuffer.Encoder.STRING,  #   4
        ProtocolBuffer.Encoder.STRING,  #   5
        ProtocolBuffer.Encoder.STRING,  #   6
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x25,
        0x72,
        0x65,
        0x70,
        0x6f,
        0x73,
        0x69,
        0x74,
        0x6f,
        0x72,
        0x79,
        0x2f,
        0x75,
        0x70,
        0x64,
        0x61,
        0x74,
        0x65,
        0x72,
        0x2f,
        0x70,
        0x69,
        0x70,
        0x65,
        0x6c,
        0x69,
        0x6e,
        0x65,
        0x69,
        0x6e,
        0x66,
        0x6f,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x1e,
        0x72,
        0x65,
        0x70,
        0x6f,
        0x73,
        0x69,
        0x74,
        0x6f,
        0x72,
        0x79,
        0x5f,
        0x75,
        0x70,
        0x64,
        0x61,
        0x74,
        0x65,
        0x72,
        0x2e,
        0x4d,
        0x69,
        0x63,
        0x72,
        0x6f,
        0x52,
        0x65,
        0x70,
        0x6d,
        0x61,
        0x70,
        0x13,
        0x1a,
        0x12,
        0x55,
        0x72,
        0x6c,
        0x46,
        0x70,
        0x39,
        0x36,
        0x5f,
        0x44,
        0x45,
        0x50,
        0x52,
        0x45,
        0x43,
        0x41,
        0x54,
        0x45,
        0x44,
        0x20,
        0x05,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x03,
        0x55,
        0x72,
        0x6c,
        0x20,
        0x06,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x09,
        0x54,
        0x69,
        0x6d,
        0x65,
        0x53,
        0x74,
        0x61,
        0x6d,
        0x70,
        0x20,
        0x01,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x08,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x49,
        0x6e,
        0x66,
        0x6f,
        0x20,
        0x02,
        0x28,
        0x03,
        0x30,
        0x0a,
        0x38,
        0x03,
        0x14,
        0x13,
        0x1a,
        0x0c,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x49,
        0x6e,
        0x66,
        0x6f,
        0x2e,
        0x55,
        0x72,
        0x6c,
        0x20,
        0x03,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x02,
        0x60,
        0x03,
        0x14,
        0x13,
        0x1a,
        0x1e,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x49,
        0x6e,
        0x66,
        0x6f,
        0x2e,
        0x52,
        0x65,
        0x70,
        0x72,
        0x65,
        0x73,
        0x65,
        0x6e,
        0x74,
        0x61,
        0x74,
        0x69,
        0x76,
        0x65,
        0x55,
        0x72,
        0x6c,
        0x46,
        0x70,
        0x39,
        0x36,
        0x20,
        0x04,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x02,
        0x60,
        0x03,
        0x14,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 2
0
class GFS_SuperBlock(ProtocolBuffer.ProtocolMessage):

    BASE = 0
    ARCHIVAL = 1
    CURRENT = 0

    _Version_NAMES = {
        0: "BASE",
        1: "ARCHIVAL",
        0: "CURRENT",
    }

    def Version_Name(cls, x):
        return cls._Version_NAMES.get(x, "")

    Version_Name = classmethod(Version_Name)

    def __init__(self, contents=None):
        self.version_ = 0
        self.cellname_ = ""
        self.last_master_ = ""
        self.logical_timestamp_ = 0
        self.replicas_ = []
        self.snapshot_serial_ = 0
        self.delta_serial_ = 0
        self.primary_rev_number_ = 0
        self.chunkservers_ = []
        self.old_primaries_ = []
        self.has_version_ = 0
        self.has_cellname_ = 0
        self.has_last_master_ = 0
        self.has_logical_timestamp_ = 0
        self.has_snapshot_serial_ = 0
        self.has_delta_serial_ = 0
        self.has_primary_rev_number_ = 0
        if contents is not None: self.MergeFromString(contents)

    def version(self):
        return self.version_

    def set_version(self, x):
        self.has_version_ = 1
        self.version_ = x

    def clear_version(self):
        self.has_version_ = 0
        self.version_ = 0

    def has_version(self):
        return self.has_version_

    def cellname(self):
        return self.cellname_

    def set_cellname(self, x):
        self.has_cellname_ = 1
        self.cellname_ = x

    def clear_cellname(self):
        self.has_cellname_ = 0
        self.cellname_ = ""

    def has_cellname(self):
        return self.has_cellname_

    def last_master(self):
        return self.last_master_

    def set_last_master(self, x):
        self.has_last_master_ = 1
        self.last_master_ = x

    def clear_last_master(self):
        self.has_last_master_ = 0
        self.last_master_ = ""

    def has_last_master(self):
        return self.has_last_master_

    def logical_timestamp(self):
        return self.logical_timestamp_

    def set_logical_timestamp(self, x):
        self.has_logical_timestamp_ = 1
        self.logical_timestamp_ = x

    def clear_logical_timestamp(self):
        self.has_logical_timestamp_ = 0
        self.logical_timestamp_ = 0

    def has_logical_timestamp(self):
        return self.has_logical_timestamp_

    def replicas_size(self):
        return len(self.replicas_)

    def replicas_list(self):
        return self.replicas_

    def replicas(self, i):
        return self.replicas_[i]

    def mutable_replicas(self, i):
        return self.replicas_[i]

    def add_replicas(self):
        x = GFS_ReplicaInfo()
        self.replicas_.append(x)
        return x

    def clear_replicas(self):
        self.replicas_ = []

    def snapshot_serial(self):
        return self.snapshot_serial_

    def set_snapshot_serial(self, x):
        self.has_snapshot_serial_ = 1
        self.snapshot_serial_ = x

    def clear_snapshot_serial(self):
        self.has_snapshot_serial_ = 0
        self.snapshot_serial_ = 0

    def has_snapshot_serial(self):
        return self.has_snapshot_serial_

    def delta_serial(self):
        return self.delta_serial_

    def set_delta_serial(self, x):
        self.has_delta_serial_ = 1
        self.delta_serial_ = x

    def clear_delta_serial(self):
        self.has_delta_serial_ = 0
        self.delta_serial_ = 0

    def has_delta_serial(self):
        return self.has_delta_serial_

    def primary_rev_number(self):
        return self.primary_rev_number_

    def set_primary_rev_number(self, x):
        self.has_primary_rev_number_ = 1
        self.primary_rev_number_ = x

    def clear_primary_rev_number(self):
        self.has_primary_rev_number_ = 0
        self.primary_rev_number_ = 0

    def has_primary_rev_number(self):
        return self.has_primary_rev_number_

    def chunkservers_size(self):
        return len(self.chunkservers_)

    def chunkservers_list(self):
        return self.chunkservers_

    def chunkservers(self, i):
        return self.chunkservers_[i]

    def set_chunkservers(self, i, x):
        self.chunkservers_[i] = x

    def add_chunkservers(self, x):
        self.chunkservers_.append(x)

    def clear_chunkservers(self):
        self.chunkservers_ = []

    def old_primaries_size(self):
        return len(self.old_primaries_)

    def old_primaries_list(self):
        return self.old_primaries_

    def old_primaries(self, i):
        return self.old_primaries_[i]

    def mutable_old_primaries(self, i):
        return self.old_primaries_[i]

    def add_old_primaries(self):
        x = GFS_PrimaryInfo()
        self.old_primaries_.append(x)
        return x

    def clear_old_primaries(self):
        self.old_primaries_ = []

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_version()): self.set_version(x.version())
        if (x.has_cellname()): self.set_cellname(x.cellname())
        if (x.has_last_master()): self.set_last_master(x.last_master())
        if (x.has_logical_timestamp()):
            self.set_logical_timestamp(x.logical_timestamp())
        for i in xrange(x.replicas_size()):
            self.add_replicas().CopyFrom(x.replicas(i))
        if (x.has_snapshot_serial()):
            self.set_snapshot_serial(x.snapshot_serial())
        if (x.has_delta_serial()): self.set_delta_serial(x.delta_serial())
        if (x.has_primary_rev_number()):
            self.set_primary_rev_number(x.primary_rev_number())
        for i in xrange(x.chunkservers_size()):
            self.add_chunkservers(x.chunkservers(i))
        for i in xrange(x.old_primaries_size()):
            self.add_old_primaries().CopyFrom(x.old_primaries(i))

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(self, 'GFS_SuperBlock', s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(self, 'GFS_SuperBlock')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(self, 'GFS_SuperBlock',
                                                  output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(self, 'GFS_SuperBlock', s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'GFS_SuperBlock', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_version_ != x.has_version_: return 0
        if self.has_version_ and self.version_ != x.version_: return 0
        if self.has_cellname_ != x.has_cellname_: return 0
        if self.has_cellname_ and self.cellname_ != x.cellname_: return 0
        if self.has_last_master_ != x.has_last_master_: return 0
        if self.has_last_master_ and self.last_master_ != x.last_master_:
            return 0
        if self.has_logical_timestamp_ != x.has_logical_timestamp_: return 0
        if self.has_logical_timestamp_ and self.logical_timestamp_ != x.logical_timestamp_:
            return 0
        if len(self.replicas_) != len(x.replicas_): return 0
        for e1, e2 in zip(self.replicas_, x.replicas_):
            if e1 != e2: return 0
        if self.has_snapshot_serial_ != x.has_snapshot_serial_: return 0
        if self.has_snapshot_serial_ and self.snapshot_serial_ != x.snapshot_serial_:
            return 0
        if self.has_delta_serial_ != x.has_delta_serial_: return 0
        if self.has_delta_serial_ and self.delta_serial_ != x.delta_serial_:
            return 0
        if self.has_primary_rev_number_ != x.has_primary_rev_number_: return 0
        if self.has_primary_rev_number_ and self.primary_rev_number_ != x.primary_rev_number_:
            return 0
        if len(self.chunkservers_) != len(x.chunkservers_): return 0
        for e1, e2 in zip(self.chunkservers_, x.chunkservers_):
            if e1 != e2: return 0
        if len(self.old_primaries_) != len(x.old_primaries_): return 0
        for e1, e2 in zip(self.old_primaries_, x.old_primaries_):
            if e1 != e2: return 0
        return 1

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        if (not self.has_cellname_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: cellname not set.')
        if (not self.has_last_master_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: last_master not set.')
        if (not self.has_logical_timestamp_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: logical_timestamp not set.')
        for i in xrange(len(self.replicas_)):
            if (not self.replicas_[i].IsInitialized(debug_strs)):
                initialized = 0
        if (not self.has_snapshot_serial_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: snapshot_serial not set.')
        if (not self.has_delta_serial_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: delta_serial not set.')
        if (not self.has_primary_rev_number_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append(
                    'Required field: primary_rev_number not set.')
        for i in xrange(len(self.old_primaries_)):
            if (not self.old_primaries_[i].IsInitialized(debug_strs)):
                initialized = 0
        return initialized

    def ByteSize(self):
        n = 0
        if (self.has_version_): n += 1 + self.lengthVarInt64(self.version_)
        n += self.lengthString(len(self.cellname_))
        n += self.lengthString(len(self.last_master_))
        n += self.lengthVarInt64(self.logical_timestamp_)
        n += 1 * len(self.replicas_)
        for i in xrange(len(self.replicas_)):
            n += self.lengthString(self.replicas_[i].ByteSize())
        n += self.lengthVarInt64(self.snapshot_serial_)
        n += self.lengthVarInt64(self.delta_serial_)
        n += self.lengthVarInt64(self.primary_rev_number_)
        n += 1 * len(self.chunkservers_)
        for i in xrange(len(self.chunkservers_)):
            n += self.lengthString(len(self.chunkservers_[i]))
        n += 1 * len(self.old_primaries_)
        for i in xrange(len(self.old_primaries_)):
            n += self.lengthString(self.old_primaries_[i].ByteSize())
        return n + 6

    def Clear(self):
        self.clear_version()
        self.clear_cellname()
        self.clear_last_master()
        self.clear_logical_timestamp()
        self.clear_replicas()
        self.clear_snapshot_serial()
        self.clear_delta_serial()
        self.clear_primary_rev_number()
        self.clear_chunkservers()
        self.clear_old_primaries()

    def OutputUnchecked(self, out):
        out.putVarInt32(10)
        out.putPrefixedString(self.cellname_)
        out.putVarInt32(18)
        out.putPrefixedString(self.last_master_)
        out.putVarInt32(24)
        out.putVarInt64(self.logical_timestamp_)
        for i in xrange(len(self.replicas_)):
            out.putVarInt32(34)
            out.putVarInt32(self.replicas_[i].ByteSize())
            self.replicas_[i].OutputUnchecked(out)
        out.putVarInt32(40)
        out.putVarInt64(self.snapshot_serial_)
        out.putVarInt32(48)
        out.putVarInt64(self.delta_serial_)
        out.putVarInt32(56)
        out.putVarInt64(self.primary_rev_number_)
        for i in xrange(len(self.chunkservers_)):
            out.putVarInt32(66)
            out.putPrefixedString(self.chunkservers_[i])
        for i in xrange(len(self.old_primaries_)):
            out.putVarInt32(74)
            out.putVarInt32(self.old_primaries_[i].ByteSize())
            self.old_primaries_[i].OutputUnchecked(out)
        if (self.has_version_):
            out.putVarInt32(80)
            out.putVarInt32(self.version_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 10:
                self.set_cellname(d.getPrefixedString())
                continue
            if tt == 18:
                self.set_last_master(d.getPrefixedString())
                continue
            if tt == 24:
                self.set_logical_timestamp(d.getVarInt64())
                continue
            if tt == 34:
                length = d.getVarInt32()
                tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(),
                                             d.pos() + length)
                d.skip(length)
                self.add_replicas().TryMerge(tmp)
                continue
            if tt == 40:
                self.set_snapshot_serial(d.getVarInt64())
                continue
            if tt == 48:
                self.set_delta_serial(d.getVarInt64())
                continue
            if tt == 56:
                self.set_primary_rev_number(d.getVarInt64())
                continue
            if tt == 66:
                self.add_chunkservers(d.getPrefixedString())
                continue
            if tt == 74:
                length = d.getVarInt32()
                tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(),
                                             d.pos() + length)
                d.skip(length)
                self.add_old_primaries().TryMerge(tmp)
                continue
            if tt == 80:
                self.set_version(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_version_:
            res += prefix + ("version: %s\n" %
                             self.DebugFormatInt32(self.version_))
        if self.has_cellname_:
            res += prefix + ("cellname: %s\n" %
                             self.DebugFormatString(self.cellname_))
        if self.has_last_master_:
            res += prefix + ("last_master: %s\n" %
                             self.DebugFormatString(self.last_master_))
        if self.has_logical_timestamp_:
            res += prefix + ("logical_timestamp: %s\n" %
                             self.DebugFormatInt64(self.logical_timestamp_))
        cnt = 0
        for e in self.replicas_:
            elm = ""
            if printElemNumber: elm = "(%d)" % cnt
            res += prefix + ("replicas%s <\n" % elm)
            res += e.__str__(prefix + "  ", printElemNumber)
            res += prefix + ">\n"
            cnt += 1
        if self.has_snapshot_serial_:
            res += prefix + ("snapshot_serial: %s\n" %
                             self.DebugFormatInt64(self.snapshot_serial_))
        if self.has_delta_serial_:
            res += prefix + ("delta_serial: %s\n" %
                             self.DebugFormatInt64(self.delta_serial_))
        if self.has_primary_rev_number_:
            res += prefix + ("primary_rev_number: %s\n" %
                             self.DebugFormatInt64(self.primary_rev_number_))
        cnt = 0
        for e in self.chunkservers_:
            elm = ""
            if printElemNumber: elm = "(%d)" % cnt
            res += prefix + ("chunkservers%s: %s\n" %
                             (elm, self.DebugFormatString(e)))
            cnt += 1
        cnt = 0
        for e in self.old_primaries_:
            elm = ""
            if printElemNumber: elm = "(%d)" % cnt
            res += prefix + ("old_primaries%s <\n" % elm)
            res += e.__str__(prefix + "  ", printElemNumber)
            res += prefix + ">\n"
            cnt += 1
        return res

    kversion = 10
    kcellname = 1
    klast_master = 2
    klogical_timestamp = 3
    kreplicas = 4
    ksnapshot_serial = 5
    kdelta_serial = 6
    kprimary_rev_number = 7
    kchunkservers = 8
    kold_primaries = 9

    _TEXT = (
        "ErrorCode",  #   0
        "cellname",  #   1
        "last_master",  #   2
        "logical_timestamp",  #   3
        "replicas",  #   4
        "snapshot_serial",  #   5
        "delta_serial",  #   6
        "primary_rev_number",  #   7
        "chunkservers",  #   8
        "old_primaries",  #   9
        "version",  #  10
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.STRING,  #   1
        ProtocolBuffer.Encoder.STRING,  #   2
        ProtocolBuffer.Encoder.NUMERIC,  #   3
        ProtocolBuffer.Encoder.STRING,  #   4
        ProtocolBuffer.Encoder.NUMERIC,  #   5
        ProtocolBuffer.Encoder.NUMERIC,  #   6
        ProtocolBuffer.Encoder.NUMERIC,  #   7
        ProtocolBuffer.Encoder.STRING,  #   8
        ProtocolBuffer.Encoder.STRING,  #   9
        ProtocolBuffer.Encoder.NUMERIC,  #  10
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x28,
        0x65,
        0x6e,
        0x74,
        0x65,
        0x72,
        0x70,
        0x72,
        0x69,
        0x73,
        0x65,
        0x2f,
        0x63,
        0x6f,
        0x72,
        0x65,
        0x2f,
        0x67,
        0x66,
        0x73,
        0x2f,
        0x67,
        0x66,
        0x73,
        0x5f,
        0x73,
        0x75,
        0x70,
        0x65,
        0x72,
        0x62,
        0x6c,
        0x6f,
        0x63,
        0x6b,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x0e,
        0x47,
        0x46,
        0x53,
        0x5f,
        0x53,
        0x75,
        0x70,
        0x65,
        0x72,
        0x42,
        0x6c,
        0x6f,
        0x63,
        0x6b,
        0x13,
        0x1a,
        0x07,
        0x76,
        0x65,
        0x72,
        0x73,
        0x69,
        0x6f,
        0x6e,
        0x20,
        0x0a,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x01,
        0x30,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x01,
        0x30,
        0xa4,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x08,
        0x63,
        0x65,
        0x6c,
        0x6c,
        0x6e,
        0x61,
        0x6d,
        0x65,
        0x20,
        0x01,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x0b,
        0x6c,
        0x61,
        0x73,
        0x74,
        0x5f,
        0x6d,
        0x61,
        0x73,
        0x74,
        0x65,
        0x72,
        0x20,
        0x02,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x11,
        0x6c,
        0x6f,
        0x67,
        0x69,
        0x63,
        0x61,
        0x6c,
        0x5f,
        0x74,
        0x69,
        0x6d,
        0x65,
        0x73,
        0x74,
        0x61,
        0x6d,
        0x70,
        0x20,
        0x03,
        0x28,
        0x00,
        0x30,
        0x03,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x08,
        0x72,
        0x65,
        0x70,
        0x6c,
        0x69,
        0x63,
        0x61,
        0x73,
        0x20,
        0x04,
        0x28,
        0x02,
        0x30,
        0x0b,
        0x38,
        0x03,
        0x4a,
        0x0f,
        0x47,
        0x46,
        0x53,
        0x5f,
        0x52,
        0x65,
        0x70,
        0x6c,
        0x69,
        0x63,
        0x61,
        0x49,
        0x6e,
        0x66,
        0x6f,
        0x14,
        0x13,
        0x1a,
        0x0f,
        0x73,
        0x6e,
        0x61,
        0x70,
        0x73,
        0x68,
        0x6f,
        0x74,
        0x5f,
        0x73,
        0x65,
        0x72,
        0x69,
        0x61,
        0x6c,
        0x20,
        0x05,
        0x28,
        0x00,
        0x30,
        0x03,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x0c,
        0x64,
        0x65,
        0x6c,
        0x74,
        0x61,
        0x5f,
        0x73,
        0x65,
        0x72,
        0x69,
        0x61,
        0x6c,
        0x20,
        0x06,
        0x28,
        0x00,
        0x30,
        0x03,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x12,
        0x70,
        0x72,
        0x69,
        0x6d,
        0x61,
        0x72,
        0x79,
        0x5f,
        0x72,
        0x65,
        0x76,
        0x5f,
        0x6e,
        0x75,
        0x6d,
        0x62,
        0x65,
        0x72,
        0x20,
        0x07,
        0x28,
        0x00,
        0x30,
        0x03,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x0c,
        0x63,
        0x68,
        0x75,
        0x6e,
        0x6b,
        0x73,
        0x65,
        0x72,
        0x76,
        0x65,
        0x72,
        0x73,
        0x20,
        0x08,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x03,
        0x14,
        0x13,
        0x1a,
        0x0d,
        0x6f,
        0x6c,
        0x64,
        0x5f,
        0x70,
        0x72,
        0x69,
        0x6d,
        0x61,
        0x72,
        0x69,
        0x65,
        0x73,
        0x20,
        0x09,
        0x28,
        0x02,
        0x30,
        0x0b,
        0x38,
        0x03,
        0x4a,
        0x0f,
        0x47,
        0x46,
        0x53,
        0x5f,
        0x50,
        0x72,
        0x69,
        0x6d,
        0x61,
        0x72,
        0x79,
        0x49,
        0x6e,
        0x66,
        0x6f,
        0x14,
        0x73,
        0x7a,
        0x07,
        0x56,
        0x65,
        0x72,
        0x73,
        0x69,
        0x6f,
        0x6e,
        0x8b,
        0x01,
        0x92,
        0x01,
        0x04,
        0x42,
        0x41,
        0x53,
        0x45,
        0x98,
        0x01,
        0x00,
        0x8c,
        0x01,
        0x8b,
        0x01,
        0x92,
        0x01,
        0x08,
        0x41,
        0x52,
        0x43,
        0x48,
        0x49,
        0x56,
        0x41,
        0x4c,
        0x98,
        0x01,
        0x01,
        0x8c,
        0x01,
        0x8b,
        0x01,
        0x92,
        0x01,
        0x07,
        0x43,
        0x55,
        0x52,
        0x52,
        0x45,
        0x4e,
        0x54,
        0x98,
        0x01,
        0x00,
        0x8c,
        0x01,
        0x74,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 3
0
class LinksCommandProto(ProtocolBuffer.ProtocolMessage):
    def __init__(self, contents=None):
        self.docid_ = 0
        self.wantforwardlinks_ = 0
        self.numlinkswanted_ = 0
        self.samplelinks_ = 0
        self.dataversion_ = ""
        self.wantasciiresults_ = 0
        self.timeoutinms_ = 0
        self.resultsformat_ = 20
        self.has_docid_ = 0
        self.has_wantforwardlinks_ = 0
        self.has_numlinkswanted_ = 0
        self.has_samplelinks_ = 0
        self.has_dataversion_ = 0
        self.has_wantasciiresults_ = 0
        self.has_timeoutinms_ = 0
        self.has_resultsformat_ = 0
        if contents is not None: self.MergeFromString(contents)

    def docid(self):
        return self.docid_

    def set_docid(self, x):
        self.has_docid_ = 1
        self.docid_ = x

    def clear_docid(self):
        self.has_docid_ = 0
        self.docid_ = 0

    def has_docid(self):
        return self.has_docid_

    def wantforwardlinks(self):
        return self.wantforwardlinks_

    def set_wantforwardlinks(self, x):
        self.has_wantforwardlinks_ = 1
        self.wantforwardlinks_ = x

    def clear_wantforwardlinks(self):
        self.has_wantforwardlinks_ = 0
        self.wantforwardlinks_ = 0

    def has_wantforwardlinks(self):
        return self.has_wantforwardlinks_

    def numlinkswanted(self):
        return self.numlinkswanted_

    def set_numlinkswanted(self, x):
        self.has_numlinkswanted_ = 1
        self.numlinkswanted_ = x

    def clear_numlinkswanted(self):
        self.has_numlinkswanted_ = 0
        self.numlinkswanted_ = 0

    def has_numlinkswanted(self):
        return self.has_numlinkswanted_

    def samplelinks(self):
        return self.samplelinks_

    def set_samplelinks(self, x):
        self.has_samplelinks_ = 1
        self.samplelinks_ = x

    def clear_samplelinks(self):
        self.has_samplelinks_ = 0
        self.samplelinks_ = 0

    def has_samplelinks(self):
        return self.has_samplelinks_

    def dataversion(self):
        return self.dataversion_

    def set_dataversion(self, x):
        self.has_dataversion_ = 1
        self.dataversion_ = x

    def clear_dataversion(self):
        self.has_dataversion_ = 0
        self.dataversion_ = ""

    def has_dataversion(self):
        return self.has_dataversion_

    def wantasciiresults(self):
        return self.wantasciiresults_

    def set_wantasciiresults(self, x):
        self.has_wantasciiresults_ = 1
        self.wantasciiresults_ = x

    def clear_wantasciiresults(self):
        self.has_wantasciiresults_ = 0
        self.wantasciiresults_ = 0

    def has_wantasciiresults(self):
        return self.has_wantasciiresults_

    def timeoutinms(self):
        return self.timeoutinms_

    def set_timeoutinms(self, x):
        self.has_timeoutinms_ = 1
        self.timeoutinms_ = x

    def clear_timeoutinms(self):
        self.has_timeoutinms_ = 0
        self.timeoutinms_ = 0

    def has_timeoutinms(self):
        return self.has_timeoutinms_

    def resultsformat(self):
        return self.resultsformat_

    def set_resultsformat(self, x):
        self.has_resultsformat_ = 1
        self.resultsformat_ = x

    def clear_resultsformat(self):
        self.has_resultsformat_ = 0
        self.resultsformat_ = 20

    def has_resultsformat(self):
        return self.has_resultsformat_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_docid()): self.set_docid(x.docid())
        if (x.has_wantforwardlinks()):
            self.set_wantforwardlinks(x.wantforwardlinks())
        if (x.has_numlinkswanted()):
            self.set_numlinkswanted(x.numlinkswanted())
        if (x.has_samplelinks()): self.set_samplelinks(x.samplelinks())
        if (x.has_dataversion()): self.set_dataversion(x.dataversion())
        if (x.has_wantasciiresults()):
            self.set_wantasciiresults(x.wantasciiresults())
        if (x.has_timeoutinms()): self.set_timeoutinms(x.timeoutinms())
        if (x.has_resultsformat()): self.set_resultsformat(x.resultsformat())

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(self, 'LinksCommandProto',
                                                   s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(self, 'LinksCommandProto')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(self, 'LinksCommandProto',
                                                  output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(self, 'LinksCommandProto', s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'LinksCommandProto', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_docid_ != x.has_docid_: return 0
        if self.has_docid_ and self.docid_ != x.docid_: return 0
        if self.has_wantforwardlinks_ != x.has_wantforwardlinks_: return 0
        if self.has_wantforwardlinks_ and self.wantforwardlinks_ != x.wantforwardlinks_:
            return 0
        if self.has_numlinkswanted_ != x.has_numlinkswanted_: return 0
        if self.has_numlinkswanted_ and self.numlinkswanted_ != x.numlinkswanted_:
            return 0
        if self.has_samplelinks_ != x.has_samplelinks_: return 0
        if self.has_samplelinks_ and self.samplelinks_ != x.samplelinks_:
            return 0
        if self.has_dataversion_ != x.has_dataversion_: return 0
        if self.has_dataversion_ and self.dataversion_ != x.dataversion_:
            return 0
        if self.has_wantasciiresults_ != x.has_wantasciiresults_: return 0
        if self.has_wantasciiresults_ and self.wantasciiresults_ != x.wantasciiresults_:
            return 0
        if self.has_timeoutinms_ != x.has_timeoutinms_: return 0
        if self.has_timeoutinms_ and self.timeoutinms_ != x.timeoutinms_:
            return 0
        if self.has_resultsformat_ != x.has_resultsformat_: return 0
        if self.has_resultsformat_ and self.resultsformat_ != x.resultsformat_:
            return 0
        return 1

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        if (not self.has_docid_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: docid not set.')
        if (not self.has_wantforwardlinks_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: wantforwardlinks not set.')
        if (not self.has_numlinkswanted_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: numlinkswanted not set.')
        return initialized

    def ByteSize(self):
        n = 0
        n += self.lengthVarInt64(self.docid_)
        n += self.lengthVarInt64(self.numlinkswanted_)
        if (self.has_samplelinks_): n += 2
        if (self.has_dataversion_):
            n += 1 + self.lengthString(len(self.dataversion_))
        if (self.has_wantasciiresults_): n += 2
        if (self.has_timeoutinms_):
            n += 1 + self.lengthVarInt64(self.timeoutinms_)
        if (self.has_resultsformat_):
            n += 2 + self.lengthVarInt64(self.resultsformat_)
        return n + 4

    def Clear(self):
        self.clear_docid()
        self.clear_wantforwardlinks()
        self.clear_numlinkswanted()
        self.clear_samplelinks()
        self.clear_dataversion()
        self.clear_wantasciiresults()
        self.clear_timeoutinms()
        self.clear_resultsformat()

    def OutputUnchecked(self, out):
        out.putVarInt32(8)
        out.putVarUint64(self.docid_)
        out.putVarInt32(16)
        out.putBoolean(self.wantforwardlinks_)
        out.putVarInt32(24)
        out.putVarInt32(self.numlinkswanted_)
        if (self.has_samplelinks_):
            out.putVarInt32(32)
            out.putBoolean(self.samplelinks_)
        if (self.has_dataversion_):
            out.putVarInt32(42)
            out.putPrefixedString(self.dataversion_)
        if (self.has_wantasciiresults_):
            out.putVarInt32(48)
            out.putBoolean(self.wantasciiresults_)
        if (self.has_timeoutinms_):
            out.putVarInt32(56)
            out.putVarInt32(self.timeoutinms_)
        if (self.has_resultsformat_):
            out.putVarInt32(808)
            out.putVarInt32(self.resultsformat_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 8:
                self.set_docid(d.getVarUint64())
                continue
            if tt == 16:
                self.set_wantforwardlinks(d.getBoolean())
                continue
            if tt == 24:
                self.set_numlinkswanted(d.getVarInt32())
                continue
            if tt == 32:
                self.set_samplelinks(d.getBoolean())
                continue
            if tt == 42:
                self.set_dataversion(d.getPrefixedString())
                continue
            if tt == 48:
                self.set_wantasciiresults(d.getBoolean())
                continue
            if tt == 56:
                self.set_timeoutinms(d.getVarInt32())
                continue
            if tt == 808:
                self.set_resultsformat(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_docid_:
            res += prefix + ("Docid: %s\n" %
                             self.DebugFormatInt64(self.docid_))
        if self.has_wantforwardlinks_:
            res += prefix + ("WantForwardLinks: %s\n" %
                             self.DebugFormatBool(self.wantforwardlinks_))
        if self.has_numlinkswanted_:
            res += prefix + ("NumLinksWanted: %s\n" %
                             self.DebugFormatInt32(self.numlinkswanted_))
        if self.has_samplelinks_:
            res += prefix + ("SampleLinks: %s\n" %
                             self.DebugFormatBool(self.samplelinks_))
        if self.has_dataversion_:
            res += prefix + ("DataVersion: %s\n" %
                             self.DebugFormatString(self.dataversion_))
        if self.has_wantasciiresults_:
            res += prefix + ("WantAsciiResults: %s\n" %
                             self.DebugFormatBool(self.wantasciiresults_))
        if self.has_timeoutinms_:
            res += prefix + ("TimeoutInMs: %s\n" %
                             self.DebugFormatInt32(self.timeoutinms_))
        if self.has_resultsformat_:
            res += prefix + ("ResultsFormat: %s\n" %
                             self.DebugFormatInt32(self.resultsformat_))
        return res

    kDocid = 1
    kWantForwardLinks = 2
    kNumLinksWanted = 3
    kSampleLinks = 4
    kDataVersion = 5
    kWantAsciiResults = 6
    kTimeoutInMs = 7
    kResultsFormat = 101

    _TEXT = (
        "ErrorCode",  #   0
        "Docid",  #   1
        "WantForwardLinks",  #   2
        "NumLinksWanted",  #   3
        "SampleLinks",  #   4
        "DataVersion",  #   5
        "WantAsciiResults",  #   6
        "TimeoutInMs",  #   7
        None,  #   8
        None,  #   9
        None,  #  10
        None,  #  11
        None,  #  12
        None,  #  13
        None,  #  14
        None,  #  15
        None,  #  16
        None,  #  17
        None,  #  18
        None,  #  19
        None,  #  20
        None,  #  21
        None,  #  22
        None,  #  23
        None,  #  24
        None,  #  25
        None,  #  26
        None,  #  27
        None,  #  28
        None,  #  29
        None,  #  30
        None,  #  31
        None,  #  32
        None,  #  33
        None,  #  34
        None,  #  35
        None,  #  36
        None,  #  37
        None,  #  38
        None,  #  39
        None,  #  40
        None,  #  41
        None,  #  42
        None,  #  43
        None,  #  44
        None,  #  45
        None,  #  46
        None,  #  47
        None,  #  48
        None,  #  49
        None,  #  50
        None,  #  51
        None,  #  52
        None,  #  53
        None,  #  54
        None,  #  55
        None,  #  56
        None,  #  57
        None,  #  58
        None,  #  59
        None,  #  60
        None,  #  61
        None,  #  62
        None,  #  63
        None,  #  64
        None,  #  65
        None,  #  66
        None,  #  67
        None,  #  68
        None,  #  69
        None,  #  70
        None,  #  71
        None,  #  72
        None,  #  73
        None,  #  74
        None,  #  75
        None,  #  76
        None,  #  77
        None,  #  78
        None,  #  79
        None,  #  80
        None,  #  81
        None,  #  82
        None,  #  83
        None,  #  84
        None,  #  85
        None,  #  86
        None,  #  87
        None,  #  88
        None,  #  89
        None,  #  90
        None,  #  91
        None,  #  92
        None,  #  93
        None,  #  94
        None,  #  95
        None,  #  96
        None,  #  97
        None,  #  98
        None,  #  99
        None,  # 100
        "ResultsFormat",  # 101
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.NUMERIC,  #   1
        ProtocolBuffer.Encoder.NUMERIC,  #   2
        ProtocolBuffer.Encoder.NUMERIC,  #   3
        ProtocolBuffer.Encoder.NUMERIC,  #   4
        ProtocolBuffer.Encoder.STRING,  #   5
        ProtocolBuffer.Encoder.NUMERIC,  #   6
        ProtocolBuffer.Encoder.NUMERIC,  #   7
        ProtocolBuffer.Encoder.MAX_TYPE,  #   8
        ProtocolBuffer.Encoder.MAX_TYPE,  #   9
        ProtocolBuffer.Encoder.MAX_TYPE,  #  10
        ProtocolBuffer.Encoder.MAX_TYPE,  #  11
        ProtocolBuffer.Encoder.MAX_TYPE,  #  12
        ProtocolBuffer.Encoder.MAX_TYPE,  #  13
        ProtocolBuffer.Encoder.MAX_TYPE,  #  14
        ProtocolBuffer.Encoder.MAX_TYPE,  #  15
        ProtocolBuffer.Encoder.MAX_TYPE,  #  16
        ProtocolBuffer.Encoder.MAX_TYPE,  #  17
        ProtocolBuffer.Encoder.MAX_TYPE,  #  18
        ProtocolBuffer.Encoder.MAX_TYPE,  #  19
        ProtocolBuffer.Encoder.MAX_TYPE,  #  20
        ProtocolBuffer.Encoder.MAX_TYPE,  #  21
        ProtocolBuffer.Encoder.MAX_TYPE,  #  22
        ProtocolBuffer.Encoder.MAX_TYPE,  #  23
        ProtocolBuffer.Encoder.MAX_TYPE,  #  24
        ProtocolBuffer.Encoder.MAX_TYPE,  #  25
        ProtocolBuffer.Encoder.MAX_TYPE,  #  26
        ProtocolBuffer.Encoder.MAX_TYPE,  #  27
        ProtocolBuffer.Encoder.MAX_TYPE,  #  28
        ProtocolBuffer.Encoder.MAX_TYPE,  #  29
        ProtocolBuffer.Encoder.MAX_TYPE,  #  30
        ProtocolBuffer.Encoder.MAX_TYPE,  #  31
        ProtocolBuffer.Encoder.MAX_TYPE,  #  32
        ProtocolBuffer.Encoder.MAX_TYPE,  #  33
        ProtocolBuffer.Encoder.MAX_TYPE,  #  34
        ProtocolBuffer.Encoder.MAX_TYPE,  #  35
        ProtocolBuffer.Encoder.MAX_TYPE,  #  36
        ProtocolBuffer.Encoder.MAX_TYPE,  #  37
        ProtocolBuffer.Encoder.MAX_TYPE,  #  38
        ProtocolBuffer.Encoder.MAX_TYPE,  #  39
        ProtocolBuffer.Encoder.MAX_TYPE,  #  40
        ProtocolBuffer.Encoder.MAX_TYPE,  #  41
        ProtocolBuffer.Encoder.MAX_TYPE,  #  42
        ProtocolBuffer.Encoder.MAX_TYPE,  #  43
        ProtocolBuffer.Encoder.MAX_TYPE,  #  44
        ProtocolBuffer.Encoder.MAX_TYPE,  #  45
        ProtocolBuffer.Encoder.MAX_TYPE,  #  46
        ProtocolBuffer.Encoder.MAX_TYPE,  #  47
        ProtocolBuffer.Encoder.MAX_TYPE,  #  48
        ProtocolBuffer.Encoder.MAX_TYPE,  #  49
        ProtocolBuffer.Encoder.MAX_TYPE,  #  50
        ProtocolBuffer.Encoder.MAX_TYPE,  #  51
        ProtocolBuffer.Encoder.MAX_TYPE,  #  52
        ProtocolBuffer.Encoder.MAX_TYPE,  #  53
        ProtocolBuffer.Encoder.MAX_TYPE,  #  54
        ProtocolBuffer.Encoder.MAX_TYPE,  #  55
        ProtocolBuffer.Encoder.MAX_TYPE,  #  56
        ProtocolBuffer.Encoder.MAX_TYPE,  #  57
        ProtocolBuffer.Encoder.MAX_TYPE,  #  58
        ProtocolBuffer.Encoder.MAX_TYPE,  #  59
        ProtocolBuffer.Encoder.MAX_TYPE,  #  60
        ProtocolBuffer.Encoder.MAX_TYPE,  #  61
        ProtocolBuffer.Encoder.MAX_TYPE,  #  62
        ProtocolBuffer.Encoder.MAX_TYPE,  #  63
        ProtocolBuffer.Encoder.MAX_TYPE,  #  64
        ProtocolBuffer.Encoder.MAX_TYPE,  #  65
        ProtocolBuffer.Encoder.MAX_TYPE,  #  66
        ProtocolBuffer.Encoder.MAX_TYPE,  #  67
        ProtocolBuffer.Encoder.MAX_TYPE,  #  68
        ProtocolBuffer.Encoder.MAX_TYPE,  #  69
        ProtocolBuffer.Encoder.MAX_TYPE,  #  70
        ProtocolBuffer.Encoder.MAX_TYPE,  #  71
        ProtocolBuffer.Encoder.MAX_TYPE,  #  72
        ProtocolBuffer.Encoder.MAX_TYPE,  #  73
        ProtocolBuffer.Encoder.MAX_TYPE,  #  74
        ProtocolBuffer.Encoder.MAX_TYPE,  #  75
        ProtocolBuffer.Encoder.MAX_TYPE,  #  76
        ProtocolBuffer.Encoder.MAX_TYPE,  #  77
        ProtocolBuffer.Encoder.MAX_TYPE,  #  78
        ProtocolBuffer.Encoder.MAX_TYPE,  #  79
        ProtocolBuffer.Encoder.MAX_TYPE,  #  80
        ProtocolBuffer.Encoder.MAX_TYPE,  #  81
        ProtocolBuffer.Encoder.MAX_TYPE,  #  82
        ProtocolBuffer.Encoder.MAX_TYPE,  #  83
        ProtocolBuffer.Encoder.MAX_TYPE,  #  84
        ProtocolBuffer.Encoder.MAX_TYPE,  #  85
        ProtocolBuffer.Encoder.MAX_TYPE,  #  86
        ProtocolBuffer.Encoder.MAX_TYPE,  #  87
        ProtocolBuffer.Encoder.MAX_TYPE,  #  88
        ProtocolBuffer.Encoder.MAX_TYPE,  #  89
        ProtocolBuffer.Encoder.MAX_TYPE,  #  90
        ProtocolBuffer.Encoder.MAX_TYPE,  #  91
        ProtocolBuffer.Encoder.MAX_TYPE,  #  92
        ProtocolBuffer.Encoder.MAX_TYPE,  #  93
        ProtocolBuffer.Encoder.MAX_TYPE,  #  94
        ProtocolBuffer.Encoder.MAX_TYPE,  #  95
        ProtocolBuffer.Encoder.MAX_TYPE,  #  96
        ProtocolBuffer.Encoder.MAX_TYPE,  #  97
        ProtocolBuffer.Encoder.MAX_TYPE,  #  98
        ProtocolBuffer.Encoder.MAX_TYPE,  #  99
        ProtocolBuffer.Encoder.MAX_TYPE,  # 100
        ProtocolBuffer.Encoder.NUMERIC,  # 101
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x1d,
        0x6c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x65,
        0x72,
        0x76,
        0x65,
        0x72,
        0x2f,
        0x72,
        0x70,
        0x63,
        0x2f,
        0x6c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x72,
        0x70,
        0x63,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x11,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x43,
        0x6f,
        0x6d,
        0x6d,
        0x61,
        0x6e,
        0x64,
        0x50,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x13,
        0x1a,
        0x05,
        0x44,
        0x6f,
        0x63,
        0x69,
        0x64,
        0x20,
        0x01,
        0x28,
        0x00,
        0x30,
        0x04,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x10,
        0x57,
        0x61,
        0x6e,
        0x74,
        0x46,
        0x6f,
        0x72,
        0x77,
        0x61,
        0x72,
        0x64,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x20,
        0x02,
        0x28,
        0x00,
        0x30,
        0x08,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x0e,
        0x4e,
        0x75,
        0x6d,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x57,
        0x61,
        0x6e,
        0x74,
        0x65,
        0x64,
        0x20,
        0x03,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x0b,
        0x53,
        0x61,
        0x6d,
        0x70,
        0x6c,
        0x65,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x20,
        0x04,
        0x28,
        0x00,
        0x30,
        0x08,
        0x38,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0b,
        0x44,
        0x61,
        0x74,
        0x61,
        0x56,
        0x65,
        0x72,
        0x73,
        0x69,
        0x6f,
        0x6e,
        0x20,
        0x05,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x10,
        0x57,
        0x61,
        0x6e,
        0x74,
        0x41,
        0x73,
        0x63,
        0x69,
        0x69,
        0x52,
        0x65,
        0x73,
        0x75,
        0x6c,
        0x74,
        0x73,
        0x20,
        0x06,
        0x28,
        0x00,
        0x30,
        0x08,
        0x38,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0b,
        0x54,
        0x69,
        0x6d,
        0x65,
        0x6f,
        0x75,
        0x74,
        0x49,
        0x6e,
        0x4d,
        0x73,
        0x20,
        0x07,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0d,
        0x52,
        0x65,
        0x73,
        0x75,
        0x6c,
        0x74,
        0x73,
        0x46,
        0x6f,
        0x72,
        0x6d,
        0x61,
        0x74,
        0x20,
        0x65,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x02,
        0x32,
        0x30,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x02,
        0x32,
        0x30,
        0xa4,
        0x01,
        0x14,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
class StartBackgroundRequestResponse(ProtocolBuffer.ProtocolMessage):
    has_request_id_ = 0
    request_id_ = ""

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

    def request_id(self):
        return self.request_id_

    def set_request_id(self, x):
        self.has_request_id_ = 1
        self.request_id_ = x

    def clear_request_id(self):
        if self.has_request_id_:
            self.has_request_id_ = 0
            self.request_id_ = ""

    def has_request_id(self):
        return self.has_request_id_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_request_id()): self.set_request_id(x.request_id())

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.StartBackgroundRequestResponse', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(
                self, 'apphosting.StartBackgroundRequestResponse')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.StartBackgroundRequestResponse')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(
                self, 'apphosting.StartBackgroundRequestResponse',
                output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(
                self, 'apphosting.StartBackgroundRequestResponse', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.StartBackgroundRequestResponse', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_request_id_ != x.has_request_id_: return 0
        if self.has_request_id_ and self.request_id_ != x.request_id_: return 0
        return 1

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        return initialized

    def ByteSize(self):
        n = 0
        if (self.has_request_id_):
            n += 1 + self.lengthString(len(self.request_id_))
        return n

    def ByteSizePartial(self):
        n = 0
        if (self.has_request_id_):
            n += 1 + self.lengthString(len(self.request_id_))
        return n

    def Clear(self):
        self.clear_request_id()

    def OutputUnchecked(self, out):
        if (self.has_request_id_):
            out.putVarInt32(10)
            out.putPrefixedString(self.request_id_)

    def OutputPartial(self, out):
        if (self.has_request_id_):
            out.putVarInt32(10)
            out.putPrefixedString(self.request_id_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 10:
                self.set_request_id(d.getPrefixedString())
                continue

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)

    def __str__(self, prefix="", printElemNumber=0):
        res = ""
        if self.has_request_id_:
            res += prefix + ("request_id: %s\n" %
                             self.DebugFormatString(self.request_id_))
        return res

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

    krequest_id = 1

    _TEXT = _BuildTagLookupTable({
        0: "ErrorCode",
        1: "request_id",
    }, 1)

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

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _PROTO_DESCRIPTOR_NAME = 'apphosting.StartBackgroundRequestResponse'
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WiphcHBob3N0aW5nL2FwaS9zeXN0ZW0vc3lzdGVtX3NlcnZpY2UucHJvdG8KKWFwcGhvc3RpbmcuU3RhcnRCYWNrZ3JvdW5kUmVxdWVzdFJlc3BvbnNlExoKcmVxdWVzdF9pZCABKAIwCTgBFMIBHWFwcGhvc3RpbmcuU3lzdGVtU2VydmljZUVycm9y"
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
class FlushRequest(ProtocolBuffer.ProtocolMessage):
    has_logs_ = 0
    logs_ = ""

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

    def logs(self):
        return self.logs_

    def set_logs(self, x):
        self.has_logs_ = 1
        self.logs_ = x

    def clear_logs(self):
        if self.has_logs_:
            self.has_logs_ = 0
            self.logs_ = ""

    def has_logs(self):
        return self.has_logs_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_logs()): self.set_logs(x.logs())

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.FlushRequest', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(
                self, 'apphosting.FlushRequest')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.FlushRequest')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(
                self, 'apphosting.FlushRequest', output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(self,
                                                  'apphosting.FlushRequest', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.FlushRequest', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_logs_ != x.has_logs_: return 0
        if self.has_logs_ and self.logs_ != x.logs_: return 0
        return 1

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        return initialized

    def ByteSize(self):
        n = 0
        if (self.has_logs_): n += 1 + self.lengthString(len(self.logs_))
        return n

    def ByteSizePartial(self):
        n = 0
        if (self.has_logs_): n += 1 + self.lengthString(len(self.logs_))
        return n

    def Clear(self):
        self.clear_logs()

    def OutputUnchecked(self, out):
        if (self.has_logs_):
            out.putVarInt32(10)
            out.putPrefixedString(self.logs_)

    def OutputPartial(self, out):
        if (self.has_logs_):
            out.putVarInt32(10)
            out.putPrefixedString(self.logs_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 10:
                self.set_logs(d.getPrefixedString())
                continue

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)

    def __str__(self, prefix="", printElemNumber=0):
        res = ""
        if self.has_logs_:
            res += prefix + ("logs: %s\n" % self.DebugFormatString(self.logs_))
        return res

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

    klogs = 1

    _TEXT = _BuildTagLookupTable({
        0: "ErrorCode",
        1: "logs",
    }, 1)

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

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WithcHBob3N0aW5nL2FwaS9sb2dzZXJ2aWNlL2xvZ19zZXJ2aWNlLnByb3RvChdhcHBob3N0aW5nLkZsdXNoUmVxdWVzdBMaBGxvZ3MgASgCMAk4ARS6AesCCithcHBob3N0aW5nL2FwaS9sb2dzZXJ2aWNlL2xvZ19zZXJ2aWNlLnByb3RvEgphcHBob3N0aW5nGh1hcHBob3N0aW5nL2FwaS9hcGlfYmFzZS5wcm90byIcCgxGbHVzaFJlcXVlc3QSDAoEbG9ncxgBIAEoDCIiChBTZXRTdGF0dXNSZXF1ZXN0Eg4KBnN0YXR1cxgBIAIoCTKSAQoKTG9nU2VydmljZRI9CgVGbHVzaBIYLmFwcGhvc3RpbmcuRmx1c2hSZXF1ZXN0GhouYXBwaG9zdGluZy5iYXNlLlZvaWRQcm90bxJFCglTZXRTdGF0dXMSHC5hcHBob3N0aW5nLlNldFN0YXR1c1JlcXVlc3QaGi5hcHBob3N0aW5nLmJhc2UuVm9pZFByb3RvQjoKJGNvbS5nb29nbGUuYXBwaG9zdGluZy5hcGkubG9nc2VydmljZRABIAEoAUIMTG9nU2VydmljZVBi"
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
class SystemStat(ProtocolBuffer.ProtocolMessage):
    has_current_ = 0
    current_ = 0.0
    has_average1m_ = 0
    average1m_ = 0.0
    has_average10m_ = 0
    average10m_ = 0.0
    has_total_ = 0
    total_ = 0.0
    has_rate1m_ = 0
    rate1m_ = 0.0
    has_rate10m_ = 0
    rate10m_ = 0.0

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

    def current(self):
        return self.current_

    def set_current(self, x):
        self.has_current_ = 1
        self.current_ = x

    def clear_current(self):
        if self.has_current_:
            self.has_current_ = 0
            self.current_ = 0.0

    def has_current(self):
        return self.has_current_

    def average1m(self):
        return self.average1m_

    def set_average1m(self, x):
        self.has_average1m_ = 1
        self.average1m_ = x

    def clear_average1m(self):
        if self.has_average1m_:
            self.has_average1m_ = 0
            self.average1m_ = 0.0

    def has_average1m(self):
        return self.has_average1m_

    def average10m(self):
        return self.average10m_

    def set_average10m(self, x):
        self.has_average10m_ = 1
        self.average10m_ = x

    def clear_average10m(self):
        if self.has_average10m_:
            self.has_average10m_ = 0
            self.average10m_ = 0.0

    def has_average10m(self):
        return self.has_average10m_

    def total(self):
        return self.total_

    def set_total(self, x):
        self.has_total_ = 1
        self.total_ = x

    def clear_total(self):
        if self.has_total_:
            self.has_total_ = 0
            self.total_ = 0.0

    def has_total(self):
        return self.has_total_

    def rate1m(self):
        return self.rate1m_

    def set_rate1m(self, x):
        self.has_rate1m_ = 1
        self.rate1m_ = x

    def clear_rate1m(self):
        if self.has_rate1m_:
            self.has_rate1m_ = 0
            self.rate1m_ = 0.0

    def has_rate1m(self):
        return self.has_rate1m_

    def rate10m(self):
        return self.rate10m_

    def set_rate10m(self, x):
        self.has_rate10m_ = 1
        self.rate10m_ = x

    def clear_rate10m(self):
        if self.has_rate10m_:
            self.has_rate10m_ = 0
            self.rate10m_ = 0.0

    def has_rate10m(self):
        return self.has_rate10m_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_current()): self.set_current(x.current())
        if (x.has_average1m()): self.set_average1m(x.average1m())
        if (x.has_average10m()): self.set_average10m(x.average10m())
        if (x.has_total()): self.set_total(x.total())
        if (x.has_rate1m()): self.set_rate1m(x.rate1m())
        if (x.has_rate10m()): self.set_rate10m(x.rate10m())

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.SystemStat', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(self,
                                                     'apphosting.SystemStat')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.SystemStat')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(self,
                                                      'apphosting.SystemStat',
                                                      output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(self,
                                                  'apphosting.SystemStat', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.SystemStat', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_current_ != x.has_current_: return 0
        if self.has_current_ and self.current_ != x.current_: return 0
        if self.has_average1m_ != x.has_average1m_: return 0
        if self.has_average1m_ and self.average1m_ != x.average1m_: return 0
        if self.has_average10m_ != x.has_average10m_: return 0
        if self.has_average10m_ and self.average10m_ != x.average10m_: return 0
        if self.has_total_ != x.has_total_: return 0
        if self.has_total_ and self.total_ != x.total_: return 0
        if self.has_rate1m_ != x.has_rate1m_: return 0
        if self.has_rate1m_ and self.rate1m_ != x.rate1m_: return 0
        if self.has_rate10m_ != x.has_rate10m_: return 0
        if self.has_rate10m_ and self.rate10m_ != x.rate10m_: return 0
        return 1

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        return initialized

    def ByteSize(self):
        n = 0
        if (self.has_current_): n += 9
        if (self.has_average1m_): n += 9
        if (self.has_average10m_): n += 9
        if (self.has_total_): n += 9
        if (self.has_rate1m_): n += 9
        if (self.has_rate10m_): n += 9
        return n

    def ByteSizePartial(self):
        n = 0
        if (self.has_current_): n += 9
        if (self.has_average1m_): n += 9
        if (self.has_average10m_): n += 9
        if (self.has_total_): n += 9
        if (self.has_rate1m_): n += 9
        if (self.has_rate10m_): n += 9
        return n

    def Clear(self):
        self.clear_current()
        self.clear_average1m()
        self.clear_average10m()
        self.clear_total()
        self.clear_rate1m()
        self.clear_rate10m()

    def OutputUnchecked(self, out):
        if (self.has_current_):
            out.putVarInt32(9)
            out.putDouble(self.current_)
        if (self.has_total_):
            out.putVarInt32(17)
            out.putDouble(self.total_)
        if (self.has_average1m_):
            out.putVarInt32(25)
            out.putDouble(self.average1m_)
        if (self.has_average10m_):
            out.putVarInt32(33)
            out.putDouble(self.average10m_)
        if (self.has_rate1m_):
            out.putVarInt32(41)
            out.putDouble(self.rate1m_)
        if (self.has_rate10m_):
            out.putVarInt32(49)
            out.putDouble(self.rate10m_)

    def OutputPartial(self, out):
        if (self.has_current_):
            out.putVarInt32(9)
            out.putDouble(self.current_)
        if (self.has_total_):
            out.putVarInt32(17)
            out.putDouble(self.total_)
        if (self.has_average1m_):
            out.putVarInt32(25)
            out.putDouble(self.average1m_)
        if (self.has_average10m_):
            out.putVarInt32(33)
            out.putDouble(self.average10m_)
        if (self.has_rate1m_):
            out.putVarInt32(41)
            out.putDouble(self.rate1m_)
        if (self.has_rate10m_):
            out.putVarInt32(49)
            out.putDouble(self.rate10m_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 9:
                self.set_current(d.getDouble())
                continue
            if tt == 17:
                self.set_total(d.getDouble())
                continue
            if tt == 25:
                self.set_average1m(d.getDouble())
                continue
            if tt == 33:
                self.set_average10m(d.getDouble())
                continue
            if tt == 41:
                self.set_rate1m(d.getDouble())
                continue
            if tt == 49:
                self.set_rate10m(d.getDouble())
                continue

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)

    def __str__(self, prefix="", printElemNumber=0):
        res = ""
        if self.has_current_:
            res += prefix + ("current: %s\n" % self.DebugFormat(self.current_))
        if self.has_average1m_:
            res += prefix + ("average1m: %s\n" %
                             self.DebugFormat(self.average1m_))
        if self.has_average10m_:
            res += prefix + ("average10m: %s\n" %
                             self.DebugFormat(self.average10m_))
        if self.has_total_:
            res += prefix + ("total: %s\n" % self.DebugFormat(self.total_))
        if self.has_rate1m_:
            res += prefix + ("rate1m: %s\n" % self.DebugFormat(self.rate1m_))
        if self.has_rate10m_:
            res += prefix + ("rate10m: %s\n" % self.DebugFormat(self.rate10m_))
        return res

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

    kcurrent = 1
    kaverage1m = 3
    kaverage10m = 4
    ktotal = 2
    krate1m = 5
    krate10m = 6

    _TEXT = _BuildTagLookupTable(
        {
            0: "ErrorCode",
            1: "current",
            2: "total",
            3: "average1m",
            4: "average10m",
            5: "rate1m",
            6: "rate10m",
        }, 6)

    _TYPES = _BuildTagLookupTable(
        {
            0: ProtocolBuffer.Encoder.NUMERIC,
            1: ProtocolBuffer.Encoder.DOUBLE,
            2: ProtocolBuffer.Encoder.DOUBLE,
            3: ProtocolBuffer.Encoder.DOUBLE,
            4: ProtocolBuffer.Encoder.DOUBLE,
            5: ProtocolBuffer.Encoder.DOUBLE,
            6: ProtocolBuffer.Encoder.DOUBLE,
        }, 6, ProtocolBuffer.Encoder.MAX_TYPE)

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _PROTO_DESCRIPTOR_NAME = 'apphosting.SystemStat'
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WiphcHBob3N0aW5nL2FwaS9zeXN0ZW0vc3lzdGVtX3NlcnZpY2UucHJvdG8KFWFwcGhvc3RpbmcuU3lzdGVtU3RhdBMaB2N1cnJlbnQgASgBMAE4ARQTGglhdmVyYWdlMW0gAygBMAE4ARQTGgphdmVyYWdlMTBtIAQoATABOAEUExoFdG90YWwgAigBMAE4ARQTGgZyYXRlMW0gBSgBMAE4ARQTGgdyYXRlMTBtIAYoATABOAEUwgEdYXBwaG9zdGluZy5TeXN0ZW1TZXJ2aWNlRXJyb3I="
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
class GetSystemStatsResponse(ProtocolBuffer.ProtocolMessage):
    has_cpu_ = 0
    cpu_ = None
    has_memory_ = 0
    memory_ = None

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

    def cpu(self):
        if self.cpu_ is None:
            self.lazy_init_lock_.acquire()
            try:
                if self.cpu_ is None: self.cpu_ = SystemStat()
            finally:
                self.lazy_init_lock_.release()
        return self.cpu_

    def mutable_cpu(self):
        self.has_cpu_ = 1
        return self.cpu()

    def clear_cpu(self):

        if self.has_cpu_:
            self.has_cpu_ = 0
            if self.cpu_ is not None: self.cpu_.Clear()

    def has_cpu(self):
        return self.has_cpu_

    def memory(self):
        if self.memory_ is None:
            self.lazy_init_lock_.acquire()
            try:
                if self.memory_ is None: self.memory_ = SystemStat()
            finally:
                self.lazy_init_lock_.release()
        return self.memory_

    def mutable_memory(self):
        self.has_memory_ = 1
        return self.memory()

    def clear_memory(self):

        if self.has_memory_:
            self.has_memory_ = 0
            if self.memory_ is not None: self.memory_.Clear()

    def has_memory(self):
        return self.has_memory_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_cpu()): self.mutable_cpu().MergeFrom(x.cpu())
        if (x.has_memory()): self.mutable_memory().MergeFrom(x.memory())

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.GetSystemStatsResponse', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(
                self, 'apphosting.GetSystemStatsResponse')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.GetSystemStatsResponse')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(
                self, 'apphosting.GetSystemStatsResponse', output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(
                self, 'apphosting.GetSystemStatsResponse', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.GetSystemStatsResponse', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_cpu_ != x.has_cpu_: return 0
        if self.has_cpu_ and self.cpu_ != x.cpu_: return 0
        if self.has_memory_ != x.has_memory_: return 0
        if self.has_memory_ and self.memory_ != x.memory_: return 0
        return 1

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        if (self.has_cpu_ and not self.cpu_.IsInitialized(debug_strs)):
            initialized = 0
        if (self.has_memory_ and not self.memory_.IsInitialized(debug_strs)):
            initialized = 0
        return initialized

    def ByteSize(self):
        n = 0
        if (self.has_cpu_): n += 1 + self.lengthString(self.cpu_.ByteSize())
        if (self.has_memory_):
            n += 1 + self.lengthString(self.memory_.ByteSize())
        return n

    def ByteSizePartial(self):
        n = 0
        if (self.has_cpu_):
            n += 1 + self.lengthString(self.cpu_.ByteSizePartial())
        if (self.has_memory_):
            n += 1 + self.lengthString(self.memory_.ByteSizePartial())
        return n

    def Clear(self):
        self.clear_cpu()
        self.clear_memory()

    def OutputUnchecked(self, out):
        if (self.has_cpu_):
            out.putVarInt32(10)
            out.putVarInt32(self.cpu_.ByteSize())
            self.cpu_.OutputUnchecked(out)
        if (self.has_memory_):
            out.putVarInt32(18)
            out.putVarInt32(self.memory_.ByteSize())
            self.memory_.OutputUnchecked(out)

    def OutputPartial(self, out):
        if (self.has_cpu_):
            out.putVarInt32(10)
            out.putVarInt32(self.cpu_.ByteSizePartial())
            self.cpu_.OutputPartial(out)
        if (self.has_memory_):
            out.putVarInt32(18)
            out.putVarInt32(self.memory_.ByteSizePartial())
            self.memory_.OutputPartial(out)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 10:
                length = d.getVarInt32()
                tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(),
                                             d.pos() + length)
                d.skip(length)
                self.mutable_cpu().TryMerge(tmp)
                continue
            if tt == 18:
                length = d.getVarInt32()
                tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(),
                                             d.pos() + length)
                d.skip(length)
                self.mutable_memory().TryMerge(tmp)
                continue

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)

    def __str__(self, prefix="", printElemNumber=0):
        res = ""
        if self.has_cpu_:
            res += prefix + "cpu <\n"
            res += self.cpu_.__str__(prefix + "  ", printElemNumber)
            res += prefix + ">\n"
        if self.has_memory_:
            res += prefix + "memory <\n"
            res += self.memory_.__str__(prefix + "  ", printElemNumber)
            res += prefix + ">\n"
        return res

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

    kcpu = 1
    kmemory = 2

    _TEXT = _BuildTagLookupTable({
        0: "ErrorCode",
        1: "cpu",
        2: "memory",
    }, 2)

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

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _PROTO_DESCRIPTOR_NAME = 'apphosting.GetSystemStatsResponse'
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WiphcHBob3N0aW5nL2FwaS9zeXN0ZW0vc3lzdGVtX3NlcnZpY2UucHJvdG8KIWFwcGhvc3RpbmcuR2V0U3lzdGVtU3RhdHNSZXNwb25zZRMaA2NwdSABKAIwCzgBShVhcHBob3N0aW5nLlN5c3RlbVN0YXSjAaoBBWN0eXBlsgEGcHJvdG8ypAEUExoGbWVtb3J5IAIoAjALOAFKFWFwcGhvc3RpbmcuU3lzdGVtU3RhdKMBqgEFY3R5cGWyAQZwcm90bzKkARTCAR1hcHBob3N0aW5nLlN5c3RlbVNlcnZpY2VFcnJvcg=="
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 8
0
class CrawlReportRequest(ProtocolBuffer.ProtocolMessage):

  URL_INFO_COMMAND =    0 
  CRAWL_QUEUE_COMMAND =    1 

  _CrawlReportCommand_NAMES = {
    0: "URL_INFO_COMMAND",
    1: "CRAWL_QUEUE_COMMAND",
  }

  def CrawlReportCommand_Name(cls, x): return cls._CrawlReportCommand_NAMES.get(x, "")
  CrawlReportCommand_Name = classmethod(CrawlReportCommand_Name)

  def __init__(self, contents=None):
    self.commandtype_ = 0
    self.urlinfoparams_ = None
    self.crawlqueueparams_ = None
    self.has_commandtype_ = 0
    self.has_urlinfoparams_ = 0
    self.has_crawlqueueparams_ = 0
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents)

  def commandtype(self): return self.commandtype_

  def set_commandtype(self, x):
    self.has_commandtype_ = 1
    self.commandtype_ = x

  def clear_commandtype(self):
    self.has_commandtype_ = 0
    self.commandtype_ = 0

  def has_commandtype(self): return self.has_commandtype_

  def urlinfoparams(self):
    if self.urlinfoparams_ is None:
      self.lazy_init_lock_.acquire()
      try:
        if self.urlinfoparams_ is None: self.urlinfoparams_ = CrawlReportRequest_UrlInfoParams()
      finally:
        self.lazy_init_lock_.release()
    return self.urlinfoparams_

  def mutable_urlinfoparams(self): self.has_urlinfoparams_ = 1; return self.urlinfoparams()

  def clear_urlinfoparams(self):
    #Warning: this method does not acquire the lock.
    self.has_urlinfoparams_ = 0;
    if self.urlinfoparams_ is not None: self.urlinfoparams_.Clear()

  def has_urlinfoparams(self): return self.has_urlinfoparams_

  def crawlqueueparams(self):
    if self.crawlqueueparams_ is None:
      self.lazy_init_lock_.acquire()
      try:
        if self.crawlqueueparams_ is None: self.crawlqueueparams_ = CrawlReportRequest_CrawlQueueParams()
      finally:
        self.lazy_init_lock_.release()
    return self.crawlqueueparams_

  def mutable_crawlqueueparams(self): self.has_crawlqueueparams_ = 1; return self.crawlqueueparams()

  def clear_crawlqueueparams(self):
    #Warning: this method does not acquire the lock.
    self.has_crawlqueueparams_ = 0;
    if self.crawlqueueparams_ is not None: self.crawlqueueparams_.Clear()

  def has_crawlqueueparams(self): return self.has_crawlqueueparams_


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_commandtype()): self.set_commandtype(x.commandtype())
    if (x.has_urlinfoparams()): self.mutable_urlinfoparams().MergeFrom(x.urlinfoparams())
    if (x.has_crawlqueueparams()): self.mutable_crawlqueueparams().MergeFrom(x.crawlqueueparams())

  def _CMergeFromString(self, s):
    _net_proto___parse__python.MergeFromString(self, 'CrawlReportRequest', s)

  def _CEncode(self):
    return _net_proto___parse__python.Encode(self, 'CrawlReportRequest')

  def _CToASCII(self, output_format):
    return _net_proto___parse__python.ToASCII(self, 'CrawlReportRequest', output_format)


  def ParseASCII(self, s):
    _net_proto___parse__python.ParseASCII(self, 'CrawlReportRequest', s)


  def ParseASCIIIgnoreUnknown(self, s):
    _net_proto___parse__python.ParseASCIIIgnoreUnknown(self, 'CrawlReportRequest', s)


  def Equals(self, x):
    if x is self: return 1
    if self.has_commandtype_ != x.has_commandtype_: return 0
    if self.has_commandtype_ and self.commandtype_ != x.commandtype_: return 0
    if self.has_urlinfoparams_ != x.has_urlinfoparams_: return 0
    if self.has_urlinfoparams_ and self.urlinfoparams_ != x.urlinfoparams_: return 0
    if self.has_crawlqueueparams_ != x.has_crawlqueueparams_: return 0
    if self.has_crawlqueueparams_ and self.crawlqueueparams_ != x.crawlqueueparams_: return 0
    return 1

  def __eq__(self, other):
    return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)

  def __ne__(self, other):
    return not (self == other)

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_commandtype_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: commandtype not set.')
    if (self.has_urlinfoparams_ and not self.urlinfoparams_.IsInitialized(debug_strs)): initialized = 0
    if (self.has_crawlqueueparams_ and not self.crawlqueueparams_.IsInitialized(debug_strs)): initialized = 0
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthVarInt64(self.commandtype_)
    if (self.has_urlinfoparams_): n += 2 + self.urlinfoparams_.ByteSize()
    if (self.has_crawlqueueparams_): n += 2 + self.crawlqueueparams_.ByteSize()
    return n + 1

  def Clear(self):
    self.clear_commandtype()
    self.clear_urlinfoparams()
    self.clear_crawlqueueparams()

  def OutputUnchecked(self, out):
    out.putVarInt32(8)
    out.putVarInt32(self.commandtype_)
    if (self.has_urlinfoparams_):
      out.putVarInt32(19)
      self.urlinfoparams_.OutputUnchecked(out)
      out.putVarInt32(20)
    if (self.has_crawlqueueparams_):
      out.putVarInt32(35)
      self.crawlqueueparams_.OutputUnchecked(out)
      out.putVarInt32(36)

  def TryMerge(self, d):
    while d.avail() > 0:
      tt = d.getVarInt32()
      if tt == 8:
        self.set_commandtype(d.getVarInt32())
        continue
      if tt == 19:
        self.mutable_urlinfoparams().TryMerge(d)
        continue
      if tt == 35:
        self.mutable_crawlqueueparams().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_commandtype_: res+=prefix+("CommandType: %s\n" % self.DebugFormatInt32(self.commandtype_))
    if self.has_urlinfoparams_:
      res+=prefix+"UrlInfoParams {\n"
      res+=self.urlinfoparams_.__str__(prefix + "  ", printElemNumber)
      res+=prefix+"}\n"
    if self.has_crawlqueueparams_:
      res+=prefix+"CrawlQueueParams {\n"
      res+=self.crawlqueueparams_.__str__(prefix + "  ", printElemNumber)
      res+=prefix+"}\n"
    return res

  kCommandType = 1
  kUrlInfoParamsGroup = 2
  kUrlInfoParamsUrl = 3
  kCrawlQueueParamsGroup = 4
  kCrawlQueueParamsNumURLs = 5
  kCrawlQueueParamsNextHours = 6
  kCrawlQueueParamsHost = 7

  _TEXT = (
   "ErrorCode",  #   0
   "CommandType",  #   1
   "UrlInfoParams",  #   2
   "Url",  #   3
   "CrawlQueueParams",  #   4
   "NumURLs",  #   5
   "NextHours",  #   6
   "Host",  #   7
  )

  _TYPES = (
   ProtocolBuffer.Encoder.NUMERIC,  #   0
   ProtocolBuffer.Encoder.NUMERIC,  #   1

   ProtocolBuffer.Encoder.STARTGROUP,  #   2

   ProtocolBuffer.Encoder.STRING,  #   3

   ProtocolBuffer.Encoder.STARTGROUP,  #   4

   ProtocolBuffer.Encoder.NUMERIC,  #   5

   ProtocolBuffer.Encoder.NUMERIC,  #   6

   ProtocolBuffer.Encoder.STRING,  #   7

  )

  # stylesheet for XML output
  _STYLE = \
   """"""
  _STYLE_CONTENT_TYPE = \
   """"""
  _SERIALIZED_DESCRIPTOR = array.array('B', [
    0x5a,
    0x3d,
    0x65,
    0x6e,
    0x74,
    0x65,
    0x72,
    0x70,
    0x72,
    0x69,
    0x73,
    0x65,
    0x2f,
    0x73,
    0x75,
    0x70,
    0x65,
    0x72,
    0x67,
    0x73,
    0x61,
    0x2f,
    0x70,
    0x6c,
    0x61,
    0x6e,
    0x6e,
    0x65,
    0x72,
    0x2f,
    0x6c,
    0x6f,
    0x6e,
    0x67,
    0x70,
    0x6c,
    0x61,
    0x6e,
    0x6e,
    0x65,
    0x72,
    0x2f,
    0x72,
    0x70,
    0x63,
    0x2f,
    0x63,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x72,
    0x65,
    0x70,
    0x6f,
    0x72,
    0x74,
    0x2e,
    0x70,
    0x72,
    0x6f,
    0x74,
    0x6f,
    0x0a,
    0x12,
    0x43,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x52,
    0x65,
    0x70,
    0x6f,
    0x72,
    0x74,
    0x52,
    0x65,
    0x71,
    0x75,
    0x65,
    0x73,
    0x74,
    0x13,
    0x1a,
    0x0b,
    0x43,
    0x6f,
    0x6d,
    0x6d,
    0x61,
    0x6e,
    0x64,
    0x54,
    0x79,
    0x70,
    0x65,
    0x20,
    0x01,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x02,
    0x14,
    0x13,
    0x1a,
    0x0d,
    0x55,
    0x72,
    0x6c,
    0x49,
    0x6e,
    0x66,
    0x6f,
    0x50,
    0x61,
    0x72,
    0x61,
    0x6d,
    0x73,
    0x20,
    0x02,
    0x28,
    0x03,
    0x30,
    0x0a,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x11,
    0x55,
    0x72,
    0x6c,
    0x49,
    0x6e,
    0x66,
    0x6f,
    0x50,
    0x61,
    0x72,
    0x61,
    0x6d,
    0x73,
    0x2e,
    0x55,
    0x72,
    0x6c,
    0x20,
    0x03,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x02,
    0x60,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x10,
    0x43,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x51,
    0x75,
    0x65,
    0x75,
    0x65,
    0x50,
    0x61,
    0x72,
    0x61,
    0x6d,
    0x73,
    0x20,
    0x04,
    0x28,
    0x03,
    0x30,
    0x0a,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x18,
    0x43,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x51,
    0x75,
    0x65,
    0x75,
    0x65,
    0x50,
    0x61,
    0x72,
    0x61,
    0x6d,
    0x73,
    0x2e,
    0x4e,
    0x75,
    0x6d,
    0x55,
    0x52,
    0x4c,
    0x73,
    0x20,
    0x05,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x02,
    0x60,
    0x03,
    0x14,
    0x13,
    0x1a,
    0x1a,
    0x43,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x51,
    0x75,
    0x65,
    0x75,
    0x65,
    0x50,
    0x61,
    0x72,
    0x61,
    0x6d,
    0x73,
    0x2e,
    0x4e,
    0x65,
    0x78,
    0x74,
    0x48,
    0x6f,
    0x75,
    0x72,
    0x73,
    0x20,
    0x06,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x02,
    0x60,
    0x03,
    0x14,
    0x13,
    0x1a,
    0x15,
    0x43,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x51,
    0x75,
    0x65,
    0x75,
    0x65,
    0x50,
    0x61,
    0x72,
    0x61,
    0x6d,
    0x73,
    0x2e,
    0x48,
    0x6f,
    0x73,
    0x74,
    0x20,
    0x07,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x01,
    0x60,
    0x03,
    0x14,
    0x73,
    0x7a,
    0x12,
    0x43,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x52,
    0x65,
    0x70,
    0x6f,
    0x72,
    0x74,
    0x43,
    0x6f,
    0x6d,
    0x6d,
    0x61,
    0x6e,
    0x64,
    0x8b,
    0x01,
    0x92,
    0x01,
    0x10,
    0x55,
    0x52,
    0x4c,
    0x5f,
    0x49,
    0x4e,
    0x46,
    0x4f,
    0x5f,
    0x43,
    0x4f,
    0x4d,
    0x4d,
    0x41,
    0x4e,
    0x44,
    0x98,
    0x01,
    0x00,
    0x8c,
    0x01,
    0x8b,
    0x01,
    0x92,
    0x01,
    0x13,
    0x43,
    0x52,
    0x41,
    0x57,
    0x4c,
    0x5f,
    0x51,
    0x55,
    0x45,
    0x55,
    0x45,
    0x5f,
    0x43,
    0x4f,
    0x4d,
    0x4d,
    0x41,
    0x4e,
    0x44,
    0x98,
    0x01,
    0x01,
    0x8c,
    0x01,
    0x74,
    ])
  _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 9
0
class UrlInfo(ProtocolBuffer.ProtocolMessage):
  def __init__(self, contents=None):
    self.path_ = ""
    self.pagerank_ = 0
    self.lastcrawledtime_ = 0
    self.changeinterval_ = 0
    self.nextcrawltime_ = 0
    self.isprobablyindexed_ = 0
    self.priority_ = 0.0
    self.has_path_ = 0
    self.has_pagerank_ = 0
    self.has_lastcrawledtime_ = 0
    self.has_changeinterval_ = 0
    self.has_nextcrawltime_ = 0
    self.has_isprobablyindexed_ = 0
    self.has_priority_ = 0
    if contents is not None: self.MergeFromString(contents)

  def path(self): return self.path_

  def set_path(self, x):
    self.has_path_ = 1
    self.path_ = x

  def clear_path(self):
    self.has_path_ = 0
    self.path_ = ""

  def has_path(self): return self.has_path_

  def pagerank(self): return self.pagerank_

  def set_pagerank(self, x):
    self.has_pagerank_ = 1
    self.pagerank_ = x

  def clear_pagerank(self):
    self.has_pagerank_ = 0
    self.pagerank_ = 0

  def has_pagerank(self): return self.has_pagerank_

  def lastcrawledtime(self): return self.lastcrawledtime_

  def set_lastcrawledtime(self, x):
    self.has_lastcrawledtime_ = 1
    self.lastcrawledtime_ = x

  def clear_lastcrawledtime(self):
    self.has_lastcrawledtime_ = 0
    self.lastcrawledtime_ = 0

  def has_lastcrawledtime(self): return self.has_lastcrawledtime_

  def changeinterval(self): return self.changeinterval_

  def set_changeinterval(self, x):
    self.has_changeinterval_ = 1
    self.changeinterval_ = x

  def clear_changeinterval(self):
    self.has_changeinterval_ = 0
    self.changeinterval_ = 0

  def has_changeinterval(self): return self.has_changeinterval_

  def nextcrawltime(self): return self.nextcrawltime_

  def set_nextcrawltime(self, x):
    self.has_nextcrawltime_ = 1
    self.nextcrawltime_ = x

  def clear_nextcrawltime(self):
    self.has_nextcrawltime_ = 0
    self.nextcrawltime_ = 0

  def has_nextcrawltime(self): return self.has_nextcrawltime_

  def isprobablyindexed(self): return self.isprobablyindexed_

  def set_isprobablyindexed(self, x):
    self.has_isprobablyindexed_ = 1
    self.isprobablyindexed_ = x

  def clear_isprobablyindexed(self):
    self.has_isprobablyindexed_ = 0
    self.isprobablyindexed_ = 0

  def has_isprobablyindexed(self): return self.has_isprobablyindexed_

  def priority(self): return self.priority_

  def set_priority(self, x):
    self.has_priority_ = 1
    self.priority_ = x

  def clear_priority(self):
    self.has_priority_ = 0
    self.priority_ = 0.0

  def has_priority(self): return self.has_priority_


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_path()): self.set_path(x.path())
    if (x.has_pagerank()): self.set_pagerank(x.pagerank())
    if (x.has_lastcrawledtime()): self.set_lastcrawledtime(x.lastcrawledtime())
    if (x.has_changeinterval()): self.set_changeinterval(x.changeinterval())
    if (x.has_nextcrawltime()): self.set_nextcrawltime(x.nextcrawltime())
    if (x.has_isprobablyindexed()): self.set_isprobablyindexed(x.isprobablyindexed())
    if (x.has_priority()): self.set_priority(x.priority())

  def _CMergeFromString(self, s):
    _net_proto___parse__python.MergeFromString(self, 'UrlInfo', s)

  def _CEncode(self):
    return _net_proto___parse__python.Encode(self, 'UrlInfo')

  def _CToASCII(self, output_format):
    return _net_proto___parse__python.ToASCII(self, 'UrlInfo', output_format)


  def ParseASCII(self, s):
    _net_proto___parse__python.ParseASCII(self, 'UrlInfo', s)


  def ParseASCIIIgnoreUnknown(self, s):
    _net_proto___parse__python.ParseASCIIIgnoreUnknown(self, 'UrlInfo', s)


  def Equals(self, x):
    if x is self: return 1
    if self.has_path_ != x.has_path_: return 0
    if self.has_path_ and self.path_ != x.path_: return 0
    if self.has_pagerank_ != x.has_pagerank_: return 0
    if self.has_pagerank_ and self.pagerank_ != x.pagerank_: return 0
    if self.has_lastcrawledtime_ != x.has_lastcrawledtime_: return 0
    if self.has_lastcrawledtime_ and self.lastcrawledtime_ != x.lastcrawledtime_: return 0
    if self.has_changeinterval_ != x.has_changeinterval_: return 0
    if self.has_changeinterval_ and self.changeinterval_ != x.changeinterval_: return 0
    if self.has_nextcrawltime_ != x.has_nextcrawltime_: return 0
    if self.has_nextcrawltime_ and self.nextcrawltime_ != x.nextcrawltime_: return 0
    if self.has_isprobablyindexed_ != x.has_isprobablyindexed_: return 0
    if self.has_isprobablyindexed_ and self.isprobablyindexed_ != x.isprobablyindexed_: return 0
    if self.has_priority_ != x.has_priority_: return 0
    if self.has_priority_ and self.priority_ != x.priority_: return 0
    return 1

  def __eq__(self, other):
    return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)

  def __ne__(self, other):
    return not (self == other)

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

  def ByteSize(self):
    n = 0
    n += self.lengthString(len(self.path_))
    if (self.has_pagerank_): n += 1 + self.lengthVarInt64(self.pagerank_)
    if (self.has_lastcrawledtime_): n += 1 + self.lengthVarInt64(self.lastcrawledtime_)
    if (self.has_changeinterval_): n += 1 + self.lengthVarInt64(self.changeinterval_)
    if (self.has_nextcrawltime_): n += 1 + self.lengthVarInt64(self.nextcrawltime_)
    if (self.has_isprobablyindexed_): n += 2
    if (self.has_priority_): n += 9
    return n + 1

  def Clear(self):
    self.clear_path()
    self.clear_pagerank()
    self.clear_lastcrawledtime()
    self.clear_changeinterval()
    self.clear_nextcrawltime()
    self.clear_isprobablyindexed()
    self.clear_priority()

  def OutputUnchecked(self, out):
    out.putVarInt32(10)
    out.putPrefixedString(self.path_)
    if (self.has_pagerank_):
      out.putVarInt32(16)
      out.putVarInt32(self.pagerank_)
    if (self.has_lastcrawledtime_):
      out.putVarInt32(24)
      out.putVarInt32(self.lastcrawledtime_)
    if (self.has_changeinterval_):
      out.putVarInt32(32)
      out.putVarInt32(self.changeinterval_)
    if (self.has_nextcrawltime_):
      out.putVarInt32(40)
      out.putVarInt32(self.nextcrawltime_)
    if (self.has_isprobablyindexed_):
      out.putVarInt32(48)
      out.putBoolean(self.isprobablyindexed_)
    if (self.has_priority_):
      out.putVarInt32(57)
      out.putDouble(self.priority_)

  def TryMerge(self, d):
    while d.avail() > 0:
      tt = d.getVarInt32()
      if tt == 10:
        self.set_path(d.getPrefixedString())
        continue
      if tt == 16:
        self.set_pagerank(d.getVarInt32())
        continue
      if tt == 24:
        self.set_lastcrawledtime(d.getVarInt32())
        continue
      if tt == 32:
        self.set_changeinterval(d.getVarInt32())
        continue
      if tt == 40:
        self.set_nextcrawltime(d.getVarInt32())
        continue
      if tt == 48:
        self.set_isprobablyindexed(d.getBoolean())
        continue
      if tt == 57:
        self.set_priority(d.getDouble())
        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_path_: res+=prefix+("Path: %s\n" % self.DebugFormatString(self.path_))
    if self.has_pagerank_: res+=prefix+("PageRank: %s\n" % self.DebugFormatInt32(self.pagerank_))
    if self.has_lastcrawledtime_: res+=prefix+("LastCrawledTime: %s\n" % self.DebugFormatInt32(self.lastcrawledtime_))
    if self.has_changeinterval_: res+=prefix+("ChangeInterval: %s\n" % self.DebugFormatInt32(self.changeinterval_))
    if self.has_nextcrawltime_: res+=prefix+("NextCrawlTime: %s\n" % self.DebugFormatInt32(self.nextcrawltime_))
    if self.has_isprobablyindexed_: res+=prefix+("IsProbablyIndexed: %s\n" % self.DebugFormatBool(self.isprobablyindexed_))
    if self.has_priority_: res+=prefix+("Priority: %s\n" % self.DebugFormat(self.priority_))
    return res

  kPath = 1
  kPageRank = 2
  kLastCrawledTime = 3
  kChangeInterval = 4
  kNextCrawlTime = 5
  kIsProbablyIndexed = 6
  kPriority = 7

  _TEXT = (
   "ErrorCode",  #   0
   "Path",  #   1
   "PageRank",  #   2
   "LastCrawledTime",  #   3
   "ChangeInterval",  #   4
   "NextCrawlTime",  #   5
   "IsProbablyIndexed",  #   6
   "Priority",  #   7
  )

  _TYPES = (
   ProtocolBuffer.Encoder.NUMERIC,  #   0
   ProtocolBuffer.Encoder.STRING,  #   1

   ProtocolBuffer.Encoder.NUMERIC,  #   2

   ProtocolBuffer.Encoder.NUMERIC,  #   3

   ProtocolBuffer.Encoder.NUMERIC,  #   4

   ProtocolBuffer.Encoder.NUMERIC,  #   5

   ProtocolBuffer.Encoder.NUMERIC,  #   6

   ProtocolBuffer.Encoder.DOUBLE,  #   7

  )

  # stylesheet for XML output
  _STYLE = \
   """"""
  _STYLE_CONTENT_TYPE = \
   """"""
  _SERIALIZED_DESCRIPTOR = array.array('B', [
    0x5a,
    0x3d,
    0x65,
    0x6e,
    0x74,
    0x65,
    0x72,
    0x70,
    0x72,
    0x69,
    0x73,
    0x65,
    0x2f,
    0x73,
    0x75,
    0x70,
    0x65,
    0x72,
    0x67,
    0x73,
    0x61,
    0x2f,
    0x70,
    0x6c,
    0x61,
    0x6e,
    0x6e,
    0x65,
    0x72,
    0x2f,
    0x6c,
    0x6f,
    0x6e,
    0x67,
    0x70,
    0x6c,
    0x61,
    0x6e,
    0x6e,
    0x65,
    0x72,
    0x2f,
    0x72,
    0x70,
    0x63,
    0x2f,
    0x63,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x72,
    0x65,
    0x70,
    0x6f,
    0x72,
    0x74,
    0x2e,
    0x70,
    0x72,
    0x6f,
    0x74,
    0x6f,
    0x0a,
    0x07,
    0x55,
    0x72,
    0x6c,
    0x49,
    0x6e,
    0x66,
    0x6f,
    0x13,
    0x1a,
    0x04,
    0x50,
    0x61,
    0x74,
    0x68,
    0x20,
    0x01,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x02,
    0x14,
    0x13,
    0x1a,
    0x08,
    0x50,
    0x61,
    0x67,
    0x65,
    0x52,
    0x61,
    0x6e,
    0x6b,
    0x20,
    0x02,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x0f,
    0x4c,
    0x61,
    0x73,
    0x74,
    0x43,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x65,
    0x64,
    0x54,
    0x69,
    0x6d,
    0x65,
    0x20,
    0x03,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x0e,
    0x43,
    0x68,
    0x61,
    0x6e,
    0x67,
    0x65,
    0x49,
    0x6e,
    0x74,
    0x65,
    0x72,
    0x76,
    0x61,
    0x6c,
    0x20,
    0x04,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x0d,
    0x4e,
    0x65,
    0x78,
    0x74,
    0x43,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x54,
    0x69,
    0x6d,
    0x65,
    0x20,
    0x05,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x11,
    0x49,
    0x73,
    0x50,
    0x72,
    0x6f,
    0x62,
    0x61,
    0x62,
    0x6c,
    0x79,
    0x49,
    0x6e,
    0x64,
    0x65,
    0x78,
    0x65,
    0x64,
    0x20,
    0x06,
    0x28,
    0x00,
    0x30,
    0x08,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x08,
    0x50,
    0x72,
    0x69,
    0x6f,
    0x72,
    0x69,
    0x74,
    0x79,
    0x20,
    0x07,
    0x28,
    0x01,
    0x30,
    0x01,
    0x38,
    0x01,
    0x14,
    ])
  _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
class SetDefaultGcsBucketNameRequest(ProtocolBuffer.ProtocolMessage):
    has_default_gcs_bucket_name_ = 0
    default_gcs_bucket_name_ = ""

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

    def default_gcs_bucket_name(self):
        return self.default_gcs_bucket_name_

    def set_default_gcs_bucket_name(self, x):
        self.has_default_gcs_bucket_name_ = 1
        self.default_gcs_bucket_name_ = x

    def clear_default_gcs_bucket_name(self):
        if self.has_default_gcs_bucket_name_:
            self.has_default_gcs_bucket_name_ = 0
            self.default_gcs_bucket_name_ = ""

    def has_default_gcs_bucket_name(self):
        return self.has_default_gcs_bucket_name_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_default_gcs_bucket_name()):
            self.set_default_gcs_bucket_name(x.default_gcs_bucket_name())

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.SetDefaultGcsBucketNameRequest', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(
                self, 'apphosting.SetDefaultGcsBucketNameRequest')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.SetDefaultGcsBucketNameRequest')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(
                self, 'apphosting.SetDefaultGcsBucketNameRequest',
                output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(
                self, 'apphosting.SetDefaultGcsBucketNameRequest', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.SetDefaultGcsBucketNameRequest', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_default_gcs_bucket_name_ != x.has_default_gcs_bucket_name_:
            return 0
        if self.has_default_gcs_bucket_name_ and self.default_gcs_bucket_name_ != x.default_gcs_bucket_name_:
            return 0
        return 1

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        return initialized

    def ByteSize(self):
        n = 0
        if (self.has_default_gcs_bucket_name_):
            n += 1 + self.lengthString(len(self.default_gcs_bucket_name_))
        return n

    def ByteSizePartial(self):
        n = 0
        if (self.has_default_gcs_bucket_name_):
            n += 1 + self.lengthString(len(self.default_gcs_bucket_name_))
        return n

    def Clear(self):
        self.clear_default_gcs_bucket_name()

    def OutputUnchecked(self, out):
        if (self.has_default_gcs_bucket_name_):
            out.putVarInt32(10)
            out.putPrefixedString(self.default_gcs_bucket_name_)

    def OutputPartial(self, out):
        if (self.has_default_gcs_bucket_name_):
            out.putVarInt32(10)
            out.putPrefixedString(self.default_gcs_bucket_name_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 10:
                self.set_default_gcs_bucket_name(d.getPrefixedString())
                continue

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError()
            d.skipData(tt)

    def __str__(self, prefix="", printElemNumber=0):
        res = ""
        if self.has_default_gcs_bucket_name_:
            res += prefix + (
                "default_gcs_bucket_name: %s\n" %
                self.DebugFormatString(self.default_gcs_bucket_name_))
        return res

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

    kdefault_gcs_bucket_name = 1

    _TEXT = _BuildTagLookupTable(
        {
            0: "ErrorCode",
            1: "default_gcs_bucket_name",
        }, 1)

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

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _PROTO_DESCRIPTOR_NAME = 'apphosting.SetDefaultGcsBucketNameRequest'
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WjthcHBob3N0aW5nL2FwaS9hcHBfaWRlbnRpdHkvYXBwX2lkZW50aXR5X3N0dWJfc2VydmljZS5wcm90bwopYXBwaG9zdGluZy5TZXREZWZhdWx0R2NzQnVja2V0TmFtZVJlcXVlc3QTGhdkZWZhdWx0X2djc19idWNrZXRfbmFtZSABKAIwCTgBFLoB7AIKO2FwcGhvc3RpbmcvYXBpL2FwcF9pZGVudGl0eS9hcHBfaWRlbnRpdHlfc3R1Yl9zZXJ2aWNlLnByb3RvEgphcHBob3N0aW5nGh1hcHBob3N0aW5nL2FwaS9hcGlfYmFzZS5wcm90byJBCh5TZXREZWZhdWx0R2NzQnVja2V0TmFtZVJlcXVlc3QSHwoXZGVmYXVsdF9nY3NfYnVja2V0X25hbWUYASABKAkyfQoWQXBwSWRlbnRpdHlTdHViU2VydmljZRJjChdTZXREZWZhdWx0R2NzQnVja2V0TmFtZRIqLmFwcGhvc3RpbmcuU2V0RGVmYXVsdEdjc0J1Y2tldE5hbWVSZXF1ZXN0GhouYXBwaG9zdGluZy5iYXNlLlZvaWRQcm90byIAQkAKJGNvbS5nb29nbGUuYXBwZW5naW5lLmFwaS5hcHBpZGVudGl0eUIYQXBwSWRlbnRpdHlTdHViU2VydmljZVBi"
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 11
0
class CrawlQueueResponse(ProtocolBuffer.ProtocolMessage):
  def __init__(self, contents=None):
    self.numurls_ = 0
    self.captiontime_ = 0
    self.hostqueue_ = []
    self.futurequeue_ = None
    self.has_numurls_ = 0
    self.has_captiontime_ = 0
    self.has_futurequeue_ = 0
    self.lazy_init_lock_ = thread.allocate_lock()
    if contents is not None: self.MergeFromString(contents)

  def numurls(self): return self.numurls_

  def set_numurls(self, x):
    self.has_numurls_ = 1
    self.numurls_ = x

  def clear_numurls(self):
    self.has_numurls_ = 0
    self.numurls_ = 0

  def has_numurls(self): return self.has_numurls_

  def captiontime(self): return self.captiontime_

  def set_captiontime(self, x):
    self.has_captiontime_ = 1
    self.captiontime_ = x

  def clear_captiontime(self):
    self.has_captiontime_ = 0
    self.captiontime_ = 0

  def has_captiontime(self): return self.has_captiontime_

  def hostqueue_size(self): return len(self.hostqueue_)
  def hostqueue_list(self): return self.hostqueue_

  def hostqueue(self, i):
    return self.hostqueue_[i]

  def mutable_hostqueue(self, i):
    return self.hostqueue_[i]

  def add_hostqueue(self):
    x = CrawlQueueResponse_HostQueue()
    self.hostqueue_.append(x)
    return x

  def clear_hostqueue(self):
    self.hostqueue_ = []
  def futurequeue(self):
    if self.futurequeue_ is None:
      self.lazy_init_lock_.acquire()
      try:
        if self.futurequeue_ is None: self.futurequeue_ = CrawlQueueResponse_FutureQueue()
      finally:
        self.lazy_init_lock_.release()
    return self.futurequeue_

  def mutable_futurequeue(self): self.has_futurequeue_ = 1; return self.futurequeue()

  def clear_futurequeue(self):
    #Warning: this method does not acquire the lock.
    self.has_futurequeue_ = 0;
    if self.futurequeue_ is not None: self.futurequeue_.Clear()

  def has_futurequeue(self): return self.has_futurequeue_


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_numurls()): self.set_numurls(x.numurls())
    if (x.has_captiontime()): self.set_captiontime(x.captiontime())
    for i in xrange(x.hostqueue_size()): self.add_hostqueue().CopyFrom(x.hostqueue(i))
    if (x.has_futurequeue()): self.mutable_futurequeue().MergeFrom(x.futurequeue())

  def _CMergeFromString(self, s):
    _net_proto___parse__python.MergeFromString(self, 'CrawlQueueResponse', s)

  def _CEncode(self):
    return _net_proto___parse__python.Encode(self, 'CrawlQueueResponse')

  def _CToASCII(self, output_format):
    return _net_proto___parse__python.ToASCII(self, 'CrawlQueueResponse', output_format)


  def ParseASCII(self, s):
    _net_proto___parse__python.ParseASCII(self, 'CrawlQueueResponse', s)


  def ParseASCIIIgnoreUnknown(self, s):
    _net_proto___parse__python.ParseASCIIIgnoreUnknown(self, 'CrawlQueueResponse', s)


  def Equals(self, x):
    if x is self: return 1
    if self.has_numurls_ != x.has_numurls_: return 0
    if self.has_numurls_ and self.numurls_ != x.numurls_: return 0
    if self.has_captiontime_ != x.has_captiontime_: return 0
    if self.has_captiontime_ and self.captiontime_ != x.captiontime_: return 0
    if len(self.hostqueue_) != len(x.hostqueue_): return 0
    for e1, e2 in zip(self.hostqueue_, x.hostqueue_):
      if e1 != e2: return 0
    if self.has_futurequeue_ != x.has_futurequeue_: return 0
    if self.has_futurequeue_ and self.futurequeue_ != x.futurequeue_: return 0
    return 1

  def __eq__(self, other):
    return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)

  def __ne__(self, other):
    return not (self == other)

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_numurls_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: numurls not set.')
    if (not self.has_captiontime_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: captiontime not set.')
    for i in xrange(len(self.hostqueue_)):
      if (not self.hostqueue_[i].IsInitialized(debug_strs)): initialized=0
    if (self.has_futurequeue_ and not self.futurequeue_.IsInitialized(debug_strs)): initialized = 0
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthVarInt64(self.numurls_)
    n += self.lengthVarInt64(self.captiontime_)
    n += 2 * len(self.hostqueue_)
    for i in xrange(len(self.hostqueue_)): n += self.hostqueue_[i].ByteSize()
    if (self.has_futurequeue_): n += 2 + self.futurequeue_.ByteSize()
    return n + 2

  def Clear(self):
    self.clear_numurls()
    self.clear_captiontime()
    self.clear_hostqueue()
    self.clear_futurequeue()

  def OutputUnchecked(self, out):
    out.putVarInt32(8)
    out.putVarInt32(self.numurls_)
    out.putVarInt32(16)
    out.putVarInt32(self.captiontime_)
    for i in xrange(len(self.hostqueue_)):
      out.putVarInt32(27)
      self.hostqueue_[i].OutputUnchecked(out)
      out.putVarInt32(28)
    if (self.has_futurequeue_):
      out.putVarInt32(51)
      self.futurequeue_.OutputUnchecked(out)
      out.putVarInt32(52)

  def TryMerge(self, d):
    while d.avail() > 0:
      tt = d.getVarInt32()
      if tt == 8:
        self.set_numurls(d.getVarInt32())
        continue
      if tt == 16:
        self.set_captiontime(d.getVarInt32())
        continue
      if tt == 27:
        self.add_hostqueue().TryMerge(d)
        continue
      if tt == 51:
        self.mutable_futurequeue().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_numurls_: res+=prefix+("NumURLs: %s\n" % self.DebugFormatInt32(self.numurls_))
    if self.has_captiontime_: res+=prefix+("CaptionTime: %s\n" % self.DebugFormatInt32(self.captiontime_))
    cnt=0
    for e in self.hostqueue_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("HostQueue%s {\n" % elm)
      res+=e.__str__(prefix + "  ", printElemNumber)
      res+=prefix+"}\n"
      cnt+=1
    if self.has_futurequeue_:
      res+=prefix+"FutureQueue {\n"
      res+=self.futurequeue_.__str__(prefix + "  ", printElemNumber)
      res+=prefix+"}\n"
    return res

  kNumURLs = 1
  kCaptionTime = 2
  kHostQueueGroup = 3
  kHostQueueHost = 4
  kHostQueueUrls = 5
  kFutureQueueGroup = 6
  kFutureQueueUrls = 7

  _TEXT = (
   "ErrorCode",  #   0
   "NumURLs",  #   1
   "CaptionTime",  #   2
   "HostQueue",  #   3
   "Host",  #   4
   "Urls",  #   5
   "FutureQueue",  #   6
   "Urls",  #   7
  )

  _TYPES = (
   ProtocolBuffer.Encoder.NUMERIC,  #   0
   ProtocolBuffer.Encoder.NUMERIC,  #   1

   ProtocolBuffer.Encoder.NUMERIC,  #   2

   ProtocolBuffer.Encoder.STARTGROUP,  #   3

   ProtocolBuffer.Encoder.STRING,  #   4

   ProtocolBuffer.Encoder.STRING,  #   5

   ProtocolBuffer.Encoder.STARTGROUP,  #   6

   ProtocolBuffer.Encoder.STRING,  #   7

  )

  # stylesheet for XML output
  _STYLE = \
   """"""
  _STYLE_CONTENT_TYPE = \
   """"""
  _SERIALIZED_DESCRIPTOR = array.array('B', [
    0x5a,
    0x3d,
    0x65,
    0x6e,
    0x74,
    0x65,
    0x72,
    0x70,
    0x72,
    0x69,
    0x73,
    0x65,
    0x2f,
    0x73,
    0x75,
    0x70,
    0x65,
    0x72,
    0x67,
    0x73,
    0x61,
    0x2f,
    0x70,
    0x6c,
    0x61,
    0x6e,
    0x6e,
    0x65,
    0x72,
    0x2f,
    0x6c,
    0x6f,
    0x6e,
    0x67,
    0x70,
    0x6c,
    0x61,
    0x6e,
    0x6e,
    0x65,
    0x72,
    0x2f,
    0x72,
    0x70,
    0x63,
    0x2f,
    0x63,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x72,
    0x65,
    0x70,
    0x6f,
    0x72,
    0x74,
    0x2e,
    0x70,
    0x72,
    0x6f,
    0x74,
    0x6f,
    0x0a,
    0x12,
    0x43,
    0x72,
    0x61,
    0x77,
    0x6c,
    0x51,
    0x75,
    0x65,
    0x75,
    0x65,
    0x52,
    0x65,
    0x73,
    0x70,
    0x6f,
    0x6e,
    0x73,
    0x65,
    0x13,
    0x1a,
    0x07,
    0x4e,
    0x75,
    0x6d,
    0x55,
    0x52,
    0x4c,
    0x73,
    0x20,
    0x01,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x02,
    0x14,
    0x13,
    0x1a,
    0x0b,
    0x43,
    0x61,
    0x70,
    0x74,
    0x69,
    0x6f,
    0x6e,
    0x54,
    0x69,
    0x6d,
    0x65,
    0x20,
    0x02,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x02,
    0x14,
    0x13,
    0x1a,
    0x09,
    0x48,
    0x6f,
    0x73,
    0x74,
    0x51,
    0x75,
    0x65,
    0x75,
    0x65,
    0x20,
    0x03,
    0x28,
    0x03,
    0x30,
    0x0a,
    0x38,
    0x03,
    0x14,
    0x13,
    0x1a,
    0x0e,
    0x48,
    0x6f,
    0x73,
    0x74,
    0x51,
    0x75,
    0x65,
    0x75,
    0x65,
    0x2e,
    0x48,
    0x6f,
    0x73,
    0x74,
    0x20,
    0x04,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x02,
    0x60,
    0x02,
    0x14,
    0x13,
    0x1a,
    0x0e,
    0x48,
    0x6f,
    0x73,
    0x74,
    0x51,
    0x75,
    0x65,
    0x75,
    0x65,
    0x2e,
    0x55,
    0x72,
    0x6c,
    0x73,
    0x20,
    0x05,
    0x28,
    0x02,
    0x30,
    0x0b,
    0x38,
    0x03,
    0x4a,
    0x07,
    0x55,
    0x72,
    0x6c,
    0x49,
    0x6e,
    0x66,
    0x6f,
    0x60,
    0x02,
    0x14,
    0x13,
    0x1a,
    0x0b,
    0x46,
    0x75,
    0x74,
    0x75,
    0x72,
    0x65,
    0x51,
    0x75,
    0x65,
    0x75,
    0x65,
    0x20,
    0x06,
    0x28,
    0x03,
    0x30,
    0x0a,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x10,
    0x46,
    0x75,
    0x74,
    0x75,
    0x72,
    0x65,
    0x51,
    0x75,
    0x65,
    0x75,
    0x65,
    0x2e,
    0x55,
    0x72,
    0x6c,
    0x73,
    0x20,
    0x07,
    0x28,
    0x02,
    0x30,
    0x0b,
    0x38,
    0x03,
    0x4a,
    0x07,
    0x55,
    0x72,
    0x6c,
    0x49,
    0x6e,
    0x66,
    0x6f,
    0x60,
    0x05,
    0x14,
    ])
  _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 12
0
class PageMap(ProtocolBuffer.ProtocolMessage):

    MESSAGE_TYPE_ID = 7292182

    _TypeId_NAMES = {
        7292182: "MESSAGE_TYPE_ID",
    }

    def TypeId_Name(cls, x):
        return cls._TypeId_NAMES.get(x, "")

    TypeId_Name = classmethod(TypeId_Name)

    def __init__(self, contents=None):
        self.templatetype_ = []
        self.dataobject_ = []
        self.richsnippet_as_onebox_ = None
        self.has_richsnippet_as_onebox_ = 0
        self.lazy_init_lock_ = thread.allocate_lock()
        if contents is not None: self.MergeFromString(contents)

    def templatetype_size(self):
        return len(self.templatetype_)

    def templatetype_list(self):
        return self.templatetype_

    def templatetype(self, i):
        return self.templatetype_[i]

    def mutable_templatetype(self, i):
        return self.templatetype_[i]

    def add_templatetype(self):
        x = PageMap_TemplateType()
        self.templatetype_.append(x)
        return x

    def clear_templatetype(self):
        self.templatetype_ = []

    def dataobject_size(self):
        return len(self.dataobject_)

    def dataobject_list(self):
        return self.dataobject_

    def dataobject(self, i):
        return self.dataobject_[i]

    def mutable_dataobject(self, i):
        return self.dataobject_[i]

    def add_dataobject(self):
        x = DataObject()
        self.dataobject_.append(x)
        return x

    def clear_dataobject(self):
        self.dataobject_ = []

    def richsnippet_as_onebox(self):
        if self.richsnippet_as_onebox_ is None:
            self.lazy_init_lock_.acquire()
            try:
                if self.richsnippet_as_onebox_ is None:
                    self.richsnippet_as_onebox_ = ProseOneboxProviderReply()
            finally:
                self.lazy_init_lock_.release()
        return self.richsnippet_as_onebox_

    def mutable_richsnippet_as_onebox(self):
        self.has_richsnippet_as_onebox_ = 1
        return self.richsnippet_as_onebox()

    def clear_richsnippet_as_onebox(self):
        #Warning: this method does not acquire the lock.
        self.has_richsnippet_as_onebox_ = 0
        if self.richsnippet_as_onebox_ is not None:
            self.richsnippet_as_onebox_.Clear()

    def has_richsnippet_as_onebox(self):
        return self.has_richsnippet_as_onebox_

    def MergeFrom(self, x):
        assert x is not self
        for i in xrange(x.templatetype_size()):
            self.add_templatetype().CopyFrom(x.templatetype(i))
        for i in xrange(x.dataobject_size()):
            self.add_dataobject().CopyFrom(x.dataobject(i))
        if (x.has_richsnippet_as_onebox()):
            self.mutable_richsnippet_as_onebox().MergeFrom(
                x.richsnippet_as_onebox())

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(self,
                                                   'richsnippets.PageMap', s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(self, 'richsnippets.PageMap')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(self, 'richsnippets.PageMap',
                                                  output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(self, 'richsnippets.PageMap', s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'richsnippets.PageMap', s)

    def Equals(self, x):
        if x is self: return 1
        if len(self.templatetype_) != len(x.templatetype_): return 0
        for e1, e2 in zip(self.templatetype_, x.templatetype_):
            if e1 != e2: return 0
        if len(self.dataobject_) != len(x.dataobject_): return 0
        for e1, e2 in zip(self.dataobject_, x.dataobject_):
            if e1 != e2: return 0
        if self.has_richsnippet_as_onebox_ != x.has_richsnippet_as_onebox_:
            return 0
        if self.has_richsnippet_as_onebox_ and self.richsnippet_as_onebox_ != x.richsnippet_as_onebox_:
            return 0
        return 1

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        for i in xrange(len(self.templatetype_)):
            if (not self.templatetype_[i].IsInitialized(debug_strs)):
                initialized = 0
        for i in xrange(len(self.dataobject_)):
            if (not self.dataobject_[i].IsInitialized(debug_strs)):
                initialized = 0
        if (self.has_richsnippet_as_onebox_
                and not self.richsnippet_as_onebox_.IsInitialized(debug_strs)):
            initialized = 0
        return initialized

    def ByteSize(self):
        n = 0
        n += 2 * len(self.templatetype_)
        for i in xrange(len(self.templatetype_)):
            n += self.templatetype_[i].ByteSize()
        n += 1 * len(self.dataobject_)
        for i in xrange(len(self.dataobject_)):
            n += self.lengthString(self.dataobject_[i].ByteSize())
        if (self.has_richsnippet_as_onebox_):
            n += 2 + self.lengthString(self.richsnippet_as_onebox_.ByteSize())
        return n + 0

    def Clear(self):
        self.clear_templatetype()
        self.clear_dataobject()
        self.clear_richsnippet_as_onebox()

    def OutputUnchecked(self, out):
        for i in xrange(len(self.templatetype_)):
            out.putVarInt32(11)
            self.templatetype_[i].OutputUnchecked(out)
            out.putVarInt32(12)
        for i in xrange(len(self.dataobject_)):
            out.putVarInt32(26)
            out.putVarInt32(self.dataobject_[i].ByteSize())
            self.dataobject_[i].OutputUnchecked(out)
        if (self.has_richsnippet_as_onebox_):
            out.putVarInt32(850)
            out.putVarInt32(self.richsnippet_as_onebox_.ByteSize())
            self.richsnippet_as_onebox_.OutputUnchecked(out)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 11:
                self.add_templatetype().TryMerge(d)
                continue
            if tt == 26:
                length = d.getVarInt32()
                tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(),
                                             d.pos() + length)
                d.skip(length)
                self.add_dataobject().TryMerge(tmp)
                continue
            if tt == 850:
                length = d.getVarInt32()
                tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(),
                                             d.pos() + length)
                d.skip(length)
                self.mutable_richsnippet_as_onebox().TryMerge(tmp)
                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 = ""
        cnt = 0
        for e in self.templatetype_:
            elm = ""
            if printElemNumber: elm = "(%d)" % cnt
            res += prefix + ("TemplateType%s {\n" % elm)
            res += e.__str__(prefix + "  ", printElemNumber)
            res += prefix + "}\n"
            cnt += 1
        cnt = 0
        for e in self.dataobject_:
            elm = ""
            if printElemNumber: elm = "(%d)" % cnt
            res += prefix + ("DataObject%s <\n" % elm)
            res += e.__str__(prefix + "  ", printElemNumber)
            res += prefix + ">\n"
            cnt += 1
        if self.has_richsnippet_as_onebox_:
            res += prefix + "richsnippet_as_onebox <\n"
            res += self.richsnippet_as_onebox_.__str__(prefix + "  ",
                                                       printElemNumber)
            res += prefix + ">\n"
        return res

    kTemplateTypeGroup = 1
    kTemplateTypesrc = 2
    kDataObject = 3
    krichsnippet_as_onebox = 106

    _TEXT = (
        "ErrorCode",  #   0
        "TemplateType",  #   1
        "src",  #   2
        "DataObject",  #   3
        None,  #   4
        None,  #   5
        None,  #   6
        None,  #   7
        None,  #   8
        None,  #   9
        None,  #  10
        None,  #  11
        None,  #  12
        None,  #  13
        None,  #  14
        None,  #  15
        None,  #  16
        None,  #  17
        None,  #  18
        None,  #  19
        None,  #  20
        None,  #  21
        None,  #  22
        None,  #  23
        None,  #  24
        None,  #  25
        None,  #  26
        None,  #  27
        None,  #  28
        None,  #  29
        None,  #  30
        None,  #  31
        None,  #  32
        None,  #  33
        None,  #  34
        None,  #  35
        None,  #  36
        None,  #  37
        None,  #  38
        None,  #  39
        None,  #  40
        None,  #  41
        None,  #  42
        None,  #  43
        None,  #  44
        None,  #  45
        None,  #  46
        None,  #  47
        None,  #  48
        None,  #  49
        None,  #  50
        None,  #  51
        None,  #  52
        None,  #  53
        None,  #  54
        None,  #  55
        None,  #  56
        None,  #  57
        None,  #  58
        None,  #  59
        None,  #  60
        None,  #  61
        None,  #  62
        None,  #  63
        None,  #  64
        None,  #  65
        None,  #  66
        None,  #  67
        None,  #  68
        None,  #  69
        None,  #  70
        None,  #  71
        None,  #  72
        None,  #  73
        None,  #  74
        None,  #  75
        None,  #  76
        None,  #  77
        None,  #  78
        None,  #  79
        None,  #  80
        None,  #  81
        None,  #  82
        None,  #  83
        None,  #  84
        None,  #  85
        None,  #  86
        None,  #  87
        None,  #  88
        None,  #  89
        None,  #  90
        None,  #  91
        None,  #  92
        None,  #  93
        None,  #  94
        None,  #  95
        None,  #  96
        None,  #  97
        None,  #  98
        None,  #  99
        None,  # 100
        None,  # 101
        None,  # 102
        None,  # 103
        None,  # 104
        None,  # 105
        "richsnippet_as_onebox",  # 106
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.STARTGROUP,  #   1
        ProtocolBuffer.Encoder.STRING,  #   2
        ProtocolBuffer.Encoder.STRING,  #   3
        ProtocolBuffer.Encoder.MAX_TYPE,  #   4
        ProtocolBuffer.Encoder.MAX_TYPE,  #   5
        ProtocolBuffer.Encoder.MAX_TYPE,  #   6
        ProtocolBuffer.Encoder.MAX_TYPE,  #   7
        ProtocolBuffer.Encoder.MAX_TYPE,  #   8
        ProtocolBuffer.Encoder.MAX_TYPE,  #   9
        ProtocolBuffer.Encoder.MAX_TYPE,  #  10
        ProtocolBuffer.Encoder.MAX_TYPE,  #  11
        ProtocolBuffer.Encoder.MAX_TYPE,  #  12
        ProtocolBuffer.Encoder.MAX_TYPE,  #  13
        ProtocolBuffer.Encoder.MAX_TYPE,  #  14
        ProtocolBuffer.Encoder.MAX_TYPE,  #  15
        ProtocolBuffer.Encoder.MAX_TYPE,  #  16
        ProtocolBuffer.Encoder.MAX_TYPE,  #  17
        ProtocolBuffer.Encoder.MAX_TYPE,  #  18
        ProtocolBuffer.Encoder.MAX_TYPE,  #  19
        ProtocolBuffer.Encoder.MAX_TYPE,  #  20
        ProtocolBuffer.Encoder.MAX_TYPE,  #  21
        ProtocolBuffer.Encoder.MAX_TYPE,  #  22
        ProtocolBuffer.Encoder.MAX_TYPE,  #  23
        ProtocolBuffer.Encoder.MAX_TYPE,  #  24
        ProtocolBuffer.Encoder.MAX_TYPE,  #  25
        ProtocolBuffer.Encoder.MAX_TYPE,  #  26
        ProtocolBuffer.Encoder.MAX_TYPE,  #  27
        ProtocolBuffer.Encoder.MAX_TYPE,  #  28
        ProtocolBuffer.Encoder.MAX_TYPE,  #  29
        ProtocolBuffer.Encoder.MAX_TYPE,  #  30
        ProtocolBuffer.Encoder.MAX_TYPE,  #  31
        ProtocolBuffer.Encoder.MAX_TYPE,  #  32
        ProtocolBuffer.Encoder.MAX_TYPE,  #  33
        ProtocolBuffer.Encoder.MAX_TYPE,  #  34
        ProtocolBuffer.Encoder.MAX_TYPE,  #  35
        ProtocolBuffer.Encoder.MAX_TYPE,  #  36
        ProtocolBuffer.Encoder.MAX_TYPE,  #  37
        ProtocolBuffer.Encoder.MAX_TYPE,  #  38
        ProtocolBuffer.Encoder.MAX_TYPE,  #  39
        ProtocolBuffer.Encoder.MAX_TYPE,  #  40
        ProtocolBuffer.Encoder.MAX_TYPE,  #  41
        ProtocolBuffer.Encoder.MAX_TYPE,  #  42
        ProtocolBuffer.Encoder.MAX_TYPE,  #  43
        ProtocolBuffer.Encoder.MAX_TYPE,  #  44
        ProtocolBuffer.Encoder.MAX_TYPE,  #  45
        ProtocolBuffer.Encoder.MAX_TYPE,  #  46
        ProtocolBuffer.Encoder.MAX_TYPE,  #  47
        ProtocolBuffer.Encoder.MAX_TYPE,  #  48
        ProtocolBuffer.Encoder.MAX_TYPE,  #  49
        ProtocolBuffer.Encoder.MAX_TYPE,  #  50
        ProtocolBuffer.Encoder.MAX_TYPE,  #  51
        ProtocolBuffer.Encoder.MAX_TYPE,  #  52
        ProtocolBuffer.Encoder.MAX_TYPE,  #  53
        ProtocolBuffer.Encoder.MAX_TYPE,  #  54
        ProtocolBuffer.Encoder.MAX_TYPE,  #  55
        ProtocolBuffer.Encoder.MAX_TYPE,  #  56
        ProtocolBuffer.Encoder.MAX_TYPE,  #  57
        ProtocolBuffer.Encoder.MAX_TYPE,  #  58
        ProtocolBuffer.Encoder.MAX_TYPE,  #  59
        ProtocolBuffer.Encoder.MAX_TYPE,  #  60
        ProtocolBuffer.Encoder.MAX_TYPE,  #  61
        ProtocolBuffer.Encoder.MAX_TYPE,  #  62
        ProtocolBuffer.Encoder.MAX_TYPE,  #  63
        ProtocolBuffer.Encoder.MAX_TYPE,  #  64
        ProtocolBuffer.Encoder.MAX_TYPE,  #  65
        ProtocolBuffer.Encoder.MAX_TYPE,  #  66
        ProtocolBuffer.Encoder.MAX_TYPE,  #  67
        ProtocolBuffer.Encoder.MAX_TYPE,  #  68
        ProtocolBuffer.Encoder.MAX_TYPE,  #  69
        ProtocolBuffer.Encoder.MAX_TYPE,  #  70
        ProtocolBuffer.Encoder.MAX_TYPE,  #  71
        ProtocolBuffer.Encoder.MAX_TYPE,  #  72
        ProtocolBuffer.Encoder.MAX_TYPE,  #  73
        ProtocolBuffer.Encoder.MAX_TYPE,  #  74
        ProtocolBuffer.Encoder.MAX_TYPE,  #  75
        ProtocolBuffer.Encoder.MAX_TYPE,  #  76
        ProtocolBuffer.Encoder.MAX_TYPE,  #  77
        ProtocolBuffer.Encoder.MAX_TYPE,  #  78
        ProtocolBuffer.Encoder.MAX_TYPE,  #  79
        ProtocolBuffer.Encoder.MAX_TYPE,  #  80
        ProtocolBuffer.Encoder.MAX_TYPE,  #  81
        ProtocolBuffer.Encoder.MAX_TYPE,  #  82
        ProtocolBuffer.Encoder.MAX_TYPE,  #  83
        ProtocolBuffer.Encoder.MAX_TYPE,  #  84
        ProtocolBuffer.Encoder.MAX_TYPE,  #  85
        ProtocolBuffer.Encoder.MAX_TYPE,  #  86
        ProtocolBuffer.Encoder.MAX_TYPE,  #  87
        ProtocolBuffer.Encoder.MAX_TYPE,  #  88
        ProtocolBuffer.Encoder.MAX_TYPE,  #  89
        ProtocolBuffer.Encoder.MAX_TYPE,  #  90
        ProtocolBuffer.Encoder.MAX_TYPE,  #  91
        ProtocolBuffer.Encoder.MAX_TYPE,  #  92
        ProtocolBuffer.Encoder.MAX_TYPE,  #  93
        ProtocolBuffer.Encoder.MAX_TYPE,  #  94
        ProtocolBuffer.Encoder.MAX_TYPE,  #  95
        ProtocolBuffer.Encoder.MAX_TYPE,  #  96
        ProtocolBuffer.Encoder.MAX_TYPE,  #  97
        ProtocolBuffer.Encoder.MAX_TYPE,  #  98
        ProtocolBuffer.Encoder.MAX_TYPE,  #  99
        ProtocolBuffer.Encoder.MAX_TYPE,  # 100
        ProtocolBuffer.Encoder.MAX_TYPE,  # 101
        ProtocolBuffer.Encoder.MAX_TYPE,  # 102
        ProtocolBuffer.Encoder.MAX_TYPE,  # 103
        ProtocolBuffer.Encoder.MAX_TYPE,  # 104
        ProtocolBuffer.Encoder.MAX_TYPE,  # 105
        ProtocolBuffer.Encoder.STRING,  # 106
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x2d,
        0x71,
        0x75,
        0x61,
        0x6c,
        0x69,
        0x74,
        0x79,
        0x2f,
        0x72,
        0x69,
        0x63,
        0x68,
        0x73,
        0x6e,
        0x69,
        0x70,
        0x70,
        0x65,
        0x74,
        0x73,
        0x2f,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x2f,
        0x72,
        0x69,
        0x63,
        0x68,
        0x73,
        0x6e,
        0x69,
        0x70,
        0x70,
        0x65,
        0x74,
        0x73,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x14,
        0x72,
        0x69,
        0x63,
        0x68,
        0x73,
        0x6e,
        0x69,
        0x70,
        0x70,
        0x65,
        0x74,
        0x73,
        0x2e,
        0x50,
        0x61,
        0x67,
        0x65,
        0x4d,
        0x61,
        0x70,
        0x13,
        0x1a,
        0x0c,
        0x54,
        0x65,
        0x6d,
        0x70,
        0x6c,
        0x61,
        0x74,
        0x65,
        0x54,
        0x79,
        0x70,
        0x65,
        0x20,
        0x01,
        0x28,
        0x03,
        0x30,
        0x0a,
        0x38,
        0x03,
        0x14,
        0x13,
        0x1a,
        0x10,
        0x54,
        0x65,
        0x6d,
        0x70,
        0x6c,
        0x61,
        0x74,
        0x65,
        0x54,
        0x79,
        0x70,
        0x65,
        0x2e,
        0x73,
        0x72,
        0x63,
        0x20,
        0x02,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x02,
        0x60,
        0x00,
        0x14,
        0x13,
        0x1a,
        0x0a,
        0x44,
        0x61,
        0x74,
        0x61,
        0x4f,
        0x62,
        0x6a,
        0x65,
        0x63,
        0x74,
        0x20,
        0x03,
        0x28,
        0x02,
        0x30,
        0x0b,
        0x38,
        0x03,
        0x4a,
        0x17,
        0x72,
        0x69,
        0x63,
        0x68,
        0x73,
        0x6e,
        0x69,
        0x70,
        0x70,
        0x65,
        0x74,
        0x73,
        0x2e,
        0x44,
        0x61,
        0x74,
        0x61,
        0x4f,
        0x62,
        0x6a,
        0x65,
        0x63,
        0x74,
        0x14,
        0x13,
        0x1a,
        0x15,
        0x72,
        0x69,
        0x63,
        0x68,
        0x73,
        0x6e,
        0x69,
        0x70,
        0x70,
        0x65,
        0x74,
        0x5f,
        0x61,
        0x73,
        0x5f,
        0x6f,
        0x6e,
        0x65,
        0x62,
        0x6f,
        0x78,
        0x20,
        0x6a,
        0x28,
        0x02,
        0x30,
        0x0b,
        0x38,
        0x01,
        0x4a,
        0x23,
        0x77,
        0x65,
        0x62,
        0x6f,
        0x66,
        0x74,
        0x72,
        0x75,
        0x73,
        0x74,
        0x2e,
        0x50,
        0x72,
        0x6f,
        0x73,
        0x65,
        0x4f,
        0x6e,
        0x65,
        0x62,
        0x6f,
        0x78,
        0x50,
        0x72,
        0x6f,
        0x76,
        0x69,
        0x64,
        0x65,
        0x72,
        0x52,
        0x65,
        0x70,
        0x6c,
        0x79,
        0x14,
        0x73,
        0x7a,
        0x06,
        0x54,
        0x79,
        0x70,
        0x65,
        0x49,
        0x64,
        0x8b,
        0x01,
        0x92,
        0x01,
        0x0f,
        0x4d,
        0x45,
        0x53,
        0x53,
        0x41,
        0x47,
        0x45,
        0x5f,
        0x54,
        0x59,
        0x50,
        0x45,
        0x5f,
        0x49,
        0x44,
        0x98,
        0x01,
        0x96,
        0x8a,
        0xbd,
        0x03,
        0x8c,
        0x01,
        0x74,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 13
0
class DataObject(ProtocolBuffer.ProtocolMessage):
    def __init__(self, contents=None):
        self.type_ = ""
        self.attribute_ = []
        self.has_type_ = 0
        if contents is not None: self.MergeFromString(contents)

    def type(self):
        return self.type_

    def set_type(self, x):
        self.has_type_ = 1
        self.type_ = x

    def clear_type(self):
        self.has_type_ = 0
        self.type_ = ""

    def has_type(self):
        return self.has_type_

    def attribute_size(self):
        return len(self.attribute_)

    def attribute_list(self):
        return self.attribute_

    def attribute(self, i):
        return self.attribute_[i]

    def mutable_attribute(self, i):
        return self.attribute_[i]

    def add_attribute(self):
        x = DataObject_Attribute()
        self.attribute_.append(x)
        return x

    def clear_attribute(self):
        self.attribute_ = []

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_type()): self.set_type(x.type())
        for i in xrange(x.attribute_size()):
            self.add_attribute().CopyFrom(x.attribute(i))

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(self,
                                                   'richsnippets.DataObject',
                                                   s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(self,
                                                 'richsnippets.DataObject')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(self,
                                                  'richsnippets.DataObject',
                                                  output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(self, 'richsnippets.DataObject',
                                              s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'richsnippets.DataObject', s)

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

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        for i in xrange(len(self.attribute_)):
            if (not self.attribute_[i].IsInitialized(debug_strs)):
                initialized = 0
        return initialized

    def ByteSize(self):
        n = 0
        if (self.has_type_): n += 1 + self.lengthString(len(self.type_))
        n += 2 * len(self.attribute_)
        for i in xrange(len(self.attribute_)):
            n += self.attribute_[i].ByteSize()
        return n + 0

    def Clear(self):
        self.clear_type()
        self.clear_attribute()

    def OutputUnchecked(self, out):
        if (self.has_type_):
            out.putVarInt32(10)
            out.putPrefixedString(self.type_)
        for i in xrange(len(self.attribute_)):
            out.putVarInt32(19)
            self.attribute_[i].OutputUnchecked(out)
            out.putVarInt32(20)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 10:
                self.set_type(d.getPrefixedString())
                continue
            if tt == 19:
                self.add_attribute().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_type_:
            res += prefix + ("type: %s\n" % self.DebugFormatString(self.type_))
        cnt = 0
        for e in self.attribute_:
            elm = ""
            if printElemNumber: elm = "(%d)" % cnt
            res += prefix + ("Attribute%s {\n" % elm)
            res += e.__str__(prefix + "  ", printElemNumber)
            res += prefix + "}\n"
            cnt += 1
        return res

    ktype = 1
    kAttributeGroup = 2
    kAttributename = 3
    kAttributevalue = 4
    kAttributecdata = 5

    _TEXT = (
        "ErrorCode",  #   0
        "type",  #   1
        "Attribute",  #   2
        "name",  #   3
        "value",  #   4
        "cdata",  #   5
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.STRING,  #   1
        ProtocolBuffer.Encoder.STARTGROUP,  #   2
        ProtocolBuffer.Encoder.STRING,  #   3
        ProtocolBuffer.Encoder.STRING,  #   4
        ProtocolBuffer.Encoder.STRING,  #   5
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x2d,
        0x71,
        0x75,
        0x61,
        0x6c,
        0x69,
        0x74,
        0x79,
        0x2f,
        0x72,
        0x69,
        0x63,
        0x68,
        0x73,
        0x6e,
        0x69,
        0x70,
        0x70,
        0x65,
        0x74,
        0x73,
        0x2f,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x2f,
        0x72,
        0x69,
        0x63,
        0x68,
        0x73,
        0x6e,
        0x69,
        0x70,
        0x70,
        0x65,
        0x74,
        0x73,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x17,
        0x72,
        0x69,
        0x63,
        0x68,
        0x73,
        0x6e,
        0x69,
        0x70,
        0x70,
        0x65,
        0x74,
        0x73,
        0x2e,
        0x44,
        0x61,
        0x74,
        0x61,
        0x4f,
        0x62,
        0x6a,
        0x65,
        0x63,
        0x74,
        0x13,
        0x1a,
        0x04,
        0x74,
        0x79,
        0x70,
        0x65,
        0x20,
        0x01,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x09,
        0x41,
        0x74,
        0x74,
        0x72,
        0x69,
        0x62,
        0x75,
        0x74,
        0x65,
        0x20,
        0x02,
        0x28,
        0x03,
        0x30,
        0x0a,
        0x38,
        0x03,
        0x14,
        0x13,
        0x1a,
        0x0e,
        0x41,
        0x74,
        0x74,
        0x72,
        0x69,
        0x62,
        0x75,
        0x74,
        0x65,
        0x2e,
        0x6e,
        0x61,
        0x6d,
        0x65,
        0x20,
        0x03,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x02,
        0x60,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0f,
        0x41,
        0x74,
        0x74,
        0x72,
        0x69,
        0x62,
        0x75,
        0x74,
        0x65,
        0x2e,
        0x76,
        0x61,
        0x6c,
        0x75,
        0x65,
        0x20,
        0x04,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x01,
        0x60,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0f,
        0x41,
        0x74,
        0x74,
        0x72,
        0x69,
        0x62,
        0x75,
        0x74,
        0x65,
        0x2e,
        0x63,
        0x64,
        0x61,
        0x74,
        0x61,
        0x20,
        0x05,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x01,
        0x60,
        0x01,
        0x14,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 14
0
class DocInfo(ProtocolBuffer.ProtocolMessage):
  def __init__(self, contents=None):
    self.content_ = []
    if contents is not None: self.MergeFromString(contents)

  def content_size(self): return len(self.content_)
  def content_list(self): return self.content_

  def content(self, i):
    return self.content_[i]

  def mutable_content(self, i):
    return self.content_[i]

  def add_content(self):
    x = DocInfo_Content()
    self.content_.append(x)
    return x

  def clear_content(self):
    self.content_ = []

  def MergeFrom(self, x):
    assert x is not self
    for i in xrange(x.content_size()): self.add_content().CopyFrom(x.content(i))

  def _CMergeFromString(self, s):
    _net_proto___parse__python.MergeFromString(self, 'localsearch.DocInfo', s)

  def _CEncode(self):
    return _net_proto___parse__python.Encode(self, 'localsearch.DocInfo')

  def _CToASCII(self, output_format):
    return _net_proto___parse__python.ToASCII(self, 'localsearch.DocInfo', output_format)


  def ParseASCII(self, s):
    _net_proto___parse__python.ParseASCII(self, 'localsearch.DocInfo', s)


  def ParseASCIIIgnoreUnknown(self, s):
    _net_proto___parse__python.ParseASCIIIgnoreUnknown(self, 'localsearch.DocInfo', s)


  def Equals(self, x):
    if x is self: return 1
    if len(self.content_) != len(x.content_): return 0
    for e1, e2 in zip(self.content_, x.content_):
      if e1 != e2: return 0
    return 1

  def __eq__(self, other):
    return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)

  def __ne__(self, other):
    return not (self == other)

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    for i in xrange(len(self.content_)):
      if (not self.content_[i].IsInitialized(debug_strs)): initialized=0
    return initialized

  def ByteSize(self):
    n = 0
    n += 2 * len(self.content_)
    for i in xrange(len(self.content_)): n += self.content_[i].ByteSize()
    return n + 0

  def Clear(self):
    self.clear_content()

  def OutputUnchecked(self, out):
    for i in xrange(len(self.content_)):
      out.putVarInt32(11)
      self.content_[i].OutputUnchecked(out)
      out.putVarInt32(12)

  def TryMerge(self, d):
    while d.avail() > 0:
      tt = d.getVarInt32()
      if tt == 11:
        self.add_content().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=""
    cnt=0
    for e in self.content_:
      elm=""
      if printElemNumber: elm="(%d)" % cnt
      res+=prefix+("Content%s {\n" % elm)
      res+=e.__str__(prefix + "  ", printElemNumber)
      res+=prefix+"}\n"
      cnt+=1
    return res

  kContentGroup = 1
  kContentclusterdocid = 2
  kContentcontent_id = 3
  kContentlanguage = 4
  kContentContextGroup = 5
  kContentContextDEPRECATED_start = 6
  kContentContextDEPRECATED_length = 7
  kContentContextoffset_start = 13
  kContentContextoffset_length = 14
  kContentContextcontext_rejection_bits = 17
  kContentHighlightGroup = 8
  kContentHighlightDEPRECATED_start = 9
  kContentHighlightDEPRECATED_length = 10
  kContentHighlightoffset_start = 15
  kContentHighlightoffset_length = 16
  kContentattributes = 12
  kContentscraped = 18
  kContentinferred = 19
  kContentauthority = 20

  _TEXT = (
   "ErrorCode",  #   0
   "Content",  #   1
   "clusterdocid",  #   2
   "content_id",  #   3
   "language",  #   4
   "Context",  #   5
   "DEPRECATED_start",  #   6
   "DEPRECATED_length",  #   7
   "Highlight",  #   8
   "DEPRECATED_start",  #   9
   "DEPRECATED_length",  #  10
   None,  #  11
   "attributes",  #  12
   "offset_start",  #  13
   "offset_length",  #  14
   "offset_start",  #  15
   "offset_length",  #  16
   "context_rejection_bits",  #  17
   "scraped",  #  18
   "inferred",  #  19
   "authority",  #  20
  )

  _TYPES = (
   ProtocolBuffer.Encoder.NUMERIC,  #   0
   ProtocolBuffer.Encoder.STARTGROUP,  #   1

   ProtocolBuffer.Encoder.DOUBLE,  #   2

   ProtocolBuffer.Encoder.NUMERIC,  #   3

   ProtocolBuffer.Encoder.NUMERIC,  #   4

   ProtocolBuffer.Encoder.STARTGROUP,  #   5

   ProtocolBuffer.Encoder.NUMERIC,  #   6

   ProtocolBuffer.Encoder.NUMERIC,  #   7

   ProtocolBuffer.Encoder.STARTGROUP,  #   8

   ProtocolBuffer.Encoder.NUMERIC,  #   9

   ProtocolBuffer.Encoder.NUMERIC,  #  10

   ProtocolBuffer.Encoder.MAX_TYPE,  #  11

   ProtocolBuffer.Encoder.STRING,  #  12

   ProtocolBuffer.Encoder.NUMERIC,  #  13

   ProtocolBuffer.Encoder.NUMERIC,  #  14

   ProtocolBuffer.Encoder.NUMERIC,  #  15

   ProtocolBuffer.Encoder.NUMERIC,  #  16

   ProtocolBuffer.Encoder.NUMERIC,  #  17

   ProtocolBuffer.Encoder.NUMERIC,  #  18

   ProtocolBuffer.Encoder.NUMERIC,  #  19

   ProtocolBuffer.Encoder.DOUBLE,  #  20

  )

  # stylesheet for XML output
  _STYLE = \
   """"""
  _STYLE_CONTENT_TYPE = \
   """"""
  _SERIALIZED_DESCRIPTOR = array.array('B', [
    0x5a,
    0x1e,
    0x6c,
    0x6f,
    0x63,
    0x61,
    0x6c,
    0x73,
    0x65,
    0x61,
    0x72,
    0x63,
    0x68,
    0x2f,
    0x62,
    0x61,
    0x73,
    0x65,
    0x2f,
    0x64,
    0x6f,
    0x63,
    0x69,
    0x6e,
    0x66,
    0x6f,
    0x2e,
    0x70,
    0x72,
    0x6f,
    0x74,
    0x6f,
    0x0a,
    0x13,
    0x6c,
    0x6f,
    0x63,
    0x61,
    0x6c,
    0x73,
    0x65,
    0x61,
    0x72,
    0x63,
    0x68,
    0x2e,
    0x44,
    0x6f,
    0x63,
    0x49,
    0x6e,
    0x66,
    0x6f,
    0x13,
    0x1a,
    0x07,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x20,
    0x01,
    0x28,
    0x03,
    0x30,
    0x0a,
    0x38,
    0x03,
    0x14,
    0x13,
    0x1a,
    0x14,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x63,
    0x6c,
    0x75,
    0x73,
    0x74,
    0x65,
    0x72,
    0x64,
    0x6f,
    0x63,
    0x69,
    0x64,
    0x20,
    0x02,
    0x28,
    0x01,
    0x30,
    0x06,
    0x38,
    0x02,
    0x60,
    0x00,
    0x14,
    0x13,
    0x1a,
    0x12,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x63,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x5f,
    0x69,
    0x64,
    0x20,
    0x03,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x02,
    0x60,
    0x00,
    0x14,
    0x13,
    0x1a,
    0x10,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x6c,
    0x61,
    0x6e,
    0x67,
    0x75,
    0x61,
    0x67,
    0x65,
    0x20,
    0x04,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x60,
    0x00,
    0x14,
    0x13,
    0x1a,
    0x0f,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x78,
    0x74,
    0x20,
    0x05,
    0x28,
    0x03,
    0x30,
    0x0a,
    0x38,
    0x03,
    0x60,
    0x00,
    0x14,
    0x13,
    0x1a,
    0x20,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x78,
    0x74,
    0x2e,
    0x44,
    0x45,
    0x50,
    0x52,
    0x45,
    0x43,
    0x41,
    0x54,
    0x45,
    0x44,
    0x5f,
    0x73,
    0x74,
    0x61,
    0x72,
    0x74,
    0x20,
    0x06,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x02,
    0x60,
    0x04,
    0x14,
    0x13,
    0x1a,
    0x21,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x78,
    0x74,
    0x2e,
    0x44,
    0x45,
    0x50,
    0x52,
    0x45,
    0x43,
    0x41,
    0x54,
    0x45,
    0x44,
    0x5f,
    0x6c,
    0x65,
    0x6e,
    0x67,
    0x74,
    0x68,
    0x20,
    0x07,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x02,
    0x60,
    0x04,
    0x14,
    0x13,
    0x1a,
    0x1c,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x78,
    0x74,
    0x2e,
    0x6f,
    0x66,
    0x66,
    0x73,
    0x65,
    0x74,
    0x5f,
    0x73,
    0x74,
    0x61,
    0x72,
    0x74,
    0x20,
    0x0d,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x42,
    0x01,
    0x30,
    0x60,
    0x04,
    0xa3,
    0x01,
    0xaa,
    0x01,
    0x07,
    0x64,
    0x65,
    0x66,
    0x61,
    0x75,
    0x6c,
    0x74,
    0xb2,
    0x01,
    0x01,
    0x30,
    0xa4,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x1d,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x78,
    0x74,
    0x2e,
    0x6f,
    0x66,
    0x66,
    0x73,
    0x65,
    0x74,
    0x5f,
    0x6c,
    0x65,
    0x6e,
    0x67,
    0x74,
    0x68,
    0x20,
    0x0e,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x42,
    0x01,
    0x30,
    0x60,
    0x04,
    0xa3,
    0x01,
    0xaa,
    0x01,
    0x07,
    0x64,
    0x65,
    0x66,
    0x61,
    0x75,
    0x6c,
    0x74,
    0xb2,
    0x01,
    0x01,
    0x30,
    0xa4,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x26,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x78,
    0x74,
    0x2e,
    0x63,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x78,
    0x74,
    0x5f,
    0x72,
    0x65,
    0x6a,
    0x65,
    0x63,
    0x74,
    0x69,
    0x6f,
    0x6e,
    0x5f,
    0x62,
    0x69,
    0x74,
    0x73,
    0x20,
    0x11,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x60,
    0x04,
    0x14,
    0x13,
    0x1a,
    0x11,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x48,
    0x69,
    0x67,
    0x68,
    0x6c,
    0x69,
    0x67,
    0x68,
    0x74,
    0x20,
    0x08,
    0x28,
    0x03,
    0x30,
    0x0a,
    0x38,
    0x03,
    0x60,
    0x00,
    0x14,
    0x13,
    0x1a,
    0x22,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x48,
    0x69,
    0x67,
    0x68,
    0x6c,
    0x69,
    0x67,
    0x68,
    0x74,
    0x2e,
    0x44,
    0x45,
    0x50,
    0x52,
    0x45,
    0x43,
    0x41,
    0x54,
    0x45,
    0x44,
    0x5f,
    0x73,
    0x74,
    0x61,
    0x72,
    0x74,
    0x20,
    0x09,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x02,
    0x60,
    0x0a,
    0x14,
    0x13,
    0x1a,
    0x23,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x48,
    0x69,
    0x67,
    0x68,
    0x6c,
    0x69,
    0x67,
    0x68,
    0x74,
    0x2e,
    0x44,
    0x45,
    0x50,
    0x52,
    0x45,
    0x43,
    0x41,
    0x54,
    0x45,
    0x44,
    0x5f,
    0x6c,
    0x65,
    0x6e,
    0x67,
    0x74,
    0x68,
    0x20,
    0x0a,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x02,
    0x60,
    0x0a,
    0x14,
    0x13,
    0x1a,
    0x1e,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x48,
    0x69,
    0x67,
    0x68,
    0x6c,
    0x69,
    0x67,
    0x68,
    0x74,
    0x2e,
    0x6f,
    0x66,
    0x66,
    0x73,
    0x65,
    0x74,
    0x5f,
    0x73,
    0x74,
    0x61,
    0x72,
    0x74,
    0x20,
    0x0f,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x42,
    0x01,
    0x30,
    0x60,
    0x0a,
    0xa3,
    0x01,
    0xaa,
    0x01,
    0x07,
    0x64,
    0x65,
    0x66,
    0x61,
    0x75,
    0x6c,
    0x74,
    0xb2,
    0x01,
    0x01,
    0x30,
    0xa4,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x1f,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x48,
    0x69,
    0x67,
    0x68,
    0x6c,
    0x69,
    0x67,
    0x68,
    0x74,
    0x2e,
    0x6f,
    0x66,
    0x66,
    0x73,
    0x65,
    0x74,
    0x5f,
    0x6c,
    0x65,
    0x6e,
    0x67,
    0x74,
    0x68,
    0x20,
    0x10,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x42,
    0x01,
    0x30,
    0x60,
    0x0a,
    0xa3,
    0x01,
    0xaa,
    0x01,
    0x07,
    0x64,
    0x65,
    0x66,
    0x61,
    0x75,
    0x6c,
    0x74,
    0xb2,
    0x01,
    0x01,
    0x30,
    0xa4,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x12,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x61,
    0x74,
    0x74,
    0x72,
    0x69,
    0x62,
    0x75,
    0x74,
    0x65,
    0x73,
    0x20,
    0x0c,
    0x28,
    0x02,
    0x30,
    0x0b,
    0x38,
    0x01,
    0x4a,
    0x1c,
    0x6c,
    0x6f,
    0x63,
    0x61,
    0x6c,
    0x73,
    0x65,
    0x61,
    0x72,
    0x63,
    0x68,
    0x2e,
    0x52,
    0x65,
    0x76,
    0x69,
    0x65,
    0x77,
    0x41,
    0x74,
    0x74,
    0x72,
    0x69,
    0x62,
    0x75,
    0x74,
    0x65,
    0x73,
    0x60,
    0x00,
    0x14,
    0x13,
    0x1a,
    0x0f,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x73,
    0x63,
    0x72,
    0x61,
    0x70,
    0x65,
    0x64,
    0x20,
    0x12,
    0x28,
    0x00,
    0x30,
    0x08,
    0x38,
    0x01,
    0x60,
    0x00,
    0x14,
    0x13,
    0x1a,
    0x10,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x69,
    0x6e,
    0x66,
    0x65,
    0x72,
    0x72,
    0x65,
    0x64,
    0x20,
    0x13,
    0x28,
    0x00,
    0x30,
    0x08,
    0x38,
    0x01,
    0x60,
    0x00,
    0x14,
    0x13,
    0x1a,
    0x11,
    0x43,
    0x6f,
    0x6e,
    0x74,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x61,
    0x75,
    0x74,
    0x68,
    0x6f,
    0x72,
    0x69,
    0x74,
    0x79,
    0x20,
    0x14,
    0x28,
    0x01,
    0x30,
    0x01,
    0x38,
    0x01,
    0x60,
    0x00,
    0x14,
    ])
  _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 15
0
class KeyValue(ProtocolBuffer.ProtocolMessage):
    has_key_ = 0
    key_ = ""
    has_value_ = 0
    value_ = ""

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

    def key(self):
        return self.key_

    def set_key(self, x):
        self.has_key_ = 1
        self.key_ = x

    def clear_key(self):
        if self.has_key_:
            self.has_key_ = 0
            self.key_ = ""

    def has_key(self):
        return self.has_key_

    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_key()): self.set_key(x.key())
        if (x.has_value()): self.set_value(x.value())

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.ext.mapreduce.KeyValue', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(
                self, 'apphosting.ext.mapreduce.KeyValue')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.ext.mapreduce.KeyValue')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(
                self, 'apphosting.ext.mapreduce.KeyValue', output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(
                self, 'apphosting.ext.mapreduce.KeyValue', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.ext.mapreduce.KeyValue', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_key_ != x.has_key_: return 0
        if self.has_key_ and self.key_ != x.key_: 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_key_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: key 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.key_))
        n += self.lengthString(len(self.value_))
        return n + 2

    def ByteSizePartial(self):
        n = 0
        if (self.has_key_):
            n += 1
            n += self.lengthString(len(self.key_))
        if (self.has_value_):
            n += 1
            n += self.lengthString(len(self.value_))
        return n

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

    def OutputUnchecked(self, out):
        out.putVarInt32(10)
        out.putPrefixedString(self.key_)
        out.putVarInt32(18)
        out.putPrefixedString(self.value_)

    def OutputPartial(self, out):
        if (self.has_key_):
            out.putVarInt32(10)
            out.putPrefixedString(self.key_)
        if (self.has_value_):
            out.putVarInt32(18)
            out.putPrefixedString(self.value_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 10:
                self.set_key(d.getPrefixedString())
                continue
            if tt == 18:
                self.set_value(d.getPrefixedString())
                continue

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)

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

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

    kkey = 1
    kvalue = 2

    _TEXT = _BuildTagLookupTable({
        0: "ErrorCode",
        1: "key",
        2: "value",
    }, 2)

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

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _PROTO_DESCRIPTOR_NAME = 'apphosting.ext.mapreduce.KeyValue'
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WiFhcHBob3N0aW5nL2V4dC9tYXByZWR1Y2Uva3YucHJvdG8KIWFwcGhvc3RpbmcuZXh0Lm1hcHJlZHVjZS5LZXlWYWx1ZRMaA2tleSABKAIwCTgCFBMaBXZhbHVlIAIoAjAJOAIUugGyAQohYXBwaG9zdGluZy9leHQvbWFwcmVkdWNlL2t2LnByb3RvEhhhcHBob3N0aW5nLmV4dC5tYXByZWR1Y2UiJgoIS2V5VmFsdWUSCwoDa2V5GAEgAigMEg0KBXZhbHVlGAIgAigMIkcKCUtleVZhbHVlcxIPCgNrZXkYASACKAxCAggBEhEKBXZhbHVlGAIgAygMQgIIARIWCgdwYXJ0aWFsGAMgASgIOgVmYWxzZUICIAI="
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 16
0
class ClickEvent(ProtocolBuffer.ProtocolMessage):
  def __init__(self, contents=None):
    self.ip_address_ = 0
    self.time100_ = 0
    self.click_type_ = ""
    self.session_id_ = ""
    self.click_data_ = ""
    self.query_ = ""
    self.rank_ = 0
    self.start_ = 0
    self.url_ = ""
    self.site_ = ""
    self.has_ip_address_ = 0
    self.has_time100_ = 0
    self.has_click_type_ = 0
    self.has_session_id_ = 0
    self.has_click_data_ = 0
    self.has_query_ = 0
    self.has_rank_ = 0
    self.has_start_ = 0
    self.has_url_ = 0
    self.has_site_ = 0
    if contents is not None: self.MergeFromString(contents)

  def ip_address(self): return self.ip_address_

  def set_ip_address(self, x):
    self.has_ip_address_ = 1
    self.ip_address_ = x

  def clear_ip_address(self):
    self.has_ip_address_ = 0
    self.ip_address_ = 0

  def has_ip_address(self): return self.has_ip_address_

  def time100(self): return self.time100_

  def set_time100(self, x):
    self.has_time100_ = 1
    self.time100_ = x

  def clear_time100(self):
    self.has_time100_ = 0
    self.time100_ = 0

  def has_time100(self): return self.has_time100_

  def click_type(self): return self.click_type_

  def set_click_type(self, x):
    self.has_click_type_ = 1
    self.click_type_ = x

  def clear_click_type(self):
    self.has_click_type_ = 0
    self.click_type_ = ""

  def has_click_type(self): return self.has_click_type_

  def session_id(self): return self.session_id_

  def set_session_id(self, x):
    self.has_session_id_ = 1
    self.session_id_ = x

  def clear_session_id(self):
    self.has_session_id_ = 0
    self.session_id_ = ""

  def has_session_id(self): return self.has_session_id_

  def click_data(self): return self.click_data_

  def set_click_data(self, x):
    self.has_click_data_ = 1
    self.click_data_ = x

  def clear_click_data(self):
    self.has_click_data_ = 0
    self.click_data_ = ""

  def has_click_data(self): return self.has_click_data_

  def query(self): return self.query_

  def set_query(self, x):
    self.has_query_ = 1
    self.query_ = x

  def clear_query(self):
    self.has_query_ = 0
    self.query_ = ""

  def has_query(self): return self.has_query_

  def rank(self): return self.rank_

  def set_rank(self, x):
    self.has_rank_ = 1
    self.rank_ = x

  def clear_rank(self):
    self.has_rank_ = 0
    self.rank_ = 0

  def has_rank(self): return self.has_rank_

  def start(self): return self.start_

  def set_start(self, x):
    self.has_start_ = 1
    self.start_ = x

  def clear_start(self):
    self.has_start_ = 0
    self.start_ = 0

  def has_start(self): return self.has_start_

  def url(self): return self.url_

  def set_url(self, x):
    self.has_url_ = 1
    self.url_ = x

  def clear_url(self):
    self.has_url_ = 0
    self.url_ = ""

  def has_url(self): return self.has_url_

  def site(self): return self.site_

  def set_site(self, x):
    self.has_site_ = 1
    self.site_ = x

  def clear_site(self):
    self.has_site_ = 0
    self.site_ = ""

  def has_site(self): return self.has_site_


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_ip_address()): self.set_ip_address(x.ip_address())
    if (x.has_time100()): self.set_time100(x.time100())
    if (x.has_click_type()): self.set_click_type(x.click_type())
    if (x.has_session_id()): self.set_session_id(x.session_id())
    if (x.has_click_data()): self.set_click_data(x.click_data())
    if (x.has_query()): self.set_query(x.query())
    if (x.has_rank()): self.set_rank(x.rank())
    if (x.has_start()): self.set_start(x.start())
    if (x.has_url()): self.set_url(x.url())
    if (x.has_site()): self.set_site(x.site())

  def _CMergeFromString(self, s):
    _net_proto___parse__python.MergeFromString(self, 'enterprise_apps_clicklog.ClickEvent', s)

  def _CEncode(self):
    return _net_proto___parse__python.Encode(self, 'enterprise_apps_clicklog.ClickEvent')

  def _CToASCII(self, output_format):
    return _net_proto___parse__python.ToASCII(self, 'enterprise_apps_clicklog.ClickEvent', output_format)


  def ParseASCII(self, s):
    _net_proto___parse__python.ParseASCII(self, 'enterprise_apps_clicklog.ClickEvent', s)


  def ParseASCIIIgnoreUnknown(self, s):
    _net_proto___parse__python.ParseASCIIIgnoreUnknown(self, 'enterprise_apps_clicklog.ClickEvent', s)


  def Equals(self, x):
    if x is self: return 1
    if self.has_ip_address_ != x.has_ip_address_: return 0
    if self.has_ip_address_ and self.ip_address_ != x.ip_address_: return 0
    if self.has_time100_ != x.has_time100_: return 0
    if self.has_time100_ and self.time100_ != x.time100_: return 0
    if self.has_click_type_ != x.has_click_type_: return 0
    if self.has_click_type_ and self.click_type_ != x.click_type_: return 0
    if self.has_session_id_ != x.has_session_id_: return 0
    if self.has_session_id_ and self.session_id_ != x.session_id_: return 0
    if self.has_click_data_ != x.has_click_data_: return 0
    if self.has_click_data_ and self.click_data_ != x.click_data_: return 0
    if self.has_query_ != x.has_query_: return 0
    if self.has_query_ and self.query_ != x.query_: return 0
    if self.has_rank_ != x.has_rank_: return 0
    if self.has_rank_ and self.rank_ != x.rank_: return 0
    if self.has_start_ != x.has_start_: return 0
    if self.has_start_ and self.start_ != x.start_: return 0
    if self.has_url_ != x.has_url_: return 0
    if self.has_url_ and self.url_ != x.url_: return 0
    if self.has_site_ != x.has_site_: return 0
    if self.has_site_ and self.site_ != x.site_: return 0
    return 1

  def __eq__(self, other):
    return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)

  def __ne__(self, other):
    return not (self == other)

  def IsInitialized(self, debug_strs=None):
    initialized = 1
    if (not self.has_ip_address_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: ip_address not set.')
    if (not self.has_time100_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: time100 not set.')
    if (not self.has_click_type_):
      initialized = 0
      if debug_strs is not None:
        debug_strs.append('Required field: click_type not set.')
    return initialized

  def ByteSize(self):
    n = 0
    n += self.lengthVarInt64(self.time100_)
    n += self.lengthString(len(self.click_type_))
    if (self.has_session_id_): n += 1 + self.lengthString(len(self.session_id_))
    if (self.has_click_data_): n += 1 + self.lengthString(len(self.click_data_))
    if (self.has_query_): n += 1 + self.lengthString(len(self.query_))
    if (self.has_rank_): n += 1 + self.lengthVarInt64(self.rank_)
    if (self.has_start_): n += 1 + self.lengthVarInt64(self.start_)
    if (self.has_url_): n += 1 + self.lengthString(len(self.url_))
    if (self.has_site_): n += 1 + self.lengthString(len(self.site_))
    return n + 7

  def Clear(self):
    self.clear_ip_address()
    self.clear_time100()
    self.clear_click_type()
    self.clear_session_id()
    self.clear_click_data()
    self.clear_query()
    self.clear_rank()
    self.clear_start()
    self.clear_url()
    self.clear_site()

  def OutputUnchecked(self, out):
    out.putVarInt32(13)
    out.put32(self.ip_address_)
    out.putVarInt32(16)
    out.putVarInt64(self.time100_)
    out.putVarInt32(26)
    out.putPrefixedString(self.click_type_)
    if (self.has_session_id_):
      out.putVarInt32(34)
      out.putPrefixedString(self.session_id_)
    if (self.has_click_data_):
      out.putVarInt32(42)
      out.putPrefixedString(self.click_data_)
    if (self.has_query_):
      out.putVarInt32(50)
      out.putPrefixedString(self.query_)
    if (self.has_rank_):
      out.putVarInt32(56)
      out.putVarInt32(self.rank_)
    if (self.has_start_):
      out.putVarInt32(64)
      out.putVarInt32(self.start_)
    if (self.has_url_):
      out.putVarInt32(74)
      out.putPrefixedString(self.url_)
    if (self.has_site_):
      out.putVarInt32(82)
      out.putPrefixedString(self.site_)

  def TryMerge(self, d):
    while d.avail() > 0:
      tt = d.getVarInt32()
      if tt == 13:
        self.set_ip_address(d.get32())
        continue
      if tt == 16:
        self.set_time100(d.getVarInt64())
        continue
      if tt == 26:
        self.set_click_type(d.getPrefixedString())
        continue
      if tt == 34:
        self.set_session_id(d.getPrefixedString())
        continue
      if tt == 42:
        self.set_click_data(d.getPrefixedString())
        continue
      if tt == 50:
        self.set_query(d.getPrefixedString())
        continue
      if tt == 56:
        self.set_rank(d.getVarInt32())
        continue
      if tt == 64:
        self.set_start(d.getVarInt32())
        continue
      if tt == 74:
        self.set_url(d.getPrefixedString())
        continue
      if tt == 82:
        self.set_site(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_ip_address_: res+=prefix+("ip_address: %s\n" % self.DebugFormatFixed32(self.ip_address_))
    if self.has_time100_: res+=prefix+("time100: %s\n" % self.DebugFormatInt64(self.time100_))
    if self.has_click_type_: res+=prefix+("click_type: %s\n" % self.DebugFormatString(self.click_type_))
    if self.has_session_id_: res+=prefix+("session_id: %s\n" % self.DebugFormatString(self.session_id_))
    if self.has_click_data_: res+=prefix+("click_data: %s\n" % self.DebugFormatString(self.click_data_))
    if self.has_query_: res+=prefix+("query: %s\n" % self.DebugFormatString(self.query_))
    if self.has_rank_: res+=prefix+("rank: %s\n" % self.DebugFormatInt32(self.rank_))
    if self.has_start_: res+=prefix+("start: %s\n" % self.DebugFormatInt32(self.start_))
    if self.has_url_: res+=prefix+("url: %s\n" % self.DebugFormatString(self.url_))
    if self.has_site_: res+=prefix+("site: %s\n" % self.DebugFormatString(self.site_))
    return res

  kip_address = 1
  ktime100 = 2
  kclick_type = 3
  ksession_id = 4
  kclick_data = 5
  kquery = 6
  krank = 7
  kstart = 8
  kurl = 9
  ksite = 10

  _TEXT = (
   "ErrorCode",  #   0
   "ip_address",  #   1
   "time100",  #   2
   "click_type",  #   3
   "session_id",  #   4
   "click_data",  #   5
   "query",  #   6
   "rank",  #   7
   "start",  #   8
   "url",  #   9
   "site",  #  10
  )

  _TYPES = (
   ProtocolBuffer.Encoder.NUMERIC,  #   0
   ProtocolBuffer.Encoder.FLOAT,  #   1

   ProtocolBuffer.Encoder.NUMERIC,  #   2

   ProtocolBuffer.Encoder.STRING,  #   3

   ProtocolBuffer.Encoder.STRING,  #   4

   ProtocolBuffer.Encoder.STRING,  #   5

   ProtocolBuffer.Encoder.STRING,  #   6

   ProtocolBuffer.Encoder.NUMERIC,  #   7

   ProtocolBuffer.Encoder.NUMERIC,  #   8

   ProtocolBuffer.Encoder.STRING,  #   9

   ProtocolBuffer.Encoder.STRING,  #  10

  )

  # stylesheet for XML output
  _STYLE = \
   """"""
  _STYLE_CONTENT_TYPE = \
   """"""
  _SERIALIZED_DESCRIPTOR = array.array('B', [
    0x5a,
    0x29,
    0x65,
    0x6e,
    0x74,
    0x65,
    0x72,
    0x70,
    0x72,
    0x69,
    0x73,
    0x65,
    0x2f,
    0x61,
    0x70,
    0x70,
    0x73,
    0x2f,
    0x63,
    0x6c,
    0x69,
    0x63,
    0x6b,
    0x6c,
    0x6f,
    0x67,
    0x2f,
    0x63,
    0x6c,
    0x69,
    0x63,
    0x6b,
    0x65,
    0x76,
    0x65,
    0x6e,
    0x74,
    0x2e,
    0x70,
    0x72,
    0x6f,
    0x74,
    0x6f,
    0x0a,
    0x23,
    0x65,
    0x6e,
    0x74,
    0x65,
    0x72,
    0x70,
    0x72,
    0x69,
    0x73,
    0x65,
    0x5f,
    0x61,
    0x70,
    0x70,
    0x73,
    0x5f,
    0x63,
    0x6c,
    0x69,
    0x63,
    0x6b,
    0x6c,
    0x6f,
    0x67,
    0x2e,
    0x43,
    0x6c,
    0x69,
    0x63,
    0x6b,
    0x45,
    0x76,
    0x65,
    0x6e,
    0x74,
    0x13,
    0x1a,
    0x0a,
    0x69,
    0x70,
    0x5f,
    0x61,
    0x64,
    0x64,
    0x72,
    0x65,
    0x73,
    0x73,
    0x20,
    0x01,
    0x28,
    0x05,
    0x30,
    0x07,
    0x38,
    0x02,
    0x14,
    0x13,
    0x1a,
    0x07,
    0x74,
    0x69,
    0x6d,
    0x65,
    0x31,
    0x30,
    0x30,
    0x20,
    0x02,
    0x28,
    0x00,
    0x30,
    0x03,
    0x38,
    0x02,
    0x14,
    0x13,
    0x1a,
    0x0a,
    0x63,
    0x6c,
    0x69,
    0x63,
    0x6b,
    0x5f,
    0x74,
    0x79,
    0x70,
    0x65,
    0x20,
    0x03,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x02,
    0x14,
    0x13,
    0x1a,
    0x0a,
    0x73,
    0x65,
    0x73,
    0x73,
    0x69,
    0x6f,
    0x6e,
    0x5f,
    0x69,
    0x64,
    0x20,
    0x04,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x0a,
    0x63,
    0x6c,
    0x69,
    0x63,
    0x6b,
    0x5f,
    0x64,
    0x61,
    0x74,
    0x61,
    0x20,
    0x05,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x05,
    0x71,
    0x75,
    0x65,
    0x72,
    0x79,
    0x20,
    0x06,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x04,
    0x72,
    0x61,
    0x6e,
    0x6b,
    0x20,
    0x07,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x05,
    0x73,
    0x74,
    0x61,
    0x72,
    0x74,
    0x20,
    0x08,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x03,
    0x75,
    0x72,
    0x6c,
    0x20,
    0x09,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x04,
    0x73,
    0x69,
    0x74,
    0x65,
    0x20,
    0x0a,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x01,
    0x14,
    ])
  _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 17
0
class FrooglePrice(ProtocolBuffer.ProtocolMessage):
    def __init__(self, contents=None):
        self.value_ = 0.0
        self.currency_ = 1
        self.has_value_ = 0
        self.has_currency_ = 0
        if contents is not None: self.MergeFromString(contents)

    def value(self):
        return self.value_

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

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

    def has_value(self):
        return self.has_value_

    def currency(self):
        return self.currency_

    def set_currency(self, x):
        self.has_currency_ = 1
        self.currency_ = x

    def clear_currency(self):
        self.has_currency_ = 0
        self.currency_ = 1

    def has_currency(self):
        return self.has_currency_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_value()): self.set_value(x.value())
        if (x.has_currency()): self.set_currency(x.currency())

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(self, 'FrooglePrice', s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(self, 'FrooglePrice')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(self, 'FrooglePrice',
                                                  output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(self, 'FrooglePrice', s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'FrooglePrice', s)

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

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        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
        if (self.has_currency_): n += 1 + self.lengthVarInt64(self.currency_)
        return n + 9

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

    def OutputUnchecked(self, out):
        out.putVarInt32(9)
        out.putDouble(self.value_)
        if (self.has_currency_):
            out.putVarInt32(16)
            out.putVarInt32(self.currency_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 9:
                self.set_value(d.getDouble())
                continue
            if tt == 16:
                self.set_currency(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_value_:
            res += prefix + ("Value: %s\n" % self.DebugFormat(self.value_))
        if self.has_currency_:
            res += prefix + ("Currency: %s\n" %
                             self.DebugFormatInt32(self.currency_))
        return res

    kValue = 1
    kCurrency = 2

    _TEXT = (
        "ErrorCode",  #   0
        "Value",  #   1
        "Currency",  #   2
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.DOUBLE,  #   1
        ProtocolBuffer.Encoder.NUMERIC,  #   2
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x20,
        0x66,
        0x72,
        0x6f,
        0x6f,
        0x67,
        0x6c,
        0x65,
        0x2f,
        0x62,
        0x61,
        0x73,
        0x65,
        0x2f,
        0x66,
        0x72,
        0x6f,
        0x6f,
        0x67,
        0x6c,
        0x65,
        0x5f,
        0x70,
        0x72,
        0x69,
        0x63,
        0x65,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x0c,
        0x46,
        0x72,
        0x6f,
        0x6f,
        0x67,
        0x6c,
        0x65,
        0x50,
        0x72,
        0x69,
        0x63,
        0x65,
        0x13,
        0x1a,
        0x05,
        0x56,
        0x61,
        0x6c,
        0x75,
        0x65,
        0x20,
        0x01,
        0x28,
        0x01,
        0x30,
        0x01,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x08,
        0x43,
        0x75,
        0x72,
        0x72,
        0x65,
        0x6e,
        0x63,
        0x79,
        0x20,
        0x02,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x01,
        0x31,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x01,
        0x31,
        0xa4,
        0x01,
        0x14,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 18
0
class SignatureData(ProtocolBuffer.ProtocolMessage):
    def __init__(self, contents=None):
        self.penaltysigpair_ = []
        if contents is not None: self.MergeFromString(contents)

    def penaltysigpair_size(self):
        return len(self.penaltysigpair_)

    def penaltysigpair_list(self):
        return self.penaltysigpair_

    def penaltysigpair(self, i):
        return self.penaltysigpair_[i]

    def mutable_penaltysigpair(self, i):
        return self.penaltysigpair_[i]

    def add_penaltysigpair(self):
        x = SignatureData_PenaltySigPair()
        self.penaltysigpair_.append(x)
        return x

    def clear_penaltysigpair(self):
        self.penaltysigpair_ = []

    def MergeFrom(self, x):
        assert x is not self
        for i in xrange(x.penaltysigpair_size()):
            self.add_penaltysigpair().CopyFrom(x.penaltysigpair(i))

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(
            self, 'spam_signaturematcher_proto.SignatureData', s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(
            self, 'spam_signaturematcher_proto.SignatureData')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(
            self, 'spam_signaturematcher_proto.SignatureData', output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(
            self, 'spam_signaturematcher_proto.SignatureData', s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'spam_signaturematcher_proto.SignatureData', s)

    def Equals(self, x):
        if x is self: return 1
        if len(self.penaltysigpair_) != len(x.penaltysigpair_): return 0
        for e1, e2 in zip(self.penaltysigpair_, x.penaltysigpair_):
            if e1 != e2: return 0
        return 1

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        for i in xrange(len(self.penaltysigpair_)):
            if (not self.penaltysigpair_[i].IsInitialized(debug_strs)):
                initialized = 0
        return initialized

    def ByteSize(self):
        n = 0
        n += 2 * len(self.penaltysigpair_)
        for i in xrange(len(self.penaltysigpair_)):
            n += self.penaltysigpair_[i].ByteSize()
        return n + 0

    def Clear(self):
        self.clear_penaltysigpair()

    def OutputUnchecked(self, out):
        for i in xrange(len(self.penaltysigpair_)):
            out.putVarInt32(11)
            self.penaltysigpair_[i].OutputUnchecked(out)
            out.putVarInt32(12)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 11:
                self.add_penaltysigpair().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 = ""
        cnt = 0
        for e in self.penaltysigpair_:
            elm = ""
            if printElemNumber: elm = "(%d)" % cnt
            res += prefix + ("PenaltySigPair%s {\n" % elm)
            res += e.__str__(prefix + "  ", printElemNumber)
            res += prefix + "}\n"
            cnt += 1
        return res

    kPenaltySigPairGroup = 1
    kPenaltySigPairpenalty = 2
    kPenaltySigPairmatched_spam_signature = 3

    _TEXT = (
        "ErrorCode",  #   0
        "PenaltySigPair",  #   1
        "penalty",  #   2
        "matched_spam_signature",  #   3
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.STARTGROUP,  #   1
        ProtocolBuffer.Encoder.NUMERIC,  #   2
        ProtocolBuffer.Encoder.STRING,  #   3
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x2f,
        0x73,
        0x70,
        0x61,
        0x6d,
        0x2f,
        0x73,
        0x69,
        0x67,
        0x6e,
        0x61,
        0x74,
        0x75,
        0x72,
        0x65,
        0x6d,
        0x61,
        0x74,
        0x63,
        0x68,
        0x65,
        0x72,
        0x2f,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x2f,
        0x73,
        0x69,
        0x67,
        0x6e,
        0x61,
        0x74,
        0x75,
        0x72,
        0x65,
        0x64,
        0x61,
        0x74,
        0x61,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x29,
        0x73,
        0x70,
        0x61,
        0x6d,
        0x5f,
        0x73,
        0x69,
        0x67,
        0x6e,
        0x61,
        0x74,
        0x75,
        0x72,
        0x65,
        0x6d,
        0x61,
        0x74,
        0x63,
        0x68,
        0x65,
        0x72,
        0x5f,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x2e,
        0x53,
        0x69,
        0x67,
        0x6e,
        0x61,
        0x74,
        0x75,
        0x72,
        0x65,
        0x44,
        0x61,
        0x74,
        0x61,
        0x13,
        0x1a,
        0x0e,
        0x50,
        0x65,
        0x6e,
        0x61,
        0x6c,
        0x74,
        0x79,
        0x53,
        0x69,
        0x67,
        0x50,
        0x61,
        0x69,
        0x72,
        0x20,
        0x01,
        0x28,
        0x03,
        0x30,
        0x0a,
        0x38,
        0x03,
        0x14,
        0x13,
        0x1a,
        0x16,
        0x50,
        0x65,
        0x6e,
        0x61,
        0x6c,
        0x74,
        0x79,
        0x53,
        0x69,
        0x67,
        0x50,
        0x61,
        0x69,
        0x72,
        0x2e,
        0x70,
        0x65,
        0x6e,
        0x61,
        0x6c,
        0x74,
        0x79,
        0x20,
        0x02,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x60,
        0x00,
        0x14,
        0x13,
        0x1a,
        0x25,
        0x50,
        0x65,
        0x6e,
        0x61,
        0x6c,
        0x74,
        0x79,
        0x53,
        0x69,
        0x67,
        0x50,
        0x61,
        0x69,
        0x72,
        0x2e,
        0x6d,
        0x61,
        0x74,
        0x63,
        0x68,
        0x65,
        0x64,
        0x5f,
        0x73,
        0x70,
        0x61,
        0x6d,
        0x5f,
        0x73,
        0x69,
        0x67,
        0x6e,
        0x61,
        0x74,
        0x75,
        0x72,
        0x65,
        0x20,
        0x03,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x01,
        0x60,
        0x00,
        0x14,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
class SystemServiceError(ProtocolBuffer.ProtocolMessage):

    OK = 0
    INTERNAL_ERROR = 1
    BACKEND_REQUIRED = 2
    LIMIT_REACHED = 3

    _ErrorCode_NAMES = {
        0: "OK",
        1: "INTERNAL_ERROR",
        2: "BACKEND_REQUIRED",
        3: "LIMIT_REACHED",
    }

    def ErrorCode_Name(cls, x):
        return cls._ErrorCode_NAMES.get(x, "")

    ErrorCode_Name = classmethod(ErrorCode_Name)

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

    def MergeFrom(self, x):
        assert x is not self

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.SystemServiceError', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(
                self, 'apphosting.SystemServiceError')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.SystemServiceError')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(
                self, 'apphosting.SystemServiceError', output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(
                self, 'apphosting.SystemServiceError', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.SystemServiceError', s)

    def Equals(self, x):
        if x is self: return 1
        return 1

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        return initialized

    def ByteSize(self):
        n = 0
        return n

    def ByteSizePartial(self):
        n = 0
        return n

    def Clear(self):
        pass

    def OutputUnchecked(self, out):
        pass

    def OutputPartial(self, out):
        pass

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)

    def __str__(self, prefix="", printElemNumber=0):
        res = ""
        return res

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

    _TEXT = _BuildTagLookupTable({
        0: "ErrorCode",
    }, 0)

    _TYPES = _BuildTagLookupTable({
        0: ProtocolBuffer.Encoder.NUMERIC,
    }, 0, ProtocolBuffer.Encoder.MAX_TYPE)

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _PROTO_DESCRIPTOR_NAME = 'apphosting.SystemServiceError'
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WiphcHBob3N0aW5nL2FwaS9zeXN0ZW0vc3lzdGVtX3NlcnZpY2UucHJvdG8KHWFwcGhvc3RpbmcuU3lzdGVtU2VydmljZUVycm9yc3oJRXJyb3JDb2RliwGSAQJPS5gBAIwBiwGSAQ5JTlRFUk5BTF9FUlJPUpgBAYwBiwGSARBCQUNLRU5EX1JFUVVJUkVEmAECjAGLAZIBDUxJTUlUX1JFQUNIRUSYAQOMAXS6AYUGCiphcHBob3N0aW5nL2FwaS9zeXN0ZW0vc3lzdGVtX3NlcnZpY2UucHJvdG8SCmFwcGhvc3RpbmciZgoSU3lzdGVtU2VydmljZUVycm9yIlAKCUVycm9yQ29kZRIGCgJPSxAAEhIKDklOVEVSTkFMX0VSUk9SEAESFAoQQkFDS0VORF9SRVFVSVJFRBACEhEKDUxJTUlUX1JFQUNIRUQQAyJ0CgpTeXN0ZW1TdGF0Eg8KB2N1cnJlbnQYASABKAESEQoJYXZlcmFnZTFtGAMgASgBEhIKCmF2ZXJhZ2UxMG0YBCABKAESDQoFdG90YWwYAiABKAESDgoGcmF0ZTFtGAUgASgBEg8KB3JhdGUxMG0YBiABKAEiFwoVR2V0U3lzdGVtU3RhdHNSZXF1ZXN0ImUKFkdldFN5c3RlbVN0YXRzUmVzcG9uc2USIwoDY3B1GAEgASgLMhYuYXBwaG9zdGluZy5TeXN0ZW1TdGF0EiYKBm1lbW9yeRgCIAEoCzIWLmFwcGhvc3RpbmcuU3lzdGVtU3RhdCIfCh1TdGFydEJhY2tncm91bmRSZXF1ZXN0UmVxdWVzdCI0Ch5TdGFydEJhY2tncm91bmRSZXF1ZXN0UmVzcG9uc2USEgoKcmVxdWVzdF9pZBgBIAEoCTLdAQoNU3lzdGVtU2VydmljZRJZCg5HZXRTeXN0ZW1TdGF0cxIhLmFwcGhvc3RpbmcuR2V0U3lzdGVtU3RhdHNSZXF1ZXN0GiIuYXBwaG9zdGluZy5HZXRTeXN0ZW1TdGF0c1Jlc3BvbnNlIgAScQoWU3RhcnRCYWNrZ3JvdW5kUmVxdWVzdBIpLmFwcGhvc3RpbmcuU3RhcnRCYWNrZ3JvdW5kUmVxdWVzdFJlcXVlc3QaKi5hcHBob3N0aW5nLlN0YXJ0QmFja2dyb3VuZFJlcXVlc3RSZXNwb25zZSIAQjYKH2NvbS5nb29nbGUuYXBwZW5naW5lLmFwaS5zeXN0ZW0QAigCQg9TeXN0ZW1TZXJ2aWNlUGI="
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
class TelephoneNumber(ProtocolBuffer.ProtocolMessage):

    MESSAGE_TYPE_ID = 3546500

    _TypeId_NAMES = {
        3546500: "MESSAGE_TYPE_ID",
    }

    def TypeId_Name(cls, x):
        return cls._TypeId_NAMES.get(x, "")

    TypeId_Name = classmethod(TypeId_Name)

    def __init__(self, contents=None):
        self.country_code_ = 0
        self.national_prefix_ = ""
        self.area_code_ = ""
        self.number_ = []
        self.extension_ = ""
        self.has_country_code_ = 0
        self.has_national_prefix_ = 0
        self.has_area_code_ = 0
        self.has_extension_ = 0
        if contents is not None: self.MergeFromString(contents)

    def country_code(self):
        return self.country_code_

    def set_country_code(self, x):
        self.has_country_code_ = 1
        self.country_code_ = x

    def clear_country_code(self):
        self.has_country_code_ = 0
        self.country_code_ = 0

    def has_country_code(self):
        return self.has_country_code_

    def national_prefix(self):
        return self.national_prefix_

    def set_national_prefix(self, x):
        self.has_national_prefix_ = 1
        self.national_prefix_ = x

    def clear_national_prefix(self):
        self.has_national_prefix_ = 0
        self.national_prefix_ = ""

    def has_national_prefix(self):
        return self.has_national_prefix_

    def area_code(self):
        return self.area_code_

    def set_area_code(self, x):
        self.has_area_code_ = 1
        self.area_code_ = x

    def clear_area_code(self):
        self.has_area_code_ = 0
        self.area_code_ = ""

    def has_area_code(self):
        return self.has_area_code_

    def number_size(self):
        return len(self.number_)

    def number_list(self):
        return self.number_

    def number(self, i):
        return self.number_[i]

    def set_number(self, i, x):
        self.number_[i] = x

    def add_number(self, x):
        self.number_.append(x)

    def clear_number(self):
        self.number_ = []

    def extension(self):
        return self.extension_

    def set_extension(self, x):
        self.has_extension_ = 1
        self.extension_ = x

    def clear_extension(self):
        self.has_extension_ = 0
        self.extension_ = ""

    def has_extension(self):
        return self.has_extension_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_country_code()): self.set_country_code(x.country_code())
        if (x.has_national_prefix()):
            self.set_national_prefix(x.national_prefix())
        if (x.has_area_code()): self.set_area_code(x.area_code())
        for i in xrange(x.number_size()):
            self.add_number(x.number(i))
        if (x.has_extension()): self.set_extension(x.extension())

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(self, 'TelephoneNumber', s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(self, 'TelephoneNumber')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(self, 'TelephoneNumber',
                                                  output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(self, 'TelephoneNumber', s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'TelephoneNumber', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_country_code_ != x.has_country_code_: return 0
        if self.has_country_code_ and self.country_code_ != x.country_code_:
            return 0
        if self.has_national_prefix_ != x.has_national_prefix_: return 0
        if self.has_national_prefix_ and self.national_prefix_ != x.national_prefix_:
            return 0
        if self.has_area_code_ != x.has_area_code_: return 0
        if self.has_area_code_ and self.area_code_ != x.area_code_: return 0
        if len(self.number_) != len(x.number_): return 0
        for e1, e2 in zip(self.number_, x.number_):
            if e1 != e2: return 0
        if self.has_extension_ != x.has_extension_: return 0
        if self.has_extension_ and self.extension_ != x.extension_: return 0
        return 1

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        return initialized

    def ByteSize(self):
        n = 0
        if (self.has_country_code_):
            n += 1 + self.lengthVarInt64(self.country_code_)
        if (self.has_national_prefix_):
            n += 1 + self.lengthString(len(self.national_prefix_))
        if (self.has_area_code_):
            n += 1 + self.lengthString(len(self.area_code_))
        n += 1 * len(self.number_)
        for i in xrange(len(self.number_)):
            n += self.lengthString(len(self.number_[i]))
        if (self.has_extension_):
            n += 1 + self.lengthString(len(self.extension_))
        return n + 0

    def Clear(self):
        self.clear_country_code()
        self.clear_national_prefix()
        self.clear_area_code()
        self.clear_number()
        self.clear_extension()

    def OutputUnchecked(self, out):
        if (self.has_country_code_):
            out.putVarInt32(8)
            out.putVarInt32(self.country_code_)
        if (self.has_national_prefix_):
            out.putVarInt32(18)
            out.putPrefixedString(self.national_prefix_)
        if (self.has_area_code_):
            out.putVarInt32(26)
            out.putPrefixedString(self.area_code_)
        for i in xrange(len(self.number_)):
            out.putVarInt32(34)
            out.putPrefixedString(self.number_[i])
        if (self.has_extension_):
            out.putVarInt32(42)
            out.putPrefixedString(self.extension_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 8:
                self.set_country_code(d.getVarInt32())
                continue
            if tt == 18:
                self.set_national_prefix(d.getPrefixedString())
                continue
            if tt == 26:
                self.set_area_code(d.getPrefixedString())
                continue
            if tt == 34:
                self.add_number(d.getPrefixedString())
                continue
            if tt == 42:
                self.set_extension(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_country_code_:
            res += prefix + ("country_code: %s\n" %
                             self.DebugFormatInt32(self.country_code_))
        if self.has_national_prefix_:
            res += prefix + ("national_prefix: %s\n" %
                             self.DebugFormatString(self.national_prefix_))
        if self.has_area_code_:
            res += prefix + ("area_code: %s\n" %
                             self.DebugFormatString(self.area_code_))
        cnt = 0
        for e in self.number_:
            elm = ""
            if printElemNumber: elm = "(%d)" % cnt
            res += prefix + ("number%s: %s\n" %
                             (elm, self.DebugFormatString(e)))
            cnt += 1
        if self.has_extension_:
            res += prefix + ("extension: %s\n" %
                             self.DebugFormatString(self.extension_))
        return res

    kcountry_code = 1
    knational_prefix = 2
    karea_code = 3
    knumber = 4
    kextension = 5

    _TEXT = (
        "ErrorCode",  #   0
        "country_code",  #   1
        "national_prefix",  #   2
        "area_code",  #   3
        "number",  #   4
        "extension",  #   5
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.NUMERIC,  #   1
        ProtocolBuffer.Encoder.STRING,  #   2
        ProtocolBuffer.Encoder.STRING,  #   3
        ProtocolBuffer.Encoder.STRING,  #   4
        ProtocolBuffer.Encoder.STRING,  #   5
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x26,
        0x6c,
        0x6f,
        0x63,
        0x61,
        0x74,
        0x69,
        0x6f,
        0x6e,
        0x2f,
        0x63,
        0x6f,
        0x75,
        0x6e,
        0x74,
        0x72,
        0x79,
        0x2f,
        0x74,
        0x65,
        0x6c,
        0x65,
        0x70,
        0x68,
        0x6f,
        0x6e,
        0x65,
        0x6e,
        0x75,
        0x6d,
        0x62,
        0x65,
        0x72,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x0f,
        0x54,
        0x65,
        0x6c,
        0x65,
        0x70,
        0x68,
        0x6f,
        0x6e,
        0x65,
        0x4e,
        0x75,
        0x6d,
        0x62,
        0x65,
        0x72,
        0x13,
        0x1a,
        0x0c,
        0x63,
        0x6f,
        0x75,
        0x6e,
        0x74,
        0x72,
        0x79,
        0x5f,
        0x63,
        0x6f,
        0x64,
        0x65,
        0x20,
        0x01,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0f,
        0x6e,
        0x61,
        0x74,
        0x69,
        0x6f,
        0x6e,
        0x61,
        0x6c,
        0x5f,
        0x70,
        0x72,
        0x65,
        0x66,
        0x69,
        0x78,
        0x20,
        0x02,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x09,
        0x61,
        0x72,
        0x65,
        0x61,
        0x5f,
        0x63,
        0x6f,
        0x64,
        0x65,
        0x20,
        0x03,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x06,
        0x6e,
        0x75,
        0x6d,
        0x62,
        0x65,
        0x72,
        0x20,
        0x04,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x03,
        0x14,
        0x13,
        0x1a,
        0x09,
        0x65,
        0x78,
        0x74,
        0x65,
        0x6e,
        0x73,
        0x69,
        0x6f,
        0x6e,
        0x20,
        0x05,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x01,
        0x14,
        0x73,
        0x7a,
        0x06,
        0x54,
        0x79,
        0x70,
        0x65,
        0x49,
        0x64,
        0x8b,
        0x01,
        0x92,
        0x01,
        0x0f,
        0x4d,
        0x45,
        0x53,
        0x53,
        0x41,
        0x47,
        0x45,
        0x5f,
        0x54,
        0x59,
        0x50,
        0x45,
        0x5f,
        0x49,
        0x44,
        0x98,
        0x01,
        0x84,
        0xbb,
        0xd8,
        0x01,
        0x8c,
        0x01,
        0x74,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
class StartBackgroundRequestRequest(ProtocolBuffer.ProtocolMessage):
    def __init__(self, contents=None):
        pass
        if contents is not None: self.MergeFromString(contents)

    def MergeFrom(self, x):
        assert x is not self

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.StartBackgroundRequestRequest', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(
                self, 'apphosting.StartBackgroundRequestRequest')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.StartBackgroundRequestRequest')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(
                self, 'apphosting.StartBackgroundRequestRequest',
                output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(
                self, 'apphosting.StartBackgroundRequestRequest', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.StartBackgroundRequestRequest', s)

    def Equals(self, x):
        if x is self: return 1
        return 1

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        return initialized

    def ByteSize(self):
        n = 0
        return n

    def ByteSizePartial(self):
        n = 0
        return n

    def Clear(self):
        pass

    def OutputUnchecked(self, out):
        pass

    def OutputPartial(self, out):
        pass

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)

    def __str__(self, prefix="", printElemNumber=0):
        res = ""
        return res

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

    _TEXT = _BuildTagLookupTable({
        0: "ErrorCode",
    }, 0)

    _TYPES = _BuildTagLookupTable({
        0: ProtocolBuffer.Encoder.NUMERIC,
    }, 0, ProtocolBuffer.Encoder.MAX_TYPE)

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _PROTO_DESCRIPTOR_NAME = 'apphosting.StartBackgroundRequestRequest'
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WiphcHBob3N0aW5nL2FwaS9zeXN0ZW0vc3lzdGVtX3NlcnZpY2UucHJvdG8KKGFwcGhvc3RpbmcuU3RhcnRCYWNrZ3JvdW5kUmVxdWVzdFJlcXVlc3TCAR1hcHBob3N0aW5nLlN5c3RlbVNlcnZpY2VFcnJvcg=="
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 22
0
class RankBoostDocAttachment(ProtocolBuffer.ProtocolMessage):

    MESSAGE_TYPE_ID = 3803299

    _TypeId_NAMES = {
        3803299: "MESSAGE_TYPE_ID",
    }

    def TypeId_Name(cls, x):
        return cls._TypeId_NAMES.get(x, "")

    TypeId_Name = classmethod(TypeId_Name)

    FORUM_ENGINE_SCORE = 120

    _Constants_NAMES = {
        120: "FORUM_ENGINE_SCORE",
    }

    def Constants_Name(cls, x):
        return cls._Constants_NAMES.get(x, "")

    Constants_Name = classmethod(Constants_Name)

    def __init__(self, contents=None):
        self.link_count_ = 0
        self.offdom_link_count_ = 0
        self.paid_link_count_ = 0
        self.ppc_link_count_ = 0
        self.page_blog_score_ = 0
        self.page_wiki_score_ = 0
        self.page_forum_score_ = 0
        self.page_ppc_spam_score_ = 0
        self.has_link_count_ = 0
        self.has_offdom_link_count_ = 0
        self.has_paid_link_count_ = 0
        self.has_ppc_link_count_ = 0
        self.has_page_blog_score_ = 0
        self.has_page_wiki_score_ = 0
        self.has_page_forum_score_ = 0
        self.has_page_ppc_spam_score_ = 0
        if contents is not None: self.MergeFromString(contents)

    def link_count(self):
        return self.link_count_

    def set_link_count(self, x):
        self.has_link_count_ = 1
        self.link_count_ = x

    def clear_link_count(self):
        self.has_link_count_ = 0
        self.link_count_ = 0

    def has_link_count(self):
        return self.has_link_count_

    def offdom_link_count(self):
        return self.offdom_link_count_

    def set_offdom_link_count(self, x):
        self.has_offdom_link_count_ = 1
        self.offdom_link_count_ = x

    def clear_offdom_link_count(self):
        self.has_offdom_link_count_ = 0
        self.offdom_link_count_ = 0

    def has_offdom_link_count(self):
        return self.has_offdom_link_count_

    def paid_link_count(self):
        return self.paid_link_count_

    def set_paid_link_count(self, x):
        self.has_paid_link_count_ = 1
        self.paid_link_count_ = x

    def clear_paid_link_count(self):
        self.has_paid_link_count_ = 0
        self.paid_link_count_ = 0

    def has_paid_link_count(self):
        return self.has_paid_link_count_

    def ppc_link_count(self):
        return self.ppc_link_count_

    def set_ppc_link_count(self, x):
        self.has_ppc_link_count_ = 1
        self.ppc_link_count_ = x

    def clear_ppc_link_count(self):
        self.has_ppc_link_count_ = 0
        self.ppc_link_count_ = 0

    def has_ppc_link_count(self):
        return self.has_ppc_link_count_

    def page_blog_score(self):
        return self.page_blog_score_

    def set_page_blog_score(self, x):
        self.has_page_blog_score_ = 1
        self.page_blog_score_ = x

    def clear_page_blog_score(self):
        self.has_page_blog_score_ = 0
        self.page_blog_score_ = 0

    def has_page_blog_score(self):
        return self.has_page_blog_score_

    def page_wiki_score(self):
        return self.page_wiki_score_

    def set_page_wiki_score(self, x):
        self.has_page_wiki_score_ = 1
        self.page_wiki_score_ = x

    def clear_page_wiki_score(self):
        self.has_page_wiki_score_ = 0
        self.page_wiki_score_ = 0

    def has_page_wiki_score(self):
        return self.has_page_wiki_score_

    def page_forum_score(self):
        return self.page_forum_score_

    def set_page_forum_score(self, x):
        self.has_page_forum_score_ = 1
        self.page_forum_score_ = x

    def clear_page_forum_score(self):
        self.has_page_forum_score_ = 0
        self.page_forum_score_ = 0

    def has_page_forum_score(self):
        return self.has_page_forum_score_

    def page_ppc_spam_score(self):
        return self.page_ppc_spam_score_

    def set_page_ppc_spam_score(self, x):
        self.has_page_ppc_spam_score_ = 1
        self.page_ppc_spam_score_ = x

    def clear_page_ppc_spam_score(self):
        self.has_page_ppc_spam_score_ = 0
        self.page_ppc_spam_score_ = 0

    def has_page_ppc_spam_score(self):
        return self.has_page_ppc_spam_score_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_link_count()): self.set_link_count(x.link_count())
        if (x.has_offdom_link_count()):
            self.set_offdom_link_count(x.offdom_link_count())
        if (x.has_paid_link_count()):
            self.set_paid_link_count(x.paid_link_count())
        if (x.has_ppc_link_count()):
            self.set_ppc_link_count(x.ppc_link_count())
        if (x.has_page_blog_score()):
            self.set_page_blog_score(x.page_blog_score())
        if (x.has_page_wiki_score()):
            self.set_page_wiki_score(x.page_wiki_score())
        if (x.has_page_forum_score()):
            self.set_page_forum_score(x.page_forum_score())
        if (x.has_page_ppc_spam_score()):
            self.set_page_ppc_spam_score(x.page_ppc_spam_score())

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(self,
                                                   'RankBoostDocAttachment', s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(self,
                                                 'RankBoostDocAttachment')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(self,
                                                  'RankBoostDocAttachment',
                                                  output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(self, 'RankBoostDocAttachment',
                                              s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'RankBoostDocAttachment', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_link_count_ != x.has_link_count_: return 0
        if self.has_link_count_ and self.link_count_ != x.link_count_: return 0
        if self.has_offdom_link_count_ != x.has_offdom_link_count_: return 0
        if self.has_offdom_link_count_ and self.offdom_link_count_ != x.offdom_link_count_:
            return 0
        if self.has_paid_link_count_ != x.has_paid_link_count_: return 0
        if self.has_paid_link_count_ and self.paid_link_count_ != x.paid_link_count_:
            return 0
        if self.has_ppc_link_count_ != x.has_ppc_link_count_: return 0
        if self.has_ppc_link_count_ and self.ppc_link_count_ != x.ppc_link_count_:
            return 0
        if self.has_page_blog_score_ != x.has_page_blog_score_: return 0
        if self.has_page_blog_score_ and self.page_blog_score_ != x.page_blog_score_:
            return 0
        if self.has_page_wiki_score_ != x.has_page_wiki_score_: return 0
        if self.has_page_wiki_score_ and self.page_wiki_score_ != x.page_wiki_score_:
            return 0
        if self.has_page_forum_score_ != x.has_page_forum_score_: return 0
        if self.has_page_forum_score_ and self.page_forum_score_ != x.page_forum_score_:
            return 0
        if self.has_page_ppc_spam_score_ != x.has_page_ppc_spam_score_:
            return 0
        if self.has_page_ppc_spam_score_ and self.page_ppc_spam_score_ != x.page_ppc_spam_score_:
            return 0
        return 1

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        return initialized

    def ByteSize(self):
        n = 0
        if (self.has_link_count_):
            n += 1 + self.lengthVarInt64(self.link_count_)
        if (self.has_offdom_link_count_):
            n += 1 + self.lengthVarInt64(self.offdom_link_count_)
        if (self.has_paid_link_count_):
            n += 1 + self.lengthVarInt64(self.paid_link_count_)
        if (self.has_ppc_link_count_):
            n += 1 + self.lengthVarInt64(self.ppc_link_count_)
        if (self.has_page_blog_score_):
            n += 1 + self.lengthVarInt64(self.page_blog_score_)
        if (self.has_page_wiki_score_):
            n += 1 + self.lengthVarInt64(self.page_wiki_score_)
        if (self.has_page_forum_score_):
            n += 1 + self.lengthVarInt64(self.page_forum_score_)
        if (self.has_page_ppc_spam_score_):
            n += 1 + self.lengthVarInt64(self.page_ppc_spam_score_)
        return n + 0

    def Clear(self):
        self.clear_link_count()
        self.clear_offdom_link_count()
        self.clear_paid_link_count()
        self.clear_ppc_link_count()
        self.clear_page_blog_score()
        self.clear_page_wiki_score()
        self.clear_page_forum_score()
        self.clear_page_ppc_spam_score()

    def OutputUnchecked(self, out):
        if (self.has_link_count_):
            out.putVarInt32(8)
            out.putVarInt32(self.link_count_)
        if (self.has_offdom_link_count_):
            out.putVarInt32(16)
            out.putVarInt32(self.offdom_link_count_)
        if (self.has_paid_link_count_):
            out.putVarInt32(24)
            out.putVarInt32(self.paid_link_count_)
        if (self.has_ppc_link_count_):
            out.putVarInt32(32)
            out.putVarInt32(self.ppc_link_count_)
        if (self.has_page_blog_score_):
            out.putVarInt32(40)
            out.putVarInt32(self.page_blog_score_)
        if (self.has_page_wiki_score_):
            out.putVarInt32(48)
            out.putVarInt32(self.page_wiki_score_)
        if (self.has_page_forum_score_):
            out.putVarInt32(56)
            out.putVarInt32(self.page_forum_score_)
        if (self.has_page_ppc_spam_score_):
            out.putVarInt32(64)
            out.putVarInt32(self.page_ppc_spam_score_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 8:
                self.set_link_count(d.getVarInt32())
                continue
            if tt == 16:
                self.set_offdom_link_count(d.getVarInt32())
                continue
            if tt == 24:
                self.set_paid_link_count(d.getVarInt32())
                continue
            if tt == 32:
                self.set_ppc_link_count(d.getVarInt32())
                continue
            if tt == 40:
                self.set_page_blog_score(d.getVarInt32())
                continue
            if tt == 48:
                self.set_page_wiki_score(d.getVarInt32())
                continue
            if tt == 56:
                self.set_page_forum_score(d.getVarInt32())
                continue
            if tt == 64:
                self.set_page_ppc_spam_score(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_link_count_:
            res += prefix + ("link_count: %s\n" %
                             self.DebugFormatInt32(self.link_count_))
        if self.has_offdom_link_count_:
            res += prefix + ("offdom_link_count: %s\n" %
                             self.DebugFormatInt32(self.offdom_link_count_))
        if self.has_paid_link_count_:
            res += prefix + ("paid_link_count: %s\n" %
                             self.DebugFormatInt32(self.paid_link_count_))
        if self.has_ppc_link_count_:
            res += prefix + ("ppc_link_count: %s\n" %
                             self.DebugFormatInt32(self.ppc_link_count_))
        if self.has_page_blog_score_:
            res += prefix + ("page_blog_score: %s\n" %
                             self.DebugFormatInt32(self.page_blog_score_))
        if self.has_page_wiki_score_:
            res += prefix + ("page_wiki_score: %s\n" %
                             self.DebugFormatInt32(self.page_wiki_score_))
        if self.has_page_forum_score_:
            res += prefix + ("page_forum_score: %s\n" %
                             self.DebugFormatInt32(self.page_forum_score_))
        if self.has_page_ppc_spam_score_:
            res += prefix + ("page_ppc_spam_score: %s\n" %
                             self.DebugFormatInt32(self.page_ppc_spam_score_))
        return res

    klink_count = 1
    koffdom_link_count = 2
    kpaid_link_count = 3
    kppc_link_count = 4
    kpage_blog_score = 5
    kpage_wiki_score = 6
    kpage_forum_score = 7
    kpage_ppc_spam_score = 8

    _TEXT = (
        "ErrorCode",  #   0
        "link_count",  #   1
        "offdom_link_count",  #   2
        "paid_link_count",  #   3
        "ppc_link_count",  #   4
        "page_blog_score",  #   5
        "page_wiki_score",  #   6
        "page_forum_score",  #   7
        "page_ppc_spam_score",  #   8
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.NUMERIC,  #   1
        ProtocolBuffer.Encoder.NUMERIC,  #   2
        ProtocolBuffer.Encoder.NUMERIC,  #   3
        ProtocolBuffer.Encoder.NUMERIC,  #   4
        ProtocolBuffer.Encoder.NUMERIC,  #   5
        ProtocolBuffer.Encoder.NUMERIC,  #   6
        ProtocolBuffer.Encoder.NUMERIC,  #   7
        ProtocolBuffer.Encoder.NUMERIC,  #   8
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x3a,
        0x71,
        0x75,
        0x61,
        0x6c,
        0x69,
        0x74,
        0x79,
        0x2f,
        0x72,
        0x61,
        0x6e,
        0x6b,
        0x62,
        0x6f,
        0x6f,
        0x73,
        0x74,
        0x2f,
        0x69,
        0x6e,
        0x64,
        0x65,
        0x78,
        0x69,
        0x6e,
        0x67,
        0x2f,
        0x72,
        0x61,
        0x6e,
        0x6b,
        0x62,
        0x6f,
        0x6f,
        0x73,
        0x74,
        0x2d,
        0x63,
        0x64,
        0x6f,
        0x63,
        0x2d,
        0x61,
        0x74,
        0x74,
        0x61,
        0x63,
        0x68,
        0x6d,
        0x65,
        0x6e,
        0x74,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x16,
        0x52,
        0x61,
        0x6e,
        0x6b,
        0x42,
        0x6f,
        0x6f,
        0x73,
        0x74,
        0x44,
        0x6f,
        0x63,
        0x41,
        0x74,
        0x74,
        0x61,
        0x63,
        0x68,
        0x6d,
        0x65,
        0x6e,
        0x74,
        0x13,
        0x1a,
        0x0a,
        0x6c,
        0x69,
        0x6e,
        0x6b,
        0x5f,
        0x63,
        0x6f,
        0x75,
        0x6e,
        0x74,
        0x20,
        0x01,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x01,
        0x30,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x01,
        0x30,
        0xa4,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x11,
        0x6f,
        0x66,
        0x66,
        0x64,
        0x6f,
        0x6d,
        0x5f,
        0x6c,
        0x69,
        0x6e,
        0x6b,
        0x5f,
        0x63,
        0x6f,
        0x75,
        0x6e,
        0x74,
        0x20,
        0x02,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x01,
        0x30,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x01,
        0x30,
        0xa4,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0f,
        0x70,
        0x61,
        0x69,
        0x64,
        0x5f,
        0x6c,
        0x69,
        0x6e,
        0x6b,
        0x5f,
        0x63,
        0x6f,
        0x75,
        0x6e,
        0x74,
        0x20,
        0x03,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x01,
        0x30,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x01,
        0x30,
        0xa4,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0e,
        0x70,
        0x70,
        0x63,
        0x5f,
        0x6c,
        0x69,
        0x6e,
        0x6b,
        0x5f,
        0x63,
        0x6f,
        0x75,
        0x6e,
        0x74,
        0x20,
        0x04,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x01,
        0x30,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x01,
        0x30,
        0xa4,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0f,
        0x70,
        0x61,
        0x67,
        0x65,
        0x5f,
        0x62,
        0x6c,
        0x6f,
        0x67,
        0x5f,
        0x73,
        0x63,
        0x6f,
        0x72,
        0x65,
        0x20,
        0x05,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x01,
        0x30,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x01,
        0x30,
        0xa4,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0f,
        0x70,
        0x61,
        0x67,
        0x65,
        0x5f,
        0x77,
        0x69,
        0x6b,
        0x69,
        0x5f,
        0x73,
        0x63,
        0x6f,
        0x72,
        0x65,
        0x20,
        0x06,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x01,
        0x30,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x01,
        0x30,
        0xa4,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x10,
        0x70,
        0x61,
        0x67,
        0x65,
        0x5f,
        0x66,
        0x6f,
        0x72,
        0x75,
        0x6d,
        0x5f,
        0x73,
        0x63,
        0x6f,
        0x72,
        0x65,
        0x20,
        0x07,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x01,
        0x30,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x01,
        0x30,
        0xa4,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x13,
        0x70,
        0x61,
        0x67,
        0x65,
        0x5f,
        0x70,
        0x70,
        0x63,
        0x5f,
        0x73,
        0x70,
        0x61,
        0x6d,
        0x5f,
        0x73,
        0x63,
        0x6f,
        0x72,
        0x65,
        0x20,
        0x08,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x01,
        0x30,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x01,
        0x30,
        0xa4,
        0x01,
        0x14,
        0x73,
        0x7a,
        0x06,
        0x54,
        0x79,
        0x70,
        0x65,
        0x49,
        0x64,
        0x8b,
        0x01,
        0x92,
        0x01,
        0x0f,
        0x4d,
        0x45,
        0x53,
        0x53,
        0x41,
        0x47,
        0x45,
        0x5f,
        0x54,
        0x59,
        0x50,
        0x45,
        0x5f,
        0x49,
        0x44,
        0x98,
        0x01,
        0xa3,
        0x91,
        0xe8,
        0x01,
        0x8c,
        0x01,
        0x74,
        0x73,
        0x7a,
        0x09,
        0x43,
        0x6f,
        0x6e,
        0x73,
        0x74,
        0x61,
        0x6e,
        0x74,
        0x73,
        0x8b,
        0x01,
        0x92,
        0x01,
        0x12,
        0x46,
        0x4f,
        0x52,
        0x55,
        0x4d,
        0x5f,
        0x45,
        0x4e,
        0x47,
        0x49,
        0x4e,
        0x45,
        0x5f,
        0x53,
        0x43,
        0x4f,
        0x52,
        0x45,
        0x98,
        0x01,
        0x78,
        0x8c,
        0x01,
        0x74,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
class SetStatusRequest(ProtocolBuffer.ProtocolMessage):
    has_status_ = 0
    status_ = ""

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

    def status(self):
        return self.status_

    def set_status(self, x):
        self.has_status_ = 1
        self.status_ = x

    def clear_status(self):
        if self.has_status_:
            self.has_status_ = 0
            self.status_ = ""

    def has_status(self):
        return self.has_status_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_status()): self.set_status(x.status())

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.SetStatusRequest', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(
                self, 'apphosting.SetStatusRequest')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.SetStatusRequest')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(
                self, 'apphosting.SetStatusRequest', output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(
                self, 'apphosting.SetStatusRequest', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.SetStatusRequest', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_status_ != x.has_status_: return 0
        if self.has_status_ and self.status_ != x.status_: return 0
        return 1

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

    def ByteSize(self):
        n = 0
        n += self.lengthString(len(self.status_))
        return n + 1

    def ByteSizePartial(self):
        n = 0
        if (self.has_status_):
            n += 1
            n += self.lengthString(len(self.status_))
        return n

    def Clear(self):
        self.clear_status()

    def OutputUnchecked(self, out):
        out.putVarInt32(10)
        out.putPrefixedString(self.status_)

    def OutputPartial(self, out):
        if (self.has_status_):
            out.putVarInt32(10)
            out.putPrefixedString(self.status_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 10:
                self.set_status(d.getPrefixedString())
                continue

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)

    def __str__(self, prefix="", printElemNumber=0):
        res = ""
        if self.has_status_:
            res += prefix + ("status: %s\n" %
                             self.DebugFormatString(self.status_))
        return res

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

    kstatus = 1

    _TEXT = _BuildTagLookupTable({
        0: "ErrorCode",
        1: "status",
    }, 1)

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

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WithcHBob3N0aW5nL2FwaS9sb2dzZXJ2aWNlL2xvZ19zZXJ2aWNlLnByb3RvChthcHBob3N0aW5nLlNldFN0YXR1c1JlcXVlc3QTGgZzdGF0dXMgASgCMAk4AhTCARdhcHBob3N0aW5nLkZsdXNoUmVxdWVzdA=="
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
class SetBlobStorageTypeRequest(ProtocolBuffer.ProtocolMessage):

    MEMORY = 0
    FILE = 1

    _StorageType_NAMES = {
        0: "MEMORY",
        1: "FILE",
    }

    def StorageType_Name(cls, x):
        return cls._StorageType_NAMES.get(x, "")

    StorageType_Name = classmethod(StorageType_Name)

    has_storage_type_ = 0
    storage_type_ = 0

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

    def storage_type(self):
        return self.storage_type_

    def set_storage_type(self, x):
        self.has_storage_type_ = 1
        self.storage_type_ = x

    def clear_storage_type(self):
        if self.has_storage_type_:
            self.has_storage_type_ = 0
            self.storage_type_ = 0

    def has_storage_type(self):
        return self.has_storage_type_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_storage_type()): self.set_storage_type(x.storage_type())

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.SetBlobStorageTypeRequest', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(
                self, 'apphosting.SetBlobStorageTypeRequest')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.SetBlobStorageTypeRequest')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(
                self, 'apphosting.SetBlobStorageTypeRequest', output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(
                self, 'apphosting.SetBlobStorageTypeRequest', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.SetBlobStorageTypeRequest', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_storage_type_ != x.has_storage_type_: return 0
        if self.has_storage_type_ and self.storage_type_ != x.storage_type_:
            return 0
        return 1

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

    def ByteSize(self):
        n = 0
        n += self.lengthVarInt64(self.storage_type_)
        return n + 1

    def ByteSizePartial(self):
        n = 0
        if (self.has_storage_type_):
            n += 1
            n += self.lengthVarInt64(self.storage_type_)
        return n

    def Clear(self):
        self.clear_storage_type()

    def OutputUnchecked(self, out):
        out.putVarInt32(8)
        out.putVarInt32(self.storage_type_)

    def OutputPartial(self, out):
        if (self.has_storage_type_):
            out.putVarInt32(8)
            out.putVarInt32(self.storage_type_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 8:
                self.set_storage_type(d.getVarInt32())
                continue

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError()
            d.skipData(tt)

    def __str__(self, prefix="", printElemNumber=0):
        res = ""
        if self.has_storage_type_:
            res += prefix + ("storage_type: %s\n" %
                             self.DebugFormatInt32(self.storage_type_))
        return res

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

    kstorage_type = 1

    _TEXT = _BuildTagLookupTable({
        0: "ErrorCode",
        1: "storage_type",
    }, 1)

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

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _PROTO_DESCRIPTOR_NAME = 'apphosting.SetBlobStorageTypeRequest'
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WjVhcHBob3N0aW5nL2FwaS9ibG9ic3RvcmUvYmxvYnN0b3JlX3N0dWJfc2VydmljZS5wcm90bwokYXBwaG9zdGluZy5TZXRCbG9iU3RvcmFnZVR5cGVSZXF1ZXN0ExoMc3RvcmFnZV90eXBlIAEoADAFOAJoABRzegtTdG9yYWdlVHlwZYsBkgEGTUVNT1JZmAEAjAGLAZIBBEZJTEWYAQGMAXTCARthcHBob3N0aW5nLlN0b3JlQmxvYlJlcXVlc3Q="
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 25
0
class GFS_PrimaryInfo(ProtocolBuffer.ProtocolMessage):
    def __init__(self, contents=None):
        self.machine_name_ = ""
        self.start_time_ = 0
        self.has_machine_name_ = 0
        self.has_start_time_ = 0
        if contents is not None: self.MergeFromString(contents)

    def machine_name(self):
        return self.machine_name_

    def set_machine_name(self, x):
        self.has_machine_name_ = 1
        self.machine_name_ = x

    def clear_machine_name(self):
        self.has_machine_name_ = 0
        self.machine_name_ = ""

    def has_machine_name(self):
        return self.has_machine_name_

    def start_time(self):
        return self.start_time_

    def set_start_time(self, x):
        self.has_start_time_ = 1
        self.start_time_ = x

    def clear_start_time(self):
        self.has_start_time_ = 0
        self.start_time_ = 0

    def has_start_time(self):
        return self.has_start_time_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_machine_name()): self.set_machine_name(x.machine_name())
        if (x.has_start_time()): self.set_start_time(x.start_time())

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(self, 'GFS_PrimaryInfo', s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(self, 'GFS_PrimaryInfo')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(self, 'GFS_PrimaryInfo',
                                                  output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(self, 'GFS_PrimaryInfo', s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'GFS_PrimaryInfo', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_machine_name_ != x.has_machine_name_: return 0
        if self.has_machine_name_ and self.machine_name_ != x.machine_name_:
            return 0
        if self.has_start_time_ != x.has_start_time_: return 0
        if self.has_start_time_ and self.start_time_ != x.start_time_: return 0
        return 1

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        if (not self.has_machine_name_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: machine_name not set.')
        if (not self.has_start_time_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: start_time not set.')
        return initialized

    def ByteSize(self):
        n = 0
        n += self.lengthString(len(self.machine_name_))
        n += self.lengthVarInt64(self.start_time_)
        return n + 2

    def Clear(self):
        self.clear_machine_name()
        self.clear_start_time()

    def OutputUnchecked(self, out):
        out.putVarInt32(10)
        out.putPrefixedString(self.machine_name_)
        out.putVarInt32(16)
        out.putVarInt64(self.start_time_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 10:
                self.set_machine_name(d.getPrefixedString())
                continue
            if tt == 16:
                self.set_start_time(d.getVarInt64())
                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_machine_name_:
            res += prefix + ("machine_name: %s\n" %
                             self.DebugFormatString(self.machine_name_))
        if self.has_start_time_:
            res += prefix + ("start_time: %s\n" %
                             self.DebugFormatInt64(self.start_time_))
        return res

    kmachine_name = 1
    kstart_time = 2

    _TEXT = (
        "ErrorCode",  #   0
        "machine_name",  #   1
        "start_time",  #   2
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.STRING,  #   1
        ProtocolBuffer.Encoder.NUMERIC,  #   2
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x28,
        0x65,
        0x6e,
        0x74,
        0x65,
        0x72,
        0x70,
        0x72,
        0x69,
        0x73,
        0x65,
        0x2f,
        0x63,
        0x6f,
        0x72,
        0x65,
        0x2f,
        0x67,
        0x66,
        0x73,
        0x2f,
        0x67,
        0x66,
        0x73,
        0x5f,
        0x73,
        0x75,
        0x70,
        0x65,
        0x72,
        0x62,
        0x6c,
        0x6f,
        0x63,
        0x6b,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x0f,
        0x47,
        0x46,
        0x53,
        0x5f,
        0x50,
        0x72,
        0x69,
        0x6d,
        0x61,
        0x72,
        0x79,
        0x49,
        0x6e,
        0x66,
        0x6f,
        0x13,
        0x1a,
        0x0c,
        0x6d,
        0x61,
        0x63,
        0x68,
        0x69,
        0x6e,
        0x65,
        0x5f,
        0x6e,
        0x61,
        0x6d,
        0x65,
        0x20,
        0x01,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x0a,
        0x73,
        0x74,
        0x61,
        0x72,
        0x74,
        0x5f,
        0x74,
        0x69,
        0x6d,
        0x65,
        0x20,
        0x02,
        0x28,
        0x00,
        0x30,
        0x03,
        0x38,
        0x02,
        0x14,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
class StoreBlobRequest(ProtocolBuffer.ProtocolMessage):
    has_blob_key_ = 0
    blob_key_ = ""
    has_content_ = 0
    content_ = ""

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

    def blob_key(self):
        return self.blob_key_

    def set_blob_key(self, x):
        self.has_blob_key_ = 1
        self.blob_key_ = x

    def clear_blob_key(self):
        if self.has_blob_key_:
            self.has_blob_key_ = 0
            self.blob_key_ = ""

    def has_blob_key(self):
        return self.has_blob_key_

    def content(self):
        return self.content_

    def set_content(self, x):
        self.has_content_ = 1
        self.content_ = x

    def clear_content(self):
        if self.has_content_:
            self.has_content_ = 0
            self.content_ = ""

    def has_content(self):
        return self.has_content_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_blob_key()): self.set_blob_key(x.blob_key())
        if (x.has_content()): self.set_content(x.content())

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.StoreBlobRequest', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(
                self, 'apphosting.StoreBlobRequest')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.StoreBlobRequest')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(
                self, 'apphosting.StoreBlobRequest', output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(
                self, 'apphosting.StoreBlobRequest', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.StoreBlobRequest', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_blob_key_ != x.has_blob_key_: return 0
        if self.has_blob_key_ and self.blob_key_ != x.blob_key_: return 0
        if self.has_content_ != x.has_content_: return 0
        if self.has_content_ and self.content_ != x.content_: return 0
        return 1

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

    def ByteSize(self):
        n = 0
        n += self.lengthString(len(self.blob_key_))
        if (self.has_content_): n += 1 + self.lengthString(len(self.content_))
        return n + 1

    def ByteSizePartial(self):
        n = 0
        if (self.has_blob_key_):
            n += 1
            n += self.lengthString(len(self.blob_key_))
        if (self.has_content_): n += 1 + self.lengthString(len(self.content_))
        return n

    def Clear(self):
        self.clear_blob_key()
        self.clear_content()

    def OutputUnchecked(self, out):
        out.putVarInt32(10)
        out.putPrefixedString(self.blob_key_)
        if (self.has_content_):
            out.putVarInt32(18)
            out.putPrefixedString(self.content_)

    def OutputPartial(self, out):
        if (self.has_blob_key_):
            out.putVarInt32(10)
            out.putPrefixedString(self.blob_key_)
        if (self.has_content_):
            out.putVarInt32(18)
            out.putPrefixedString(self.content_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 10:
                self.set_blob_key(d.getPrefixedString())
                continue
            if tt == 18:
                self.set_content(d.getPrefixedString())
                continue

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError()
            d.skipData(tt)

    def __str__(self, prefix="", printElemNumber=0):
        res = ""
        if self.has_blob_key_:
            res += prefix + ("blob_key: %s\n" %
                             self.DebugFormatString(self.blob_key_))
        if self.has_content_:
            res += prefix + ("content: %s\n" %
                             self.DebugFormatString(self.content_))
        return res

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

    kblob_key = 1
    kcontent = 2

    _TEXT = _BuildTagLookupTable(
        {
            0: "ErrorCode",
            1: "blob_key",
            2: "content",
        }, 2)

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

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _PROTO_DESCRIPTOR_NAME = 'apphosting.StoreBlobRequest'
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WjVhcHBob3N0aW5nL2FwaS9ibG9ic3RvcmUvYmxvYnN0b3JlX3N0dWJfc2VydmljZS5wcm90bwobYXBwaG9zdGluZy5TdG9yZUJsb2JSZXF1ZXN0ExoIYmxvYl9rZXkgASgCMAk4AhQTGgdjb250ZW50IAIoAjAJOAEUugGgBAo1YXBwaG9zdGluZy9hcGkvYmxvYnN0b3JlL2Jsb2JzdG9yZV9zdHViX3NlcnZpY2UucHJvdG8SCmFwcGhvc3RpbmcaHWFwcGhvc3RpbmcvYXBpL2FwaV9iYXNlLnByb3RvIjUKEFN0b3JlQmxvYlJlcXVlc3QSEAoIYmxvYl9rZXkYASACKAkSDwoHY29udGVudBgCIAEoDCKJAQoZU2V0QmxvYlN0b3JhZ2VUeXBlUmVxdWVzdBJHCgxzdG9yYWdlX3R5cGUYASACKA4yMS5hcHBob3N0aW5nLlNldEJsb2JTdG9yYWdlVHlwZVJlcXVlc3QuU3RvcmFnZVR5cGUiIwoLU3RvcmFnZVR5cGUSCgoGTUVNT1JZEAASCAoERklMRRABMroBChRCbG9ic3RvcmVTdHViU2VydmljZRJHCglTdG9yZUJsb2ISHC5hcHBob3N0aW5nLlN0b3JlQmxvYlJlcXVlc3QaGi5hcHBob3N0aW5nLmJhc2UuVm9pZFByb3RvIgASWQoSU2V0QmxvYlN0b3JhZ2VUeXBlEiUuYXBwaG9zdGluZy5TZXRCbG9iU3RvcmFnZVR5cGVSZXF1ZXN0GhouYXBwaG9zdGluZy5iYXNlLlZvaWRQcm90byIAQjwKImNvbS5nb29nbGUuYXBwZW5naW5lLmFwaS5ibG9ic3RvcmVCFkJsb2JzdG9yZVN0dWJTZXJ2aWNlUGI="
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
class ReviewAttributes(ProtocolBuffer.ProtocolMessage):

  MESSAGE_TYPE_ID = 2710184 

  _TypeId_NAMES = {
    2710184: "MESSAGE_TYPE_ID",
  }

  def TypeId_Name(cls, x): return cls._TypeId_NAMES.get(x, "")
  TypeId_Name = classmethod(TypeId_Name)


  GENERIC_REVIEW =    0 
  EDITORIAL_REVIEW =    1 
  ZIPIT_REVIEW =    2 

  _REVIEW_TYPE_NAMES = {
    0: "GENERIC_REVIEW",
    1: "EDITORIAL_REVIEW",
    2: "ZIPIT_REVIEW",
  }

  def REVIEW_TYPE_Name(cls, x): return cls._REVIEW_TYPE_NAMES.get(x, "")
  REVIEW_TYPE_Name = classmethod(REVIEW_TYPE_Name)

  def __init__(self, contents=None):
    self.is_editorial_ = 0
    self.title_ = ""
    self.is_title_from_body_ = 0
    self.author_ = ""
    self.date_ = 0
    self.julian_date_ = 0
    self.rating_ = 0
    self.language_ = 0
    self.fingerprint_ = 0
    self.combined_quality_score_ = 0.0
    self.review_type_ = 0
    self.has_is_editorial_ = 0
    self.has_title_ = 0
    self.has_is_title_from_body_ = 0
    self.has_author_ = 0
    self.has_date_ = 0
    self.has_julian_date_ = 0
    self.has_rating_ = 0
    self.has_language_ = 0
    self.has_fingerprint_ = 0
    self.has_combined_quality_score_ = 0
    self.has_review_type_ = 0
    if contents is not None: self.MergeFromString(contents)

  def is_editorial(self): return self.is_editorial_

  def set_is_editorial(self, x):
    self.has_is_editorial_ = 1
    self.is_editorial_ = x

  def clear_is_editorial(self):
    self.has_is_editorial_ = 0
    self.is_editorial_ = 0

  def has_is_editorial(self): return self.has_is_editorial_

  def title(self): return self.title_

  def set_title(self, x):
    self.has_title_ = 1
    self.title_ = x

  def clear_title(self):
    self.has_title_ = 0
    self.title_ = ""

  def has_title(self): return self.has_title_

  def is_title_from_body(self): return self.is_title_from_body_

  def set_is_title_from_body(self, x):
    self.has_is_title_from_body_ = 1
    self.is_title_from_body_ = x

  def clear_is_title_from_body(self):
    self.has_is_title_from_body_ = 0
    self.is_title_from_body_ = 0

  def has_is_title_from_body(self): return self.has_is_title_from_body_

  def author(self): return self.author_

  def set_author(self, x):
    self.has_author_ = 1
    self.author_ = x

  def clear_author(self):
    self.has_author_ = 0
    self.author_ = ""

  def has_author(self): return self.has_author_

  def date(self): return self.date_

  def set_date(self, x):
    self.has_date_ = 1
    self.date_ = x

  def clear_date(self):
    self.has_date_ = 0
    self.date_ = 0

  def has_date(self): return self.has_date_

  def julian_date(self): return self.julian_date_

  def set_julian_date(self, x):
    self.has_julian_date_ = 1
    self.julian_date_ = x

  def clear_julian_date(self):
    self.has_julian_date_ = 0
    self.julian_date_ = 0

  def has_julian_date(self): return self.has_julian_date_

  def rating(self): return self.rating_

  def set_rating(self, x):
    self.has_rating_ = 1
    self.rating_ = x

  def clear_rating(self):
    self.has_rating_ = 0
    self.rating_ = 0

  def has_rating(self): return self.has_rating_

  def language(self): return self.language_

  def set_language(self, x):
    self.has_language_ = 1
    self.language_ = x

  def clear_language(self):
    self.has_language_ = 0
    self.language_ = 0

  def has_language(self): return self.has_language_

  def fingerprint(self): return self.fingerprint_

  def set_fingerprint(self, x):
    self.has_fingerprint_ = 1
    self.fingerprint_ = x

  def clear_fingerprint(self):
    self.has_fingerprint_ = 0
    self.fingerprint_ = 0

  def has_fingerprint(self): return self.has_fingerprint_

  def combined_quality_score(self): return self.combined_quality_score_

  def set_combined_quality_score(self, x):
    self.has_combined_quality_score_ = 1
    self.combined_quality_score_ = x

  def clear_combined_quality_score(self):
    self.has_combined_quality_score_ = 0
    self.combined_quality_score_ = 0.0

  def has_combined_quality_score(self): return self.has_combined_quality_score_

  def review_type(self): return self.review_type_

  def set_review_type(self, x):
    self.has_review_type_ = 1
    self.review_type_ = x

  def clear_review_type(self):
    self.has_review_type_ = 0
    self.review_type_ = 0

  def has_review_type(self): return self.has_review_type_


  def MergeFrom(self, x):
    assert x is not self
    if (x.has_is_editorial()): self.set_is_editorial(x.is_editorial())
    if (x.has_title()): self.set_title(x.title())
    if (x.has_is_title_from_body()): self.set_is_title_from_body(x.is_title_from_body())
    if (x.has_author()): self.set_author(x.author())
    if (x.has_date()): self.set_date(x.date())
    if (x.has_julian_date()): self.set_julian_date(x.julian_date())
    if (x.has_rating()): self.set_rating(x.rating())
    if (x.has_language()): self.set_language(x.language())
    if (x.has_fingerprint()): self.set_fingerprint(x.fingerprint())
    if (x.has_combined_quality_score()): self.set_combined_quality_score(x.combined_quality_score())
    if (x.has_review_type()): self.set_review_type(x.review_type())

  def _CMergeFromString(self, s):
    _net_proto___parse__python.MergeFromString(self, 'localsearch.ReviewAttributes', s)

  def _CEncode(self):
    return _net_proto___parse__python.Encode(self, 'localsearch.ReviewAttributes')

  def _CToASCII(self, output_format):
    return _net_proto___parse__python.ToASCII(self, 'localsearch.ReviewAttributes', output_format)


  def ParseASCII(self, s):
    _net_proto___parse__python.ParseASCII(self, 'localsearch.ReviewAttributes', s)


  def ParseASCIIIgnoreUnknown(self, s):
    _net_proto___parse__python.ParseASCIIIgnoreUnknown(self, 'localsearch.ReviewAttributes', s)


  def Equals(self, x):
    if x is self: return 1
    if self.has_is_editorial_ != x.has_is_editorial_: return 0
    if self.has_is_editorial_ and self.is_editorial_ != x.is_editorial_: return 0
    if self.has_title_ != x.has_title_: return 0
    if self.has_title_ and self.title_ != x.title_: return 0
    if self.has_is_title_from_body_ != x.has_is_title_from_body_: return 0
    if self.has_is_title_from_body_ and self.is_title_from_body_ != x.is_title_from_body_: return 0
    if self.has_author_ != x.has_author_: return 0
    if self.has_author_ and self.author_ != x.author_: return 0
    if self.has_date_ != x.has_date_: return 0
    if self.has_date_ and self.date_ != x.date_: return 0
    if self.has_julian_date_ != x.has_julian_date_: return 0
    if self.has_julian_date_ and self.julian_date_ != x.julian_date_: return 0
    if self.has_rating_ != x.has_rating_: return 0
    if self.has_rating_ and self.rating_ != x.rating_: return 0
    if self.has_language_ != x.has_language_: return 0
    if self.has_language_ and self.language_ != x.language_: return 0
    if self.has_fingerprint_ != x.has_fingerprint_: return 0
    if self.has_fingerprint_ and self.fingerprint_ != x.fingerprint_: return 0
    if self.has_combined_quality_score_ != x.has_combined_quality_score_: return 0
    if self.has_combined_quality_score_ and self.combined_quality_score_ != x.combined_quality_score_: return 0
    if self.has_review_type_ != x.has_review_type_: return 0
    if self.has_review_type_ and self.review_type_ != x.review_type_: return 0
    return 1

  def __eq__(self, other):
    return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)

  def __ne__(self, other):
    return not (self == other)

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

  def ByteSize(self):
    n = 0
    if (self.has_title_): n += 1 + self.lengthString(len(self.title_))
    if (self.has_is_title_from_body_): n += 2
    if (self.has_author_): n += 1 + self.lengthString(len(self.author_))
    if (self.has_date_): n += 1 + self.lengthVarInt64(self.date_)
    if (self.has_julian_date_): n += 1 + self.lengthVarInt64(self.julian_date_)
    if (self.has_rating_): n += 1 + self.lengthVarInt64(self.rating_)
    if (self.has_language_): n += 1 + self.lengthVarInt64(self.language_)
    if (self.has_fingerprint_): n += 9
    if (self.has_combined_quality_score_): n += 9
    if (self.has_review_type_): n += 1 + self.lengthVarInt64(self.review_type_)
    return n + 2

  def Clear(self):
    self.clear_is_editorial()
    self.clear_title()
    self.clear_is_title_from_body()
    self.clear_author()
    self.clear_date()
    self.clear_julian_date()
    self.clear_rating()
    self.clear_language()
    self.clear_fingerprint()
    self.clear_combined_quality_score()
    self.clear_review_type()

  def OutputUnchecked(self, out):
    out.putVarInt32(8)
    out.putBoolean(self.is_editorial_)
    if (self.has_title_):
      out.putVarInt32(18)
      out.putPrefixedString(self.title_)
    if (self.has_author_):
      out.putVarInt32(26)
      out.putPrefixedString(self.author_)
    if (self.has_date_):
      out.putVarInt32(32)
      out.putVarInt32(self.date_)
    if (self.has_rating_):
      out.putVarInt32(40)
      out.putVarInt32(self.rating_)
    if (self.has_julian_date_):
      out.putVarInt32(48)
      out.putVarInt32(self.julian_date_)
    if (self.has_review_type_):
      out.putVarInt32(56)
      out.putVarInt32(self.review_type_)
    if (self.has_language_):
      out.putVarInt32(64)
      out.putVarInt32(self.language_)
    if (self.has_fingerprint_):
      out.putVarInt32(73)
      out.put64(self.fingerprint_)
    if (self.has_is_title_from_body_):
      out.putVarInt32(80)
      out.putBoolean(self.is_title_from_body_)
    if (self.has_combined_quality_score_):
      out.putVarInt32(89)
      out.putDouble(self.combined_quality_score_)

  def TryMerge(self, d):
    while d.avail() > 0:
      tt = d.getVarInt32()
      if tt == 8:
        self.set_is_editorial(d.getBoolean())
        continue
      if tt == 18:
        self.set_title(d.getPrefixedString())
        continue
      if tt == 26:
        self.set_author(d.getPrefixedString())
        continue
      if tt == 32:
        self.set_date(d.getVarInt32())
        continue
      if tt == 40:
        self.set_rating(d.getVarInt32())
        continue
      if tt == 48:
        self.set_julian_date(d.getVarInt32())
        continue
      if tt == 56:
        self.set_review_type(d.getVarInt32())
        continue
      if tt == 64:
        self.set_language(d.getVarInt32())
        continue
      if tt == 73:
        self.set_fingerprint(d.get64())
        continue
      if tt == 80:
        self.set_is_title_from_body(d.getBoolean())
        continue
      if tt == 89:
        self.set_combined_quality_score(d.getDouble())
        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_is_editorial_: res+=prefix+("is_editorial: %s\n" % self.DebugFormatBool(self.is_editorial_))
    if self.has_title_: res+=prefix+("title: %s\n" % self.DebugFormatString(self.title_))
    if self.has_is_title_from_body_: res+=prefix+("is_title_from_body: %s\n" % self.DebugFormatBool(self.is_title_from_body_))
    if self.has_author_: res+=prefix+("author: %s\n" % self.DebugFormatString(self.author_))
    if self.has_date_: res+=prefix+("date: %s\n" % self.DebugFormatInt32(self.date_))
    if self.has_julian_date_: res+=prefix+("julian_date: %s\n" % self.DebugFormatInt32(self.julian_date_))
    if self.has_rating_: res+=prefix+("rating: %s\n" % self.DebugFormatInt32(self.rating_))
    if self.has_language_: res+=prefix+("language: %s\n" % self.DebugFormatInt32(self.language_))
    if self.has_fingerprint_: res+=prefix+("fingerprint: %s\n" % self.DebugFormatFixed64(self.fingerprint_))
    if self.has_combined_quality_score_: res+=prefix+("combined_quality_score: %s\n" % self.DebugFormat(self.combined_quality_score_))
    if self.has_review_type_: res+=prefix+("review_type: %s\n" % self.DebugFormatInt32(self.review_type_))
    return res

  kis_editorial = 1
  ktitle = 2
  kis_title_from_body = 10
  kauthor = 3
  kdate = 4
  kjulian_date = 6
  krating = 5
  klanguage = 8
  kfingerprint = 9
  kcombined_quality_score = 11
  kreview_type = 7

  _TEXT = (
   "ErrorCode",  #   0
   "is_editorial",  #   1
   "title",  #   2
   "author",  #   3
   "date",  #   4
   "rating",  #   5
   "julian_date",  #   6
   "review_type",  #   7
   "language",  #   8
   "fingerprint",  #   9
   "is_title_from_body",  #  10
   "combined_quality_score",  #  11
  )

  _TYPES = (
   ProtocolBuffer.Encoder.NUMERIC,  #   0
   ProtocolBuffer.Encoder.NUMERIC,  #   1

   ProtocolBuffer.Encoder.STRING,  #   2

   ProtocolBuffer.Encoder.STRING,  #   3

   ProtocolBuffer.Encoder.NUMERIC,  #   4

   ProtocolBuffer.Encoder.NUMERIC,  #   5

   ProtocolBuffer.Encoder.NUMERIC,  #   6

   ProtocolBuffer.Encoder.NUMERIC,  #   7

   ProtocolBuffer.Encoder.NUMERIC,  #   8

   ProtocolBuffer.Encoder.DOUBLE,  #   9

   ProtocolBuffer.Encoder.NUMERIC,  #  10

   ProtocolBuffer.Encoder.DOUBLE,  #  11

  )

  # stylesheet for XML output
  _STYLE = \
   """"""
  _STYLE_CONTENT_TYPE = \
   """"""
  _SERIALIZED_DESCRIPTOR = array.array('B', [
    0x5a,
    0x27,
    0x6c,
    0x6f,
    0x63,
    0x61,
    0x6c,
    0x73,
    0x65,
    0x61,
    0x72,
    0x63,
    0x68,
    0x2f,
    0x62,
    0x61,
    0x73,
    0x65,
    0x2f,
    0x72,
    0x65,
    0x76,
    0x69,
    0x65,
    0x77,
    0x61,
    0x74,
    0x74,
    0x72,
    0x69,
    0x62,
    0x75,
    0x74,
    0x65,
    0x73,
    0x2e,
    0x70,
    0x72,
    0x6f,
    0x74,
    0x6f,
    0x0a,
    0x1c,
    0x6c,
    0x6f,
    0x63,
    0x61,
    0x6c,
    0x73,
    0x65,
    0x61,
    0x72,
    0x63,
    0x68,
    0x2e,
    0x52,
    0x65,
    0x76,
    0x69,
    0x65,
    0x77,
    0x41,
    0x74,
    0x74,
    0x72,
    0x69,
    0x62,
    0x75,
    0x74,
    0x65,
    0x73,
    0x13,
    0x1a,
    0x0c,
    0x69,
    0x73,
    0x5f,
    0x65,
    0x64,
    0x69,
    0x74,
    0x6f,
    0x72,
    0x69,
    0x61,
    0x6c,
    0x20,
    0x01,
    0x28,
    0x00,
    0x30,
    0x08,
    0x38,
    0x02,
    0x14,
    0x13,
    0x1a,
    0x05,
    0x74,
    0x69,
    0x74,
    0x6c,
    0x65,
    0x20,
    0x02,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x12,
    0x69,
    0x73,
    0x5f,
    0x74,
    0x69,
    0x74,
    0x6c,
    0x65,
    0x5f,
    0x66,
    0x72,
    0x6f,
    0x6d,
    0x5f,
    0x62,
    0x6f,
    0x64,
    0x79,
    0x20,
    0x0a,
    0x28,
    0x00,
    0x30,
    0x08,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x06,
    0x61,
    0x75,
    0x74,
    0x68,
    0x6f,
    0x72,
    0x20,
    0x03,
    0x28,
    0x02,
    0x30,
    0x09,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x04,
    0x64,
    0x61,
    0x74,
    0x65,
    0x20,
    0x04,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x0b,
    0x6a,
    0x75,
    0x6c,
    0x69,
    0x61,
    0x6e,
    0x5f,
    0x64,
    0x61,
    0x74,
    0x65,
    0x20,
    0x06,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x42,
    0x01,
    0x30,
    0xa3,
    0x01,
    0xaa,
    0x01,
    0x07,
    0x64,
    0x65,
    0x66,
    0x61,
    0x75,
    0x6c,
    0x74,
    0xb2,
    0x01,
    0x01,
    0x30,
    0xa4,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x06,
    0x72,
    0x61,
    0x74,
    0x69,
    0x6e,
    0x67,
    0x20,
    0x05,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x08,
    0x6c,
    0x61,
    0x6e,
    0x67,
    0x75,
    0x61,
    0x67,
    0x65,
    0x20,
    0x08,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x0b,
    0x66,
    0x69,
    0x6e,
    0x67,
    0x65,
    0x72,
    0x70,
    0x72,
    0x69,
    0x6e,
    0x74,
    0x20,
    0x09,
    0x28,
    0x01,
    0x30,
    0x06,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x16,
    0x63,
    0x6f,
    0x6d,
    0x62,
    0x69,
    0x6e,
    0x65,
    0x64,
    0x5f,
    0x71,
    0x75,
    0x61,
    0x6c,
    0x69,
    0x74,
    0x79,
    0x5f,
    0x73,
    0x63,
    0x6f,
    0x72,
    0x65,
    0x20,
    0x0b,
    0x28,
    0x01,
    0x30,
    0x01,
    0x38,
    0x01,
    0x14,
    0x13,
    0x1a,
    0x0b,
    0x72,
    0x65,
    0x76,
    0x69,
    0x65,
    0x77,
    0x5f,
    0x74,
    0x79,
    0x70,
    0x65,
    0x20,
    0x07,
    0x28,
    0x00,
    0x30,
    0x05,
    0x38,
    0x01,
    0x42,
    0x01,
    0x30,
    0x68,
    0x01,
    0xa3,
    0x01,
    0xaa,
    0x01,
    0x07,
    0x64,
    0x65,
    0x66,
    0x61,
    0x75,
    0x6c,
    0x74,
    0xb2,
    0x01,
    0x0e,
    0x47,
    0x45,
    0x4e,
    0x45,
    0x52,
    0x49,
    0x43,
    0x5f,
    0x52,
    0x45,
    0x56,
    0x49,
    0x45,
    0x57,
    0xa4,
    0x01,
    0x14,
    0x73,
    0x7a,
    0x06,
    0x54,
    0x79,
    0x70,
    0x65,
    0x49,
    0x64,
    0x8b,
    0x01,
    0x92,
    0x01,
    0x0f,
    0x4d,
    0x45,
    0x53,
    0x53,
    0x41,
    0x47,
    0x45,
    0x5f,
    0x54,
    0x59,
    0x50,
    0x45,
    0x5f,
    0x49,
    0x44,
    0x98,
    0x01,
    0xa8,
    0xb5,
    0xa5,
    0x01,
    0x8c,
    0x01,
    0x74,
    0x73,
    0x7a,
    0x0b,
    0x52,
    0x45,
    0x56,
    0x49,
    0x45,
    0x57,
    0x5f,
    0x54,
    0x59,
    0x50,
    0x45,
    0x8b,
    0x01,
    0x92,
    0x01,
    0x0e,
    0x47,
    0x45,
    0x4e,
    0x45,
    0x52,
    0x49,
    0x43,
    0x5f,
    0x52,
    0x45,
    0x56,
    0x49,
    0x45,
    0x57,
    0x98,
    0x01,
    0x00,
    0x8c,
    0x01,
    0x8b,
    0x01,
    0x92,
    0x01,
    0x10,
    0x45,
    0x44,
    0x49,
    0x54,
    0x4f,
    0x52,
    0x49,
    0x41,
    0x4c,
    0x5f,
    0x52,
    0x45,
    0x56,
    0x49,
    0x45,
    0x57,
    0x98,
    0x01,
    0x01,
    0x8c,
    0x01,
    0x8b,
    0x01,
    0x92,
    0x01,
    0x0c,
    0x5a,
    0x49,
    0x50,
    0x49,
    0x54,
    0x5f,
    0x52,
    0x45,
    0x56,
    0x49,
    0x45,
    0x57,
    0x98,
    0x01,
    0x02,
    0x8c,
    0x01,
    0x74,
    ])
  _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 28
0
class KeyValues(ProtocolBuffer.ProtocolMessage):
    has_key_ = 0
    key_ = ""
    has_partial_ = 0
    partial_ = 0

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

    def key(self):
        return self.key_

    def set_key(self, x):
        self.has_key_ = 1
        self.key_ = x

    def clear_key(self):
        if self.has_key_:
            self.has_key_ = 0
            self.key_ = ""

    def has_key(self):
        return self.has_key_

    def value_size(self):
        return len(self.value_)

    def value_list(self):
        return self.value_

    def value(self, i):
        return self.value_[i]

    def set_value(self, i, x):
        self.value_[i] = x

    def add_value(self, x):
        self.value_.append(x)

    def clear_value(self):
        self.value_ = []

    def partial(self):
        return self.partial_

    def set_partial(self, x):
        self.has_partial_ = 1
        self.partial_ = x

    def clear_partial(self):
        if self.has_partial_:
            self.has_partial_ = 0
            self.partial_ = 0

    def has_partial(self):
        return self.has_partial_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_key()): self.set_key(x.key())
        for i in xrange(x.value_size()):
            self.add_value(x.value(i))
        if (x.has_partial()): self.set_partial(x.partial())

    if _net_proto___parse__python is not None:

        def _CMergeFromString(self, s):
            _net_proto___parse__python.MergeFromString(
                self, 'apphosting.ext.mapreduce.KeyValues', s)

    if _net_proto___parse__python is not None:

        def _CEncode(self):
            return _net_proto___parse__python.Encode(
                self, 'apphosting.ext.mapreduce.KeyValues')

    if _net_proto___parse__python is not None:

        def _CEncodePartial(self):
            return _net_proto___parse__python.EncodePartial(
                self, 'apphosting.ext.mapreduce.KeyValues')

    if _net_proto___parse__python is not None:

        def _CToASCII(self, output_format):
            return _net_proto___parse__python.ToASCII(
                self, 'apphosting.ext.mapreduce.KeyValues', output_format)

    if _net_proto___parse__python is not None:

        def ParseASCII(self, s):
            _net_proto___parse__python.ParseASCII(
                self, 'apphosting.ext.mapreduce.KeyValues', s)

    if _net_proto___parse__python is not None:

        def ParseASCIIIgnoreUnknown(self, s):
            _net_proto___parse__python.ParseASCIIIgnoreUnknown(
                self, 'apphosting.ext.mapreduce.KeyValues', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_key_ != x.has_key_: return 0
        if self.has_key_ and self.key_ != x.key_: return 0
        if len(self.value_) != len(x.value_): return 0
        for e1, e2 in zip(self.value_, x.value_):
            if e1 != e2: return 0
        if self.has_partial_ != x.has_partial_: return 0
        if self.has_partial_ and self.partial_ != x.partial_: return 0
        return 1

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

    def ByteSize(self):
        n = 0
        n += self.lengthString(len(self.key_))
        n += 1 * len(self.value_)
        for i in xrange(len(self.value_)):
            n += self.lengthString(len(self.value_[i]))
        if (self.has_partial_): n += 2
        return n + 1

    def ByteSizePartial(self):
        n = 0
        if (self.has_key_):
            n += 1
            n += self.lengthString(len(self.key_))
        n += 1 * len(self.value_)
        for i in xrange(len(self.value_)):
            n += self.lengthString(len(self.value_[i]))
        if (self.has_partial_): n += 2
        return n

    def Clear(self):
        self.clear_key()
        self.clear_value()
        self.clear_partial()

    def OutputUnchecked(self, out):
        out.putVarInt32(10)
        out.putPrefixedString(self.key_)
        for i in xrange(len(self.value_)):
            out.putVarInt32(18)
            out.putPrefixedString(self.value_[i])
        if (self.has_partial_):
            out.putVarInt32(24)
            out.putBoolean(self.partial_)

    def OutputPartial(self, out):
        if (self.has_key_):
            out.putVarInt32(10)
            out.putPrefixedString(self.key_)
        for i in xrange(len(self.value_)):
            out.putVarInt32(18)
            out.putPrefixedString(self.value_[i])
        if (self.has_partial_):
            out.putVarInt32(24)
            out.putBoolean(self.partial_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 10:
                self.set_key(d.getPrefixedString())
                continue
            if tt == 18:
                self.add_value(d.getPrefixedString())
                continue
            if tt == 24:
                self.set_partial(d.getBoolean())
                continue

            if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)

    def __str__(self, prefix="", printElemNumber=0):
        res = ""
        if self.has_key_:
            res += prefix + ("key: %s\n" % self.DebugFormatString(self.key_))
        cnt = 0
        for e in self.value_:
            elm = ""
            if printElemNumber: elm = "(%d)" % cnt
            res += prefix + ("value%s: %s\n" %
                             (elm, self.DebugFormatString(e)))
            cnt += 1
        if self.has_partial_:
            res += prefix + ("partial: %s\n" %
                             self.DebugFormatBool(self.partial_))
        return res

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

    kkey = 1
    kvalue = 2
    kpartial = 3

    _TEXT = _BuildTagLookupTable(
        {
            0: "ErrorCode",
            1: "key",
            2: "value",
            3: "partial",
        }, 3)

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

    _STYLE = """"""
    _STYLE_CONTENT_TYPE = """"""
    _PROTO_DESCRIPTOR_NAME = 'apphosting.ext.mapreduce.KeyValues'
    _SERIALIZED_DESCRIPTOR = array.array('B')
    _SERIALIZED_DESCRIPTOR.fromstring(
        base64.decodestring(
            "WiFhcHBob3N0aW5nL2V4dC9tYXByZWR1Y2Uva3YucHJvdG8KImFwcGhvc3RpbmcuZXh0Lm1hcHJlZHVjZS5LZXlWYWx1ZXMTGgNrZXkgASgCMAk4AqMBqgEFY3R5cGWyAQRDb3JkpAEUExoFdmFsdWUgAigCMAk4A6MBqgEFY3R5cGWyAQRDb3JkpAEUExoHcGFydGlhbCADKAAwCDgBQgVmYWxzZaMBqgEHZGVmYXVsdLIBBWZhbHNlpAEUwgEhYXBwaG9zdGluZy5leHQubWFwcmVkdWNlLktleVZhbHVl"
        ))
    if _net_proto___parse__python is not None:
        _net_proto___parse__python.RegisterType(
            _SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 29
0
class LinksResultsProto(ProtocolBuffer.ProtocolMessage):
    def __init__(self, contents=None):
        self.totallinks_ = 0
        self.links_ = []
        self.has_totallinks_ = 0
        if contents is not None: self.MergeFromString(contents)

    def totallinks(self):
        return self.totallinks_

    def set_totallinks(self, x):
        self.has_totallinks_ = 1
        self.totallinks_ = x

    def clear_totallinks(self):
        self.has_totallinks_ = 0
        self.totallinks_ = 0

    def has_totallinks(self):
        return self.has_totallinks_

    def links_size(self):
        return len(self.links_)

    def links_list(self):
        return self.links_

    def links(self, i):
        return self.links_[i]

    def mutable_links(self, i):
        return self.links_[i]

    def add_links(self):
        x = LinksResultsProto_Links()
        self.links_.append(x)
        return x

    def clear_links(self):
        self.links_ = []

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_totallinks()): self.set_totallinks(x.totallinks())
        for i in xrange(x.links_size()):
            self.add_links().CopyFrom(x.links(i))

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(self, 'LinksResultsProto',
                                                   s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(self, 'LinksResultsProto')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(self, 'LinksResultsProto',
                                                  output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(self, 'LinksResultsProto', s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'LinksResultsProto', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_totallinks_ != x.has_totallinks_: return 0
        if self.has_totallinks_ and self.totallinks_ != x.totallinks_: return 0
        if len(self.links_) != len(x.links_): return 0
        for e1, e2 in zip(self.links_, x.links_):
            if e1 != e2: return 0
        return 1

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

    def IsInitialized(self, debug_strs=None):
        initialized = 1
        if (not self.has_totallinks_):
            initialized = 0
            if debug_strs is not None:
                debug_strs.append('Required field: totallinks not set.')
        for i in xrange(len(self.links_)):
            if (not self.links_[i].IsInitialized(debug_strs)): initialized = 0
        return initialized

    def ByteSize(self):
        n = 0
        n += self.lengthVarInt64(self.totallinks_)
        n += 2 * len(self.links_)
        for i in xrange(len(self.links_)):
            n += self.links_[i].ByteSize()
        return n + 1

    def Clear(self):
        self.clear_totallinks()
        self.clear_links()

    def OutputUnchecked(self, out):
        out.putVarInt32(8)
        out.putVarInt64(self.totallinks_)
        for i in xrange(len(self.links_)):
            out.putVarInt32(19)
            self.links_[i].OutputUnchecked(out)
            out.putVarInt32(20)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 8:
                self.set_totallinks(d.getVarInt64())
                continue
            if tt == 19:
                self.add_links().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_totallinks_:
            res += prefix + ("TotalLinks: %s\n" %
                             self.DebugFormatInt64(self.totallinks_))
        cnt = 0
        for e in self.links_:
            elm = ""
            if printElemNumber: elm = "(%d)" % cnt
            res += prefix + ("Links%s {\n" % elm)
            res += e.__str__(prefix + "  ", printElemNumber)
            res += prefix + "}\n"
            cnt += 1
        return res

    kTotalLinks = 1
    kLinksGroup = 2
    kLinksDocid = 3
    kLinksPagerank = 4

    _TEXT = (
        "ErrorCode",  #   0
        "TotalLinks",  #   1
        "Links",  #   2
        "Docid",  #   3
        "Pagerank",  #   4
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.NUMERIC,  #   1
        ProtocolBuffer.Encoder.STARTGROUP,  #   2
        ProtocolBuffer.Encoder.NUMERIC,  #   3
        ProtocolBuffer.Encoder.FLOAT,  #   4
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x1d,
        0x6c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x65,
        0x72,
        0x76,
        0x65,
        0x72,
        0x2f,
        0x72,
        0x70,
        0x63,
        0x2f,
        0x6c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x72,
        0x70,
        0x63,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x11,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x52,
        0x65,
        0x73,
        0x75,
        0x6c,
        0x74,
        0x73,
        0x50,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x13,
        0x1a,
        0x0a,
        0x54,
        0x6f,
        0x74,
        0x61,
        0x6c,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x20,
        0x01,
        0x28,
        0x00,
        0x30,
        0x03,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x05,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x20,
        0x02,
        0x28,
        0x03,
        0x30,
        0x0a,
        0x38,
        0x03,
        0x14,
        0x13,
        0x1a,
        0x0b,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x2e,
        0x44,
        0x6f,
        0x63,
        0x69,
        0x64,
        0x20,
        0x03,
        0x28,
        0x00,
        0x30,
        0x04,
        0x38,
        0x02,
        0x60,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0e,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x2e,
        0x50,
        0x61,
        0x67,
        0x65,
        0x72,
        0x61,
        0x6e,
        0x6b,
        0x20,
        0x04,
        0x28,
        0x05,
        0x30,
        0x02,
        0x38,
        0x01,
        0x60,
        0x01,
        0x14,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())
Exemplo n.º 30
0
class ImageLinkInfo(ProtocolBuffer.ProtocolMessage):
    def __init__(self, contents=None):
        self.docid_ = 0
        self.page_docid_ = 0
        self.is_visible_ = 1
        self.shared_path_ = 0
        self.url_ = ""
        self.has_docid_ = 0
        self.has_page_docid_ = 0
        self.has_is_visible_ = 0
        self.has_shared_path_ = 0
        self.has_url_ = 0
        if contents is not None: self.MergeFromString(contents)

    def docid(self):
        return self.docid_

    def set_docid(self, x):
        self.has_docid_ = 1
        self.docid_ = x

    def clear_docid(self):
        self.has_docid_ = 0
        self.docid_ = 0

    def has_docid(self):
        return self.has_docid_

    def page_docid(self):
        return self.page_docid_

    def set_page_docid(self, x):
        self.has_page_docid_ = 1
        self.page_docid_ = x

    def clear_page_docid(self):
        self.has_page_docid_ = 0
        self.page_docid_ = 0

    def has_page_docid(self):
        return self.has_page_docid_

    def is_visible(self):
        return self.is_visible_

    def set_is_visible(self, x):
        self.has_is_visible_ = 1
        self.is_visible_ = x

    def clear_is_visible(self):
        self.has_is_visible_ = 0
        self.is_visible_ = 1

    def has_is_visible(self):
        return self.has_is_visible_

    def shared_path(self):
        return self.shared_path_

    def set_shared_path(self, x):
        self.has_shared_path_ = 1
        self.shared_path_ = x

    def clear_shared_path(self):
        self.has_shared_path_ = 0
        self.shared_path_ = 0

    def has_shared_path(self):
        return self.has_shared_path_

    def url(self):
        return self.url_

    def set_url(self, x):
        self.has_url_ = 1
        self.url_ = x

    def clear_url(self):
        self.has_url_ = 0
        self.url_ = ""

    def has_url(self):
        return self.has_url_

    def MergeFrom(self, x):
        assert x is not self
        if (x.has_docid()): self.set_docid(x.docid())
        if (x.has_page_docid()): self.set_page_docid(x.page_docid())
        if (x.has_is_visible()): self.set_is_visible(x.is_visible())
        if (x.has_shared_path()): self.set_shared_path(x.shared_path())
        if (x.has_url()): self.set_url(x.url())

    def _CMergeFromString(self, s):
        _net_proto___parse__python.MergeFromString(
            self, 'image_mustang.ImageLinkInfo', s)

    def _CEncode(self):
        return _net_proto___parse__python.Encode(
            self, 'image_mustang.ImageLinkInfo')

    def _CToASCII(self, output_format):
        return _net_proto___parse__python.ToASCII(
            self, 'image_mustang.ImageLinkInfo', output_format)

    def ParseASCII(self, s):
        _net_proto___parse__python.ParseASCII(self,
                                              'image_mustang.ImageLinkInfo', s)

    def ParseASCIIIgnoreUnknown(self, s):
        _net_proto___parse__python.ParseASCIIIgnoreUnknown(
            self, 'image_mustang.ImageLinkInfo', s)

    def Equals(self, x):
        if x is self: return 1
        if self.has_docid_ != x.has_docid_: return 0
        if self.has_docid_ and self.docid_ != x.docid_: return 0
        if self.has_page_docid_ != x.has_page_docid_: return 0
        if self.has_page_docid_ and self.page_docid_ != x.page_docid_: return 0
        if self.has_is_visible_ != x.has_is_visible_: return 0
        if self.has_is_visible_ and self.is_visible_ != x.is_visible_: return 0
        if self.has_shared_path_ != x.has_shared_path_: return 0
        if self.has_shared_path_ and self.shared_path_ != x.shared_path_:
            return 0
        if self.has_url_ != x.has_url_: return 0
        if self.has_url_ and self.url_ != x.url_: return 0
        return 1

    def __eq__(self, other):
        return (other
                is not None) and (other.__class__
                                  == self.__class__) and self.Equals(other)

    def __ne__(self, other):
        return not (self == other)

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

    def ByteSize(self):
        n = 0
        n += self.lengthVarInt64(self.docid_)
        if (self.has_page_docid_):
            n += 1 + self.lengthVarInt64(self.page_docid_)
        if (self.has_is_visible_): n += 2
        if (self.has_shared_path_):
            n += 1 + self.lengthVarInt64(self.shared_path_)
        if (self.has_url_): n += 1 + self.lengthString(len(self.url_))
        return n + 1

    def Clear(self):
        self.clear_docid()
        self.clear_page_docid()
        self.clear_is_visible()
        self.clear_shared_path()
        self.clear_url()

    def OutputUnchecked(self, out):
        out.putVarInt32(8)
        out.putVarInt64(self.docid_)
        if (self.has_page_docid_):
            out.putVarInt32(16)
            out.putVarInt64(self.page_docid_)
        if (self.has_is_visible_):
            out.putVarInt32(24)
            out.putBoolean(self.is_visible_)
        if (self.has_shared_path_):
            out.putVarInt32(32)
            out.putVarInt32(self.shared_path_)
        if (self.has_url_):
            out.putVarInt32(42)
            out.putPrefixedString(self.url_)

    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 8:
                self.set_docid(d.getVarInt64())
                continue
            if tt == 16:
                self.set_page_docid(d.getVarInt64())
                continue
            if tt == 24:
                self.set_is_visible(d.getBoolean())
                continue
            if tt == 32:
                self.set_shared_path(d.getVarInt32())
                continue
            if tt == 42:
                self.set_url(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_docid_:
            res += prefix + ("docid: %s\n" %
                             self.DebugFormatInt64(self.docid_))
        if self.has_page_docid_:
            res += prefix + ("page_docid: %s\n" %
                             self.DebugFormatInt64(self.page_docid_))
        if self.has_is_visible_:
            res += prefix + ("is_visible: %s\n" %
                             self.DebugFormatBool(self.is_visible_))
        if self.has_shared_path_:
            res += prefix + ("shared_path: %s\n" %
                             self.DebugFormatInt32(self.shared_path_))
        if self.has_url_:
            res += prefix + ("url: %s\n" % self.DebugFormatString(self.url_))
        return res

    kdocid = 1
    kpage_docid = 2
    kis_visible = 3
    kshared_path = 4
    kurl = 5

    _TEXT = (
        "ErrorCode",  #   0
        "docid",  #   1
        "page_docid",  #   2
        "is_visible",  #   3
        "shared_path",  #   4
        "url",  #   5
    )

    _TYPES = (
        ProtocolBuffer.Encoder.NUMERIC,  #   0
        ProtocolBuffer.Encoder.NUMERIC,  #   1
        ProtocolBuffer.Encoder.NUMERIC,  #   2
        ProtocolBuffer.Encoder.NUMERIC,  #   3
        ProtocolBuffer.Encoder.NUMERIC,  #   4
        ProtocolBuffer.Encoder.STRING,  #   5
    )

    # stylesheet for XML output
    _STYLE = \
     """"""
    _STYLE_CONTENT_TYPE = \
     """"""
    _SERIALIZED_DESCRIPTOR = array.array('B', [
        0x5a,
        0x2c,
        0x69,
        0x6d,
        0x61,
        0x67,
        0x65,
        0x2f,
        0x6d,
        0x75,
        0x73,
        0x74,
        0x61,
        0x6e,
        0x67,
        0x2f,
        0x69,
        0x6e,
        0x64,
        0x65,
        0x78,
        0x65,
        0x72,
        0x2f,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x2f,
        0x69,
        0x6d,
        0x61,
        0x67,
        0x65,
        0x6c,
        0x69,
        0x6e,
        0x6b,
        0x73,
        0x2e,
        0x70,
        0x72,
        0x6f,
        0x74,
        0x6f,
        0x0a,
        0x1b,
        0x69,
        0x6d,
        0x61,
        0x67,
        0x65,
        0x5f,
        0x6d,
        0x75,
        0x73,
        0x74,
        0x61,
        0x6e,
        0x67,
        0x2e,
        0x49,
        0x6d,
        0x61,
        0x67,
        0x65,
        0x4c,
        0x69,
        0x6e,
        0x6b,
        0x49,
        0x6e,
        0x66,
        0x6f,
        0x13,
        0x1a,
        0x05,
        0x64,
        0x6f,
        0x63,
        0x69,
        0x64,
        0x20,
        0x01,
        0x28,
        0x00,
        0x30,
        0x03,
        0x38,
        0x02,
        0x14,
        0x13,
        0x1a,
        0x0a,
        0x70,
        0x61,
        0x67,
        0x65,
        0x5f,
        0x64,
        0x6f,
        0x63,
        0x69,
        0x64,
        0x20,
        0x02,
        0x28,
        0x00,
        0x30,
        0x03,
        0x38,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0a,
        0x69,
        0x73,
        0x5f,
        0x76,
        0x69,
        0x73,
        0x69,
        0x62,
        0x6c,
        0x65,
        0x20,
        0x03,
        0x28,
        0x00,
        0x30,
        0x08,
        0x38,
        0x01,
        0x42,
        0x04,
        0x74,
        0x72,
        0x75,
        0x65,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x04,
        0x74,
        0x72,
        0x75,
        0x65,
        0xa4,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x0b,
        0x73,
        0x68,
        0x61,
        0x72,
        0x65,
        0x64,
        0x5f,
        0x70,
        0x61,
        0x74,
        0x68,
        0x20,
        0x04,
        0x28,
        0x00,
        0x30,
        0x05,
        0x38,
        0x01,
        0x42,
        0x01,
        0x30,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x01,
        0x30,
        0xa4,
        0x01,
        0x14,
        0x13,
        0x1a,
        0x03,
        0x75,
        0x72,
        0x6c,
        0x20,
        0x05,
        0x28,
        0x02,
        0x30,
        0x09,
        0x38,
        0x01,
        0x42,
        0x00,
        0xa3,
        0x01,
        0xaa,
        0x01,
        0x07,
        0x64,
        0x65,
        0x66,
        0x61,
        0x75,
        0x6c,
        0x74,
        0xb2,
        0x01,
        0x02,
        0x22,
        0x22,
        0xa4,
        0x01,
        0x14,
    ])
    _net_proto___parse__python.RegisterType(_SERIALIZED_DESCRIPTOR.tostring())