
    &ThC                          d dl Z  G d d      Zy)    Nc                   T    e Zd ZdZd Zd Zej                  fdZd Z	d
dZ
d Zd Zy	)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       W/home/stella.sw7ft.com/public_html/venv/lib/python3.12/site-packages/PIL/ContainerIO.py__init__zContainerIO.__init__   s0     V    c                      y)NF r   s    r   isattyzContainerIO.isatty,   s    r   c                 <   |dk(  r| j                   |z   | _         n!|dk(  r| j                  |z   | _         n|| _         t        dt        | 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
   zContainerIO.seek/   ss     19xx&(DHQY{{V+DHDHq#dhh45T[[488+,r   c                     | j                   S )ze
        Get current file pointer.

        :returns: Offset from start of region, in bytes.
        )r   r   s    r   tellzContainerIO.tellB   s     xxr   c                    |r$t        || j                  | j                  z
        }n| j                  | j                  z
  }|sd| j                  j                  v rdS dS | 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   zContainerIO.readJ   sp     At{{TXX-.Adhh&A-352588a<ww||Ar   c                     d| j                   j                  v rdnd}d| j                   j                  v rdnd}	 | j                  d      }|s	 |S ||z   }||k(  r	 |S $)zJ
        Read a line of text.

        :returns: An 8-bit string.
        r   r   r      

r   )r   r   r   )r   snewline_charactercs       r   readlinezContainerIO.readline[   so     $'',,&CB%(DGGLL%8Ed		!A  AA%% r   c                 V    g }	 | j                         }|s	 |S |j                  |       ')zZ
        Read multiple lines of text.

        :returns: A list of 8-bit strings.
        )r'   append)r   linesr$   s      r   	readlineszContainerIO.readlinesl   s4     A LLO	 r   N)r   )__name__
__module____qualname____doc__r   r   ioSEEK_SETr
   r   r   r'   r+   r   r   r   r   r      s3    
" !# -&""r   r   )r0   r   r   r   r   <module>r2      s   $ 
c cr   