
     fm                    Z    d dl mZ d dlZd dlmZmZmZmZ  G d dee                   ZdS )    )annotationsN)IOAnyStrGenericLiteralc                  Z    e Zd ZdZdd	ZddZej        fddZddZ	dddZ
ddZddZdS ) ContainerIOzm
    A file object that provides read access to a part of an existing
    file (for example a TAR file).
    file
IO[AnyStr]offsetintlengthreturnNonec                r    || _         d| _        || _        || _        | j                             |           dS )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posr   r   seek)selfr
   r   r   s       R/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/PIL/ContainerIO.py__init__zContainerIO.__init__   s:     #V    boolc                    dS )NF r   s    r   isattyzContainerIO.isatty-   s    ur   modeLiteral[0, 1, 2]c                   |dk    r| j         |z   | _         n|dk    r| j        |z   | _         n|| _         t          dt          | j         | j                            | _         | j                            | j        | j         z              dS )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   r   s      r   r   zContainerIO.seek0   s     199x&(DHHQYY{V+DHHDHq#dh4455T[48+,,,,,r   c                    | j         S )ze
        Get current file pointer.

        :returns: Offset from start of region, in bytes.
        )r   r   s    r   tellzContainerIO.tellC   s     xr   r   nr   c                    |rt          || j        | j        z
            }n| j        | j        z
  }|sd| j        j        v rdndS | j        |z   | _        | 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   r'   s     r   r+   zContainerIO.readK   ss      	'At{TX-..AAdh&A 	6--33258a<w||Ar   c                    d| j         j        v rdnd}d| j         j        v rdnd}	 |                     d          }|sn||z   }||k    rn%|S )zJ
        Read a line of text.

        :returns: An 8-bit string.
        r)   r   r*      

Tr!   )r   r   r+   )r   snewline_charactercs       r   readlinezContainerIO.readline\   sv     $',..CCB%(DGL%8%8EEd			!A AA%%%	 r   list[AnyStr]c                f    g }	 |                                  }|sn|                    |           -|S )zZ
        Read multiple lines of text.

        :returns: A list of 8-bit strings.
        )r2   append)r   linesr/   s      r   	readlineszContainerIO.readlinesm   sA     	A LLOOO		
 r   N)r
   r   r   r   r   r   r   r   )r   r   )r   r   r   r   r   r   )r   r   )r   )r'   r   r   r   )r   r   )r   r3   )__name__
__module____qualname____doc__r   r   ioSEEK_SETr   r&   r+   r2   r7   r   r   r   r	   r	      s         
   "    :< - - - - -&       "   "     r   r	   )	
__future__r   r<   typingr   r   r   r   r	   r   r   r   <module>r@      s     # " " " " " 				 / / / / / / / / / / / /c c c c c'&/ c c c c cr   