ó
È4ec           @   s6   d  d l  Z  d d l m Z d e f d „  ƒ  YZ d S(   iÿÿÿÿNi   (   t   o8t   GimpPaletteFilec           B   s    e  Z d  Z d „  Z d „  Z RS(   t   RGBc         C   sC  g  t  d ƒ D] } t | ƒ d ^ q |  _ | j ƒ  d  d k rQ t d ƒ ‚ n  xÖ t  d ƒ D]È } | j ƒ  } | sz Pn  t j d | ƒ r’ q^ n  t | ƒ d k r³ t d ƒ ‚ n  t t	 t
 | j ƒ  d  ƒ ƒ } t | ƒ d k ró t d	 ƒ ‚ n  t | d
 ƒ t | d ƒ t | d ƒ |  j | <q^ Wd j |  j ƒ |  _ d  S(   Ni   i   i   s   GIMP Palettes   not a GIMP palette files   \w+:|#id   s   bad palette files   bad palette entryi    i   i   t    (   t   rangeR    t   palettet   readlinet   SyntaxErrort   ret   matcht   lent   tuplet   mapt   intt   splitt
   ValueErrort   join(   t   selft   fpt   it   st   v(    (    s=   /usr/local/lib/python2.7/dist-packages/PIL/GimpPaletteFile.pyt   __init__   s     ,7c         C   s   |  j  |  j f S(   N(   R   t   rawmode(   R   (    (    s=   /usr/local/lib/python2.7/dist-packages/PIL/GimpPaletteFile.pyt
   getpalette8   s    (   t   __name__t
   __module__R   R   R   (    (    (    s=   /usr/local/lib/python2.7/dist-packages/PIL/GimpPaletteFile.pyR      s   	(   R   t   _binaryR    t   objectR   (    (    (    s=   /usr/local/lib/python2.7/dist-packages/PIL/GimpPaletteFile.pyt   <module>   s   