a
    .PÎj…  ã                   @   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   ú`/mounts/lovelace/software/anaconda3/envs/metadmg/lib/python3.9/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	   ÚRemoveSizePrefix&   s    r   N)F)F)Ú r   r   r   r
   r   r   r   r   r   r   r	   Ú<module>   s   

