
    Bwg                    D    d dl mZ d dlZd dlmZ ddlmZ  G d d      Zy)    )annotationsN)IO   )o8c                  $    e Zd ZdZdZddZddZy)GimpPaletteFilez'File handler for GIMP's palette format.RGBc           	     \   t        d      D cg c]  }t        |      dz   }}|j                         d d dk7  rd}t        |      t        d      D ]  }|j                         }|s nt	        j
                  d|      r.t        |      dkD  rd}t        |      t        t        t        |j                         d d             }t        |      dk7  rd	}t        |      t        |d
         t        |d         z   t        |d         z   ||<    dj                  |      | _        y c c}w )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          J/var/www/horilla/myenv/lib/python3.12/site-packages/PIL/GimpPaletteFile.py__init__zGimpPaletteFile.__init__   s   &+Cj12a51911;;="0+Cc""s 	8AA xx
A&1v|(!#&&c#qwwy!}-.A1v{) o%AaDBqtH,r!A$x7GAJ#	8& xx(3 2s   D)c                2    | j                   | j                  fS )N)r   rawmode)r   s    r$   
getpalettezGimpPaletteFile.getpalette9   s    ||T\\))r   N)r   z	IO[bytes]returnNone)r)   ztuple[bytes, str])__name__
__module____qualname____doc__r'   r%   r(    r   r$   r   r      s    1G)8*r   r   )
__future__r   r   typingr   _binaryr   r   r/   r   r$   <module>r3      s     # 	  "* "*r   