관리-도구
편집 파일: file.cpython-311.pyc
� P�Dgi � �j � d Z ddlZddlmZ ddlmZ n# e$ r ddlmZ Y nw xY w G d� d� � ZdS )z<For internal use only. It provides a slice-like file reader.� N)�Union)�Lockc � � e Zd ZdZdeddfd�Zdeeef fd�Z de d edefd �Zdefd�Zdd�Z eed � � rdedede fd�ZdS dedede fd�ZdS )� FileBufferzA slice-able file reader�database�returnNc �� � t |d� � | _ t j | j � � � � � j | _ t t d� � st � � | _ d S d S )N�rb�pread) �open�_handle�os�fstat�fileno�st_size�_size�hasattrr �_lock)�selfr s �n/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib/python3.11/site-packages/maxminddb/file.py�__init__zFileBuffer.__init__ s` � ��H�d�+�+����X�d�l�1�1�3�3�4�4�<�� ��r�7�#�#� ����D�J�J�J� � � �keyc � � t |t � � r(| � |j |j z |j � � S t |t � � r| � d|� � d S t d� � �)N� r zInvalid argument type.)� isinstance�slice�_read�stop�start�int� TypeError)r r s r �__getitem__zFileBuffer.__getitem__ sm � ��c�5�!�!� ?��:�:�c�h���2�C�I�>�>�>��c�3��� )��:�:�a��%�%�a�(�(��0�1�1�1r �needler c � � | � | j |z dz |� � � |� � }|dk r|S ||z S )zReverse find needle from startr ���)r r �rfind)r r$ r �poss r r'