class_docstr: Compact implementation of the Thrift protocol driver.
class_docstr_tok: ["Compact","implementation","of","the","Thrift","protocol","driver","."]
code: def writeMessageBegin(self, name, type, seqid):
      assert self.state == CLEAR
      self.__writeUByte(self.PROTOCOL_ID)
      self.__writeUByte(self.VERSION | (type << self.TYPE_SHIFT_AMOUNT))
      # The sequence id is a signed 32-bit integer but the compact protocol
      # writes this out as a "var int" which is always positive, and attempting
      # to write a negative number results in an infinite loop, so we may
      # need to do some conversion here...
      tseqid = seqid
      if tseqid < 0:
          tseqid = 2147483648 + (2147483648 + tseqid)
      self.__writeVarint(tseqid)
      self.__writeBinary(str_to_binary(name))
      self.state = VALUE_WRITE
  
imports: from .TProtocol import TType, TProtocolBase, TProtocolException, TProtocolFactory, checkIntegerLimits
  from struct import pack, unpack
  from ..compat import binary_to_str, str_to_binary
label_desc: Use image node_id 5 for calling the TCompactProtocol obj's underlying member method code with example usage: obj.writeMessageBegin(name, type, seqid) without return types