ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/site-packages/maxminddb/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/site-packages/maxminddb/__pycache__/file.cpython-38.pyc

U

 ��^��@sRdZddlZzddlmZWn ek
r<ddlmZYnXGdd�de�ZdS)z<For internal use only. It provides a slice-like file reader.�N)�Lockc@sTeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Ze	e
d�rHd
d�Zndd�ZdS)�
FileBufferzA slice-able file readercCs6t|d�|_t�|j���j|_ttd�s2t�|_	dS)N�rb�pread)
�open�_handle�os�fstat�fileno�st_size�_size�hasattrr�_lock)�selfZdatabase�r�/file.py�__init__s
zFileBuffer.__init__cCsFt|t�r |�|j|j|j�St|t�r:|�d|�dStd��dS)N�rzInvalid argument type.)�
isinstance�slice�_read�stop�start�int�	TypeError)r�keyrrr�__getitem__s


zFileBuffer.__getitem__cCs0|�|j|d|��|�}|dkr(|S||S)zReverse find needle from startr���)rr�rfind)rZneedler�posrrrrszFileBuffer.rfindcCs|jS)zSize of file)r�rrrr�size#szFileBuffer.sizecCs|j��dS)z
Close fileN)r�closer rrrr"'szFileBuffer.closercCst�|j��||�S)zread that uses pread)rrrr
�rZ
buffersize�offsetrrrr-szFileBuffer._readc
Cs6|j�&|j�|�|j�|�W5QR�SQRXdS)a�read with a lock

            This lock is necessary as after a fork, the different processes
            will share the same file table entry, even if we dup the fd, and
            as such the same offsets. There does not appear to be a way to
            duplicate the file table entry and we cannot re-open based on the
            original path as that file may have replaced with another or
            unlinked.
            N)rr�seek�readr#rrrr4s
N)�__name__�
__module__�__qualname__�__doc__rrrr!r"r
rrrrrrrs

r)r*rZmultiprocessingr�ImportErrorZ	threading�objectrrrrr�<module>s

Zerion Mini Shell 1.0