3 SÉLjü ã@s¨dZdZddlZddlmZddlmZdZde>dZdZdZ dZ dZ d Z d Z d ZedMƒZedOƒZdQZdSZdUZdWZdZdZdZdZejeƒd kršedƒ‚ejeƒdkr°edƒ‚dd„Zdd„Zdd„Zdd„Zdd„Z d d!„Z!d"d#„Z"d$d%„Z#d&d'„Z$d(d)„Z%d*d+„Z&d,d-„Z'd.d/„Z(d0d1„Z)d2d3„Z*d4d5„Z+d6d7„Z,d8d9„Z-d:d;„Z.dd?„Z0d@dA„Z1dBdC„Z2dDdE„Z3dFdG„Z4dHdI„Z5ej6j7ej6j8ej6j9ej6j:fZ;dJdK„Z|BS)aReturns an unsigned 32-bit integer that encodes the field number and wire type information in standard protocol message wire format. Args: field_number: Expected to be an integer in the range [1, 1 << 29) wire_type: One of the WIRETYPE_* constants. rzUnknown wire type: %d)Ú _WIRETYPE_MAXrÚ EncodeErrorÚ TAG_TYPE_BITS)Ú field_numberZ wire_type©rú!/usr/lib/python3.6/wire_format.pyÚPackTagPsrcCs|t?|t@fS)zkThe inverse of PackTag(). Given an unsigned 32-bit number, returns a (field_number, wire_type) tuple. )rÚ TAG_TYPE_MASK)ÚtagrrrÚ UnpackTag]srcCs|dkr|d>S|d>dAS)z‘ZigZag Transform: Encodes signed integers so that they can be effectively used with varint encoding. See wire_format.h for more details. rréÿÿÿÿr)ÚvaluerrrÚ ZigZagEncodedsrcCs|d@s|d?S|d?dAS)zInverse of ZigZagEncode().rrrr)rrrrÚ ZigZagDecodensrcCs t||ƒS)N)Ú Int64ByteSize)rÚint32rrrÚ Int32ByteSizezsrcCs td|@ƒS)Nlÿÿÿÿ)Ú_VarUInt64ByteSizeNoTag)rrrrÚInt32ByteSizeNoTag~sr cCst|d|@ƒS)Nlÿÿÿÿ)ÚUInt64ByteSize)rÚint64rrrr‚srcCs t||ƒS)N)r!)rZuint32rrrÚUInt32ByteSize‡sr#cCst|ƒt|ƒS)N)Ú TagByteSizer)rÚuint64rrrr!‹sr!cCst|t|ƒƒS)N)r#r)rrrrrÚSInt32ByteSize�sr&cCst|t|ƒƒS)N)r!r)rr"rrrÚSInt64ByteSize“sr'cCs t|ƒdS)Nr)r$)rZfixed32rrrÚFixed32ByteSize—sr(cCs t|ƒdS)Nr )r$)rZfixed64rrrÚFixed64ByteSize›sr)cCs t|ƒdS)Nr)r$)rZsfixed32rrrÚSFixed32ByteSizeŸsr*cCs t|ƒdS)Nr )r$)rZsfixed64rrrÚSFixed64ByteSize£sr+cCs t|ƒdS)Nr)r$)rZfltrrrÚ FloatByteSize§sr,cCs t|ƒdS)Nr )r$)rZdoublerrrÚDoubleByteSize«sr-cCs t|ƒdS)Nr)r$)rÚbrrrÚ BoolByteSize¯sr/cCs t||ƒS)N)r#)rÚenumrrrÚ EnumByteSize³sr1cCst||jdƒƒS)Nzutf-8)Ú BytesByteSizeÚencode)rÚstringrrrÚStringByteSize·sr5cCst|ƒtt|ƒƒt|ƒS)N)r$rÚlen)rr.rrrr2»sr2cCsdt|ƒ|jƒS)Nr)r$ÚByteSize)rrrrrÚ GroupByteSizeÁs r8cCst|ƒt|jƒƒ|jƒS)N)r$rr7)rrrrrÚMessageByteSizeÆsr9cCsHdtdƒtdƒtdƒ}|t|ƒ7}|jƒ}|t|ƒ7}||7}|S)Nrrr)r$rr7)rÚmsgZ total_sizeZ message_sizerrrÚMessageSetItemByteSizeÌs   r;cCstt|dƒƒS)zEReturns the bytes required to serialize a tag with this field number.r)rr)rrrrr$àsr$cCs†|dkr dS|dkrdS|dkr$dS|dkr0dS|d krst