
    ed                    8    d dl mZ d dlZddlmZ  G d d      Zy)    )annotationsN   )o8c                       e Zd ZdZdZd Zd Zy)GimpPaletteFilez'File handler for GIMP's palette format.RGBc           	        t        d      D cg c]  }t        |      dz   c}| _        |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   | j                  |<    dj                  | 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   palettereadlineSyntaxErrorrematchlentuplemapintsplit
ValueErrorjoin)selffpimsgsvs         5/usr/lib/python3/dist-packages/PIL/GimpPaletteFile.py__init__zGimpPaletteFile.__init__   s   +0:6a1	6;;="0+Cc""s 	=AA xx
A&1v|(!#&&c#qwwy!}-.A1v{) o% 1hAaD1BqtH<DLLO#	=& xx-3 7s   Ec                2    | j                   | j                  fS )N)r   rawmode)r   s    r#   
getpalettezGimpPaletteFile.getpalette8   s    ||T\\))r   N)__name__
__module____qualname____doc__r&   r$   r'    r   r#   r   r      s    1G.8*r   r   )
__future__r   r   _binaryr   r   r,   r   r#   <module>r/      s     # 	 "* "*r   