Ñò
mÈKc           @   s?  d  Z  d g Z d d „ Z g  Z d „  Z e i e ƒ d „  Z e i e ƒ d „  Z e i e ƒ d „  Z	 e i e	 ƒ d „  Z
 e i e
 ƒ d „  Z e i e ƒ d	 „  Z e i e ƒ d
 „  Z e i e ƒ d „  Z e i e ƒ d „  Z e i e ƒ d „  Z e i e ƒ d „  Z e i e ƒ d „  Z d „  Z d S(   s<   Recognize image file formats based on their first few bytes.t   whatc         C   sÄ   | d  j od t |  t ƒ o" t |  d ƒ } | i d ƒ } qw |  i ƒ  } |  i d ƒ } |  i | ƒ d  } n d  } z0 x) t D]! } | | | ƒ } | o | Sq WWd  | o | i ƒ  n Xd  S(   Nt   rbi    (	   t   Nonet
   isinstancet
   basestringt   opent   readt   tellt   seekt   testst   close(   t   filet   ht   ft   locationt   tft   res(    (    s   /usr/lib/python2.6/imghdr.pyR    	   s$    
  c         C   s   |  d d !d j o d Sd S(   s   JPEG data in JFIF formati   i
   t   JFIFt   jpegN(    (   R   R   (    (    s   /usr/lib/python2.6/imghdr.pyt	   test_jpeg%   s    c         C   s   |  d d !d j o d Sd S(   s   JPEG data in Exif formati   i
   t   ExifR   N(    (   R   R   (    (    s   /usr/lib/python2.6/imghdr.pyt	   test_exif,   s    c         C   s   |  d  d j o d Sd  S(   Ni   s   ‰PNG

t   png(    (   R   R   (    (    s   /usr/lib/python2.6/imghdr.pyt   test_png3   s    c         C   s   |  d  d j o d Sd S(   s   GIF ('87 and '89 variants)i   t   GIF87at   GIF89at   gifN(   R   R   (    (   R   R   (    (    s   /usr/lib/python2.6/imghdr.pyt   test_gif9   s    c         C   s   |  d  d j o d Sd S(   s-   TIFF (can be in Motorola or Intel byte order)i   t   MMt   IIt   tiffN(   R   R   (    (   R   R   (    (    s   /usr/lib/python2.6/imghdr.pyt	   test_tiff@   s    c         C   s   |  d  d j o d Sd S(   s   SGI image libraryi   s   Út   rgbN(    (   R   R   (    (    s   /usr/lib/python2.6/imghdr.pyt   test_rgbG   s    c         C   sO   t  |  ƒ d j o8 |  d d j o' |  d d j o |  d d j o d Sd	 S(
   s   PBM (portable bitmap)i   i    t   Pi   t   14i   s    	
t   pbmN(   t   len(   R   R   (    (    s   /usr/lib/python2.6/imghdr.pyt   test_pbmN   s    3c         C   sO   t  |  ƒ d j o8 |  d d j o' |  d d j o |  d d j o d Sd	 S(
   s   PGM (portable graymap)i   i    R"   i   t   25i   s    	
t   pgmN(   R%   (   R   R   (    (    s   /usr/lib/python2.6/imghdr.pyt   test_pgmV   s    3c         C   sO   t  |  ƒ d j o8 |  d d j o' |  d d j o |  d d j o d Sd	 S(
   s   PPM (portable pixmap)i   i    R"   i   t   36i   s    	
t   ppmN(   R%   (   R   R   (    (    s   /usr/lib/python2.6/imghdr.pyt   test_ppm^   s    3c         C   s   |  d  d j o d Sd S(   s   Sun raster filei   s   Y¦j•t   rastN(    (   R   R   (    (    s   /usr/lib/python2.6/imghdr.pyt	   test_rastf   s    c         C   s&   d } |  t  | ƒ  | j o d Sd S(   s   X bitmap (X10 or X11)s   #define t   xbmN(   R%   (   R   R   t   s(    (    s   /usr/lib/python2.6/imghdr.pyt   test_xbmm   s    c         C   s   |  d  d j o d Sd  S(   Ni   t   BMt   bmp(    (   R   R   (    (    s   /usr/lib/python2.6/imghdr.pyt   test_bmpu   s    c          C   sÂ   d d  k  }  d } |  i d o+ |  i d d j o |  i d d 5d } n y@ |  i d o t |  i d | d ƒ n t d g | d ƒ Wn0 t j
 o$ |  i i d ƒ |  i d ƒ n Xd  S(   Niÿÿÿÿi    i   s   -ri   t   .s   
[Interrupted]
(   t   syst   argvt   testallt   KeyboardInterruptt   stderrt   writet   exit(   R6   t	   recursive(    (    s   /usr/lib/python2.6/imghdr.pyt   test   s    "
c         C   sá   d d  k  } d d  k } xÂ |  D]º } | i i | ƒ ob | d G| p | oC d GHd d  k } | i | i i | d ƒ ƒ } t | | d ƒ qÙ d GHq | d G| i i ƒ  y t	 | ƒ GHWq t
 j
 o d GHq Xq Wd  S(	   Niÿÿÿÿs   /:s   recursing down:t   *i    s   *** directory (use -r) ***t   :s   *** not found ***(   R6   t   ost   patht   isdirt   globt   joinR8   t   stdoutt   flushR    t   IOError(   t   listR=   t   toplevelR6   RA   t   filenameRD   t   names(    (    s   /usr/lib/python2.6/imghdr.pyR8   Ž   s$     	N(   t   __doc__t   __all__R   R    R	   R   t   appendR   R   R   R   R!   R&   R)   R,   R.   R1   R4   R>   R8   (    (    (    s   /usr/lib/python2.6/imghdr.pyt   <module>   s:   														