
    h                    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)BytesIO)IOc                  R    \ rS rSrSrSrS
SS jjrSS jr\SS j5       r	SS jr
Srg	)GimpPaletteFile   z'File handler for GIMP's palette format.RGBc                "  ^ UR                  5       R                  S5      (       d  Sn[        U5      e/ nSn U(       a  US:X  a  OUS-  nUR                  5       nU(       d  O[        R                  " SU5      (       a  MJ  U(       a  [        U5      S:  a  Sn[        U5      eUR                  S	S
9m[        T5      S	:  a  Sn[        U5      eUU4S j[        S	5       5       -  nU(       a  [        U5      S:X  a  OM  [        U5      U l
        g )Ns   GIMP Paletteznot a GIMP palette filer   i     s   \w+:|#d   zbad palette file   )maxsplitzbad palette entryc              3  @   >#    U  H  n[        TU   5      v   M     g 7fN)int).0ivs     E/var/www/html/env/lib/python3.13/site-packages/PIL/GimpPaletteFile.py	<genexpr>(GimpPaletteFile._read.<locals>.<genexpr>8   s     48aAaD		8s   i   )readline
startswithSyntaxErrorrematchlensplit
ValueErrorrangebytespalette)selffplimitmsgr"   r   sr   s          @r   _readGimpPaletteFile._read   s    {{}''88+Cc""gFAA xx
A&&Q#(!#&&#A1vz) o%45844GW,/ 2 W~    c                &    U R                  U5        g r   )r(   )r#   r$   s     r   __init__GimpPaletteFile.__init__>   s    

2r*   c                ^    U R                  U 5      nUR                  [        U5      S5        U$ )NF)__new__r(   r   )clsdatar#   s      r   	frombytesGimpPaletteFile.frombytesA   s'    {{3

74=%(r*   c                2    U R                   U R                  4$ r   )r"   rawmode)r#   s    r   
getpaletteGimpPaletteFile.getpaletteG   s    ||T\\))r*   )r"   N)T)r$   	IO[bytes]r%   boolreturnNone)r$   r8   r:   r;   )r1   r!   r:   r   )r:   ztuple[bytes, str])__name__
__module____qualname____firstlineno____doc__r5   r(   r,   classmethodr2   r6   __static_attributes__ r*   r   r   r      s.    1G &D  
*r*   r   )
__future__r   r   ior   typingr   r   rC   r*   r   <module>rG      s     # 	  1* 1*r*   