o
    Rh                     @   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   Getr   int32bufoffset r
   R/home/air/sanwanet/backup_V2/venv/lib/python3.10/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   UOffsetTFlags	bytewidthr   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	   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   
Int32Flagsr   r   r
   r
   r   RemoveSizePrefix&   s   r   N)F) r   r   r   r   r   r   r   r
   r
   r
   r   <module>   s   

