B
    d                 @   sL   d dl mZ d dl mZ d dl mZ dd ZdddZdd	d
Zdd ZdS )   )encode)number_types)packerc             C   s   t tj| |S )z&Extract the size prefix from a buffer.)r   ZGetr   Zint32)bufoffset r   B/var/www/html/venv/lib/python3.7/site-packages/flatbuffers/util.pyGetSizePrefix   s    r	   Fc             C   s2   |r|t jj7 }|t jj7 }|tj }| || S )z)Extract the file_identifier from a buffer)r   ZUOffsetTFlags	bytewidthr   ZFILE_IDENTIFIER_LENGTH)r   r   size_prefixedendr   r   r   GetBufferIdentifier   s
    
r   c             C   s   t | ||d}||kS )N)r   )r   )r   r   Zfile_identifierr   gotr   r   r   BufferHasIdentifier"   s    r   c             C   s   | |t jj fS )zg
	Create a slice of a size-prefixed buffer that has
	its position advanced just past the size prefix.
	)r   Z
Int32Flagsr
   )r   r   r   r   r   RemoveSizePrefix&   s    r   N)F)F) r   r   r   r	   r   r   r   r   r   r   r   <module>   s   

