Пример #1
0
 def TryMerge(self, d):
   while 1:
     tt = d.getVarInt32()
     if tt == 44: break
     if tt == 48:
       self.set_clusterdocid(d.getVarUint64())
       continue
     if tt == 56:
       self.set_latitude_e6(d.getVarInt32())
       continue
     if tt == 64:
       self.set_longitude_e6(d.getVarInt32())
       continue
     if tt == 74:
       self.set_title(d.getPrefixedString())
       continue
     if tt == 82:
       length = d.getVarInt32()
       tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       d.skip(length)
       self.mutable_postal_address().TryMerge(tmp)
       continue
     if tt == 90:
       length = d.getVarInt32()
       tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       d.skip(length)
       self.mutable_phone_number().TryMerge(tmp)
       continue
     if tt == 101:
       self.set_confidence(d.getFloat())
       continue
     if tt == 106:
       self.set_clusterid(d.getPrefixedString())
       continue
     if tt == 114:
       self.add_source(d.getPrefixedString())
       continue
     if tt == 120:
       self.set_show_in_snippets(d.getBoolean())
       continue
     if tt == 128:
       self.set_include_in_index(d.getBoolean())
       continue
     # tag 0 is special: it's used to indicate an error.
     # so if we see it we raise an exception.
     if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
     d.skipData(tt)
Пример #2
0
 def TryMerge(self, d):
   while 1:
     tt = d.getVarInt32()
     if tt == 28: break
     if tt == 32:
       self.set_timestamp(d.getVarInt64())
       continue
     if tt == 40:
       self.set_pagesize(d.getVarInt64())
       continue
     if tt == 48:
       self.set_timetofetch(d.getVarInt64())
       continue
     if tt == 56:
       self.set_contentchecksum(d.getVarInt64())
       continue
     if tt == 64:
       self.set_linkchecksum(d.getVarInt64())
       continue
     if tt == 72:
       self.set_newlinks(d.getVarInt64())
       continue
     if tt == 80:
       self.set_deprecated_pagerank(d.getVarInt64())
       continue
     if tt == 88:
       self.set_deprecated_sourcetag(d.getVarInt64())
       continue
     if tt == 96:
       self.set_lastmodified(d.getVarInt64())
       continue
     if tt == 104:
       self.set_docid(d.getVarInt64())
       continue
     if tt == 112:
       self.set_deprecated_segment(d.getVarInt64())
       continue
     if tt == 120:
       self.set_deprecated_fetchtype(d.getVarInt64())
       continue
     if tt == 256:
       self.set_documentarchived(d.getBoolean())
       continue
     if tt == 274:
       length = d.getVarInt32()
       tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       d.skip(length)
       self.mutable_urlcrawlstatus().TryMerge(tmp)
       continue
     if tt == 283:
       self.mutable_contentdups().TryMerge(d)
       continue
     if tt == 297:
       self.set_canonicalfp(d.get64())
       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)
Пример #3
0
 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)
Пример #4
0
 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_attachments().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)
Пример #5
0
 def TryMerge(self, d):
   while 1:
     tt = d.getVarInt32()
     if tt == 52: break
     if tt == 58:
       length = d.getVarInt32()
       tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       d.skip(length)
       self.add_urls().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)
Пример #6
0
 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)
Пример #7
0
 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.add_image_link_info().TryMerge(tmp)
             continue
         if tt == 16:
             self.set_is_no_index(d.getBoolean())
             continue
         # tag 0 is special: it's used to indicate an error.
         # so if we see it we raise an exception.
         if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
         d.skipData(tt)
Пример #8
0
 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.add_attribute().TryMerge(tmp)
       continue
     if tt == 16:
       self.set_expiration_time(d.getVarInt32())
       continue
     if tt == 26:
       self.set_image_cache_key(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 SendDocCommand(self, command, server, url, response):
     """
 This method differs from
 google.io.ProtocolBuffer.ProtocolMessage.sendCommand in two ways. First,
 the mixer returns an HTTP/1.0 response which httplib thinks will close but
 it doesn't. Second, it skips over the first four bytes of the response.
 These bytes represent a length value and are not part of the protocol
 buffer.
 """
     data = command.Encode()
     conn = httplib.HTTPConnection(server)
     conn.putrequest('POST', url)
     conn.putheader('Content-Length', '%d' % len(data))
     conn.endheaders()
     conn.send(data)
     resp = conn.getresponse()
     if resp.status != 200:
         raise ProtocolBuffer.ProtocolBufferReturnError(resp.status)
     resp.will_close = False
     resp.read(4)
     response.ParseFromString(resp.read())
     return response
Пример #10
0
 def TryMerge(self, d):
   while 1:
     tt = d.getVarInt32()
     if tt == 12: break
     if tt == 17:
       self.set_clusterdocid(d.get64())
       continue
     if tt == 24:
       self.set_content_id(d.getVarInt32())
       continue
     if tt == 32:
       self.set_language(d.getVarInt32())
       continue
     if tt == 43:
       self.add_context().TryMerge(d)
       continue
     if tt == 67:
       self.add_highlight().TryMerge(d)
       continue
     if tt == 98:
       length = d.getVarInt32()
       tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       d.skip(length)
       self.mutable_attributes().TryMerge(tmp)
       continue
     if tt == 144:
       self.set_scraped(d.getBoolean())
       continue
     if tt == 152:
       self.set_inferred(d.getBoolean())
       continue
     if tt == 161:
       self.set_authority(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)