ó
È4ec           @   s    d  d l  m Z m Z d  d l m Z d	 a d „  Z d „  Z d e j	 f d „  ƒ  YZ
 d „  Z e j e
 j e
 e ƒ e j e
 j e ƒ e j e
 j d ƒ d	 S(
   i   (   t   Imaget	   ImageFile(   t   i8c         C   s
   |  a  d S(   s_   
    Install application-specific GRIB image handler.

    :param handler: Handler object.
    N(   t   _handler(   t   handler(    (    sA   /usr/local/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyt   register_handler   s    c         C   s'   |  d d !d k o& t  |  d ƒ d k S(   Ni    i   t   GRIBi   i   (   R   (   t   prefix(    (    sA   /usr/local/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyt   _accept    s    t   GribStubImageFilec           B   s&   e  Z d  Z d  Z d „  Z d „  Z RS(   R   c         C   s~   |  j  j ƒ  } t |  j  j d ƒ ƒ s6 t d ƒ ‚ n  |  j  j | ƒ d |  _ d |  _ |  j ƒ  } | rz | j	 |  ƒ n  d  S(   Ni   s   Not a GRIB filet   Fi   (   i   i   (
   t   fpt   tellR   t   readt   SyntaxErrort   seekt   modet   _sizet   _loadt   open(   t   selft   offsett   loader(    (    sA   /usr/local/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyt   _open)   s    		c         C   s   t  S(   N(   R   (   R   (    (    sA   /usr/local/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyR   :   s    (   t   __name__t
   __module__t   formatt   format_descriptionR   R   (    (    (    sA   /usr/local/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyR	   $   s   	c         C   sB   t  d  k s t d d ƒ r+ t d ƒ ‚ n  t  j |  | | ƒ d  S(   NR   t   saves   GRIB save handler not installed(   R   t   Nonet   hasattrt   IOErrorR   (   t   imR   t   filename(    (    sA   /usr/local/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyt   _save>   s    s   .gribN(   t    R    R   t   _binaryR   R   R   R   R   t   StubImageFileR	   R"   t   register_openR   t   register_savet   register_extension(    (    (    sA   /usr/local/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyt   <module>   s   				