%PDF- %PDF-
| Direktori : /usr/lib/python3/dist-packages/PIL/__pycache__/ |
| Current File : //usr/lib/python3/dist-packages/PIL/__pycache__/ContainerIO.cpython-312.pyc |
�
��em � �L � d dl mZ d dlZd dlmZmZmZmZ G d� dee � Zy)� )�annotationsN)�IO�AnyStr�Generic�Literalc �b � e Zd ZdZd
d�Zdd�Zej fdd�Zd
d�Z ddd�Z
dd�Zdd�Zy )�ContainerIOzm
A file object that provides read access to a part of an existing
file (for example a TAR file).
c �r � || _ d| _ || _ || _ | j j |� y)z�
Create file object.
:param file: Existing file.
:param offset: Start of region, in bytes.
:param length: Size of region, in bytes.
r N)�fh�pos�offset�length�seek)�self�filer
r s �1/usr/lib/python3/dist-packages/PIL/ContainerIO.py�__init__zContainerIO.__init__ s0 � � #�����������������V�� c � � y)NF� �r s r �isattyzContainerIO.isatty- s � �r c �< � |dk( r| j |z | _ n!|dk( r| j |z | _ n|| _ t dt | j | j � � | _ | j j | j | j z � y)a
Move file pointer.
:param offset: Offset in bytes.
:param mode: Starting position. Use 0 for beginning of region, 1
for current offset, and 2 for end of region. You cannot move
the pointer outside the defined region.
� � r N)r r �max�minr r r
)r r
�modes r r zContainerIO.seek0 ss � � �1�9��x�x�&�(�D�H�
�Q�Y��{�{�V�+�D�H��D�H��q�#�d�h�h����4�5��������T�[�[�4�8�8�+�,r c � � | j S )ze
Get current file pointer.
:returns: Offset from start of region, in bytes.
)r r s r �tellzContainerIO.tellC s
� � �x�x�r c � � |r$t || j | j z
� }n| j | j z
}|sd| j j v rdS dS | j |z | _ | j j |� S )z�
Read data.
:param n: Number of bytes to read. If omitted or zero,
read until end of region.
:returns: An 8-bit string.
�br � )r r r r r �read)r �ns r r$ zContainerIO.readK sp � �
��A�t�{�{�T�X�X�-�.�A����d�h�h�&�A��������-�3�5�2�5��8�8�a�<����w�w�|�|�A��r c � � d| j j v rdnd}d| j j v rdnd} | j d� }|s |S ||z }||k( r |S �$)zJ
Read a line of text.
:returns: An 8-bit string.
r"