def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 32:
                self.set_kind(d.getVarInt32())
                continue
            if tt == 42:
                self.set_kind_uri(d.getPrefixedString())
                continue
            if tt == 106:
                length = d.getVarInt32()
                tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
                d.skip(length)
                self.mutable_key().TryMerge(tmp)
                continue
            if tt == 114:
                length = d.getVarInt32()
                tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
                d.skip(length)
                self.add_property().TryMerge(tmp)
                continue
            if tt == 122:
                length = d.getVarInt32()
                tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
                d.skip(length)
                self.add_property().TryMerge(tmp)
                continue

            if tt == 0:
                raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)
    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 8:
                self.set_meaning(d.getVarInt32())
                continue
            if tt == 18:
                self.set_meaning_uri(d.getPrefixedString())
                continue
            if tt == 26:
                self.set_name(d.getPrefixedString())
                continue
            if tt == 32:
                self.set_multiple(d.getBoolean())
                continue
            if tt == 42:
                length = d.getVarInt32()
                tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
                d.skip(length)
                self.mutable_value().TryMerge(tmp)
                continue
            if tt == 48:
                self.set_stashed(d.getVarInt32())
                continue
            if tt == 56:
                self.set_computed(d.getBoolean())
                continue

            if tt == 0:
                raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)
示例#3
0
def _get_decoder(s):
    a = array.array("B")
    try:
        a.frombytes(s)
    except AttributeError:  # pragma: NO PY3 COVER
        a.fromstring(s)
    d = pb_module.Decoder(a, 0, len(a))
    return d
    def TryMerge(self, d):
        while d.avail() > 0:
            tt = d.getVarInt32()
            if tt == 106:
                self.set_app(d.getPrefixedString())
                continue
            if tt == 114:
                length = d.getVarInt32()
                tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
                d.skip(length)
                self.mutable_path().TryMerge(tmp)
                continue
            if tt == 162:
                self.set_name_space(d.getPrefixedString())
                continue
            if tt == 186:
                self.set_database_id(d.getPrefixedString())
                continue

            if tt == 0:
                raise ProtocolBuffer.ProtocolBufferDecodeError
            d.skipData(tt)
def _get_decoder(s):
    a = array.array("B")
    a.fromstring(s)
    d = pb_module.Decoder(a, 0, len(a))
    return d