Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/hgext/fsmonitor/pywatchman/__pycache__/ |
Upload File : |
o �]Lb� � @ sf d dl mZmZmZ d dlZzddlmZ W n ey% ddlmZ Y nw dZ dd� Z dd d�ZdS ) � )�absolute_import�division�print_functionN� )�bser)�pybsers c C s\ d}t |�}|dkr,| �tj| �||��}|du s|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 r N)�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 �r Tc C s� t �d�}tt�}t j| �|�}t| |�}|t|�k rdS t�|�}|t|�kr/t � ||� t j|t|� �|t|��} t| | �}|t| �k rMt d��t�t j| �|d�|||�S )at 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 Nzbser 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�bodyr r r �loadD s* � �r# )TNN)� __future__r r r r � r �ImportErrorr r r r# r r r r �<module> s �