o
    'j6hÀ  ã                   @  s6   d dl mZ d dlmZ ddlmZ G dd„ dƒZdS )é    )Úannotations)ÚIOé   ©Úo8c                   @  s(   e Zd ZdZdZddd„Zdd
d„ZdS )ÚPaletteFilez-File handler for Teragon-style palette files.ÚRGBÚfpú	IO[bytes]ÚreturnÚNonec           
      C  sÒ   dd„ t dƒD ƒ}	 | ¡ }|snP| d¡rq	t|ƒdkr#d}t|ƒ‚dd„ | ¡ D ƒ}z|\}}}}	W n tyE   |\}}| }}	Y nw d	|  krPd
kr`n nt|ƒt|ƒ t|	ƒ ||< q
d |¡| _	d S )Nc                 S  s   g | ]}t |ƒd  ‘qS )é   r   )Ú.0Úi© r   ú^/var/www/html/chefvision.cloud.itp360.com/venv/lib/python3.10/site-packages/PIL/PaletteFile.pyÚ
<listcomp>   s    z(PaletteFile.__init__.<locals>.<listcomp>é   Tó   #éd   zbad palette filec                 S  s   g | ]}t |ƒ‘qS r   )Úint)r   Úxr   r   r   r   )   s    r   éÿ   ó    )
ÚrangeÚreadlineÚ
startswithÚlenÚSyntaxErrorÚsplitÚ
ValueErrorr   ÚjoinÚpalette)
Úselfr	   r"   ÚsÚmsgÚvr   ÚrÚgÚbr   r   r   Ú__init__   s*   
þízPaletteFile.__init__útuple[bytes, str]c                 C  s   | j | jfS )N)r"   Úrawmode)r#   r   r   r   Ú
getpalette5   s   zPaletteFile.getpaletteN)r	   r
   r   r   )r   r+   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r,   r*   r-   r   r   r   r   r      s
    
r   N)Ú
__future__r   Útypingr   Ú_binaryr   r   r   r   r   r   Ú<module>   s   