o ö]Lbšã@sfddlmZmZmZddlZzddlmZWney%ddlmZYnwdZ dd„Z d d d „Z dS) é)Úabsolute_importÚdivisionÚprint_functionNé)Úbser)ÚpybserscCs\d}t|ƒ}|dkr,| tj| ||¡¡}|dus|dkr |S||7}||8}|dks |S)zÁRead 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 rN)ÚlenÚreadintoÚctypesÚc_charÚ from_buffer)ÚfpÚbufÚoffsetÚ remainingÚl©rúA/usr/lib/python3/dist-packages/hgext/fsmonitor/pywatchman/load.pyÚ _read_bytes,s ûrTc Cs¸t d¡}ttƒ}tj| |¡}t||ƒ}|t|ƒkrdSt |¡}|t|ƒkr/t  ||¡tj|t|ƒ |t|ƒ¡} t|| ƒ}|t| ƒkrMt dƒ‚t  tj| |d¡|||¡S)atDeserialize 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 Nzbser data ended earlyr) r Úcreate_string_bufferrÚ EMPTY_HEADERr r rrÚpdu_lenÚresizeÚ RuntimeErrorÚloads) r ÚmutableÚvalue_encodingÚ value_errorsrÚSNIFF_BUFFER_SIZEÚheaderÚread_lenÚ total_lenÚbodyrrrÚloadDs*      ÿ  ür#)TNN) Ú __future__rrrr ÚrÚ ImportErrorrrrr#rrrrÚs ÿ