
 Xc           @   s   d  d l  m Z 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	   ImageFilec         C   s
   |  a  d  S(   N(   t   _handler(   t   handler(    (    s;   /usr/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyt   register_handler   s    c         C   s!   |  d d !d k o  |  d d k S(   Ni    i   t   GRIBi   s   (    (   t   prefix(    (    s;   /usr/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(    (    s;   /usr/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyt   _open'   s    		c         C   s   t  S(   N(   R   (   R   (    (    s;   /usr/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyR   8   s    (   t   __name__t
   __module__t   formatt   format_descriptionR   R   (    (    (    s;   /usr/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(    (    s;   /usr/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyt   _save<   s    s   .gribN(   t   PILR    R   R   R   R   R   t   StubImageFileR   R!   t   register_openR   t   register_savet   register_extension(    (    (    s;   /usr/lib/python2.7/dist-packages/PIL/GribStubImagePlugin.pyt   <module>   s   				