
    (ph                    D    S SK Jr  S SKrS SKJr  SSKJr   " S S5      rg)    )annotationsN)IO   )o8c                  0    \ rS rSrSrSrSS jrS	S jrSrg)
GimpPaletteFile   z'File handler for GIMP's palette format.RGBc           	        [        S5       Vs/ s H  n[        U5      S-  PM     nnUR                  5       S S S:w  a  Sn[        U5      e[        S5       H  nUR                  5       nU(       d    O[        R
                  " SU5      (       a  M:  [        U5      S:  a  Sn[        U5      e[        [        [        UR                  5       S S 5      5      n[        U5      S:w  a  S	n[        U5      e[        US
   5      [        US   5      -   [        US   5      -   X2'   M     SR                  U5      U l        g s  snf )N         s   GIMP Paletteznot a GIMP palette files   \w+:|#d   zbad palette filezbad palette entryr   r          )ranger   readlineSyntaxErrorrematchlentuplemapintsplit
ValueErrorjoinpalette)selffpir   msgsvs          F/var/www/html/venv/lib/python3.13/site-packages/PIL/GimpPaletteFile.py__init__GimpPaletteFile.__init__   s   &+Cj1j2a519j1;;="0+Cc""sAA xx
A&&1v|(!#&&c#qwwy!}-.A1v{) o%AaDBqtH,r!A$x7GJ# & xx(3 2s   D<c                2    U R                   U R                  4$ )N)r   rawmode)r   s    r%   
getpaletteGimpPaletteFile.getpalette9   s    ||T\\))r   )r   N)r    z	IO[bytes]returnNone)r,   ztuple[bytes, str])	__name__
__module____qualname____firstlineno____doc__r)   r&   r*   __static_attributes__ r   r%   r   r      s    1G)8*r   r   )
__future__r   r   typingr   _binaryr   r   r4   r   r%   <module>r8      s     # 	  "* "*r   