CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
GimpPaletteFile.cpython-310.pyc16 linesDownload Raw Back to __pycache__
1o

2��Yi��@sFddlmZddlZddlmZdZerddlmZGdd�d�ZdS)�)�annotationsN)�BytesIOF)�IOc@sBeZdZdZdZddd3d�Zddd
�Zeddd��Zddd�Z	dS)�GimpPaletteFilez'File handler for GIMP's palette format.�RGBT�fp�	IO[bytes]�limit�bool�return�Nonecs�|���d�s
d}t|��g}d}	|r|dkrnI|d7}|��}|s$n>t�d|�r+q|r9t|�dkr9d	}t|��|jd4d��t��d5krKd}t|��|�fd
d�td6�D�7}|rat|�dkranqt	|�|_7dS)NsGIMP Paletteznot a GIMP palette filerTi�s\w+:|#�dzbad palette file�)�maxsplitzbad palette entryc3s�|]	}t�|�VqdS�N)�int)�.0�i��v��}E:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\PIL/GimpPaletteFile.py�	<genexpr>;s�z(GimpPaletteFile._read.<locals>.<genexpr>i)�readline�8startswith�SyntaxError�re�match�len�split�9ValueError�range�bytes�palette)�selfrr	�msgr$r�srrr�_reads4�zGimpPaletteFile._readcCs|�|�dSr)r()r%rrrr�__init__AszGimpPaletteFile.__init__�datar#cCs|�|�}|�t|�d�|S)NF)�__new__r(r)�clsr*r%rrr�	frombytesDs10zGimpPaletteFile.frombytes�tuple[bytes, str]cCs|j|jfSr)r$�rawmode)r%rrr�11getpaletteJszGimpPaletteFile.getpaletteN)T)rrr	r12rr)rrrr)r*r#rr)rr.)13�__name__�14__module__�__qualname__�__doc__r/r(r)�classmethodr-r0rrrrrs15"r)	�16__future__rr�ior�
TYPE_CHECKING�typingrrrrrr�<module>s
Aluode/PerceptionLabPortable · CoolFace