
     i{                     *    d dl Z d dlZd dlZd Zd ZdS )    Nc                    t          j        t          j        j        j        d         | dd                   d         }t          j        t          j        j        j        d         | dd                   d         }t          j        t          j        j        j        d         | dd                   d         }|||| dd         fS )zParse the header and return it along with the input array minus the header.
    :param input_array the array to parse
    :return the codec, the length of the decoded array, the parameter and the remainder
    of the array   r         N)structunpackmmtfutils	constantsNUM_DICTinput_arraycodeclengthparams       `/srv/www/vhosts/g4struct/public_html/venv/lib/python3.11/site-packages/mmtf/utils/codec_utils.pyparse_headerr      s    
 M$*.7:K!<LMMaPE]4:/8;[1=MNNqQFM$*.7:K"<MNNqQEk"##...    c                 &   t          j        t          j        j        j        d         |          t          j        t          j        j        j        d         |          z   t          j        t          j        j        j        d         |          z   | z   S )a   Add the header to the appropriate array.
    :param the encoded array to add the header to
    :param the codec being used
    :param the length of the decoded array
    :param the parameter to add to the header
    :return the prepended encoded byte arrayr   )r   packr	   r
   r   r   r   s       r   
add_headerr      ss     ;tz+4Q7??;tz+4Q7@@A;tz+4Q7??@BMN Nr   )r   r	   mmtf.utils.constantsr   r    r   r   <module>r      sP         / / /	N 	N 	N 	N 	Nr   