mfc@s?dZdgZddZgZdZejedZejedZejedZ eje dZ eje dZ eje d Z eje d Z eje d Zejed Zejed ZejedZejedZdZdS(s<Recognize image file formats based on their first few bytes.twhatcCs|dkrmt|tr<t|d}|jd}qs|j}|jd}|j|d}nd}z.x'tD]}|||}|r}|Sq}WWd|r|jnXdS(Ntrbi ( tNonet isinstancet basestringtopentreadttelltseektteststclose(tfilethtftlocationttftres((s/usr/lib64/python2.7/imghdr.pyR s"      cCs|dd!dkrdSdS(sJPEG data in JFIF formatii tJFIFtjpegN((R R ((s/usr/lib64/python2.7/imghdr.pyt test_jpeg%scCs|dd!dkrdSdS(sJPEG data in Exif formatii tExifRN((R R ((s/usr/lib64/python2.7/imghdr.pyt test_exif,scCs|d dkrdSdS(NisPNG  tpng((R R ((s/usr/lib64/python2.7/imghdr.pyttest_png3scCs|d dkrdSdS(sGIF ('87 and '89 variants)itGIF87atGIF89atgifN(RR((R R ((s/usr/lib64/python2.7/imghdr.pyttest_gif9scCs|d dkrdSdS(s-TIFF (can be in Motorola or Intel byte order)itMMtIIttiffN(RR((R R ((s/usr/lib64/python2.7/imghdr.pyt test_tiff@scCs|d dkrdSdS(sSGI image libraryistrgbN((R R ((s/usr/lib64/python2.7/imghdr.pyttest_rgbGscCsJt|dkrF|ddkrF|ddkrF|ddkrFdSd S( sPBM (portable bitmap)iitPit14is tpbmN(tlen(R R ((s/usr/lib64/python2.7/imghdr.pyttest_pbmNs0cCsJt|dkrF|ddkrF|ddkrF|ddkrFdSd S( sPGM (portable graymap)iiR"it25is tpgmN(R%(R R ((s/usr/lib64/python2.7/imghdr.pyttest_pgmVs0cCsJt|dkrF|ddkrF|ddkrF|ddkrFdSd S( sPPM (portable pixmap)iiR"it36is tppmN(R%(R R ((s/usr/lib64/python2.7/imghdr.pyttest_ppm^s0cCs|d dkrdSdS(sSun raster fileisYjtrastN((R R ((s/usr/lib64/python2.7/imghdr.pyt test_rastfscCs$d}|t| |kr dSdS(sX bitmap (X10 or X11)s#define txbmN(R%(R R ts((s/usr/lib64/python2.7/imghdr.pyttest_xbmmscCs|d dkrdSdS(NitBMtbmp((R R ((s/usr/lib64/python2.7/imghdr.pyttest_bmpuscCsddl}d}|jdrH|jddkrH|jdd5d}ny>|jdrrt|jd|dntdg|dWn.tk r|jjd|jdnXdS(Niiis-rit.s [Interrupted] (tsystargvttestalltKeyboardInterrupttstderrtwritetexit(R6t recursive((s/usr/lib64/python2.7/imghdr.pyttests      cCsddl}ddl}x|D]}|jj|r|dG|sK|rdGHddl}|j|jj|d}t||dqdGHq|dG|jjyt |GHWqt k rdGHqXqWdS( Nis/:srecursing down:t*is*** directory (use -r) ***t:s*** not found ***( R6tostpathtisdirtglobtjoinR8tstdouttflushRtIOError(tlistR=ttoplevelR6RAtfilenameRDtnames((s/usr/lib64/python2.7/imghdr.pyR8s"       N(t__doc__t__all__RRR RtappendRRRRR!R&R)R,R.R1R4R>R8(((s/usr/lib64/python2.7/imghdr.pyts: