
    6hf                    ^    S SK Jr  S SKr SSKJr  SrS rS	S jr	g! \ a	    SSKJr   Nf = f)
    )annotationsN   )bser)pybsers        c                    Sn[        U5      nUS:  aL  U R                  [        R                  U-  R	                  X5      5      nUb  US:X  a  U$ X$-  nX4-  nUS:  a  ML  U$ )zRead bytes from a file-like object

@param fp: File-like object that implements read(int)
@type fp: file

@param buf: Buffer to read into
@type buf: bytes

@return: buf
r   )lenreadintoctypesc_charfrom_buffer)fpbufoffset	remainingls        A/usr/lib/python3/dist-packages/hgext/fsmonitor/pywatchman/load.py_read_bytesr   +   si     FCI
a-KK2??LM9QM	 a- M    c                j   [         R                  " S5      n[        [        5      n[         R                  U-  R                  U5      n[        X5      nU[        U5      :  a  g[        R                  " U5      nU[        U5      :  a  [         R                  " XH5        [         R                  U[        U5      -
  -  R                  U[        U5      5      n	[        X	5      nU[        U	5      :  a  [        S5      e[        R                  " [         R                  U-  R                  US5      UUU5      $ )aD  Deserialize a BSER-encoded blob.

@param fp: The file-object to deserialize.
@type file:

@param mutable: Whether to return mutable results.
@type mutable: bool

@param value_encoding: Optional codec to use to decode values. If
                       unspecified or None, return values as bytestrings.
@type value_encoding: str

@param value_errors: Optional error handler for codec. 'strict' by default.
                     The other most common argument is 'surrogateescape' on
                     Python 3. If value_encoding is None, this is ignored.
@type value_errors: str
i    Nzbser data ended earlyr   )r
   create_string_bufferr   EMPTY_HEADERr   r   r   r   pdu_lenresizeRuntimeErrorloads)
r   mutablevalue_encodingvalue_errorsr   SNIFF_BUFFER_SIZEheaderread_len	total_lenbodys
             r   loadr$   C   s    $ 
%
%d
+CL)mm//<<SAF2&H#f+S!I3s8c%MMYV45BBS[D 2$H#d)233::		"//Q7	 r   )TNN)

__future__r   r
    r   ImportErrorr   r   r   r$    r   r   <module>r)      s:   : # !
 /0)?  ! !s    ,,