Your IP : 18.227.134.165


Current Path : /lib64/python3.6/__pycache__/
Upload File :
Current File : //lib64/python3.6/__pycache__/imghdr.cpython-36.pyc

3


 \��@s2dZddlmZdgZd%dd�ZgZdd�Zeje�dd	�Zeje�d
d�Z	eje	�dd
�Z
eje
�dd�Zeje�dd�Zeje�dd�Z
eje
�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�dd�Zeje�d d!�Zd"d#�Zed$k�r.e�dS)&z<Recognize image file formats based on their first few bytes.�)�PathLike�whatNc
Cs�d}zl|dkrNt|ttf�r2t|d�}|jd�}n|j�}|jd�}|j|�xtD]}|||�}|rT|SqTWWd|r~|j�XdS)N�rb� )	�
isinstance�strr�open�read�tell�seek�tests�close)�file�h�f�locationZtf�res�r�/usr/lib64/python3.6/imghdr.pyrs 





cCs|dd�dkrdSdS)z JPEG data in JFIF or Exif format��
�JFIF�ExifZjpegN)rrr)rrrrr�	test_jpeg%srcCs|jd�rdSdS)Ns�PNG

Zpng)�
startswith)rrrrr�test_png,s
rcCs|dd�dkrdSdS)zGIF ('87 and '89 variants)Nr�GIF87a�GIF89aZgif)rrr)rrrrr�test_gif2srcCs|dd�dkrdSdS)z-TIFF (can be in Motorola or Intel byte order)N��MM�IIZtiff)r r!r)rrrrr�	test_tiff9sr"cCs|jd�rdSdS)zSGI image librarys�ZrgbN)r)rrrrr�test_rgb@s
r#cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSd	S)
zPBM (portable bitmap)�r�P�s14rs 	

ZpbmN)�len�ord)rrrrr�test_pbmGs(r)cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSd	S)
zPGM (portable graymap)r$rr%r&s25rs 	

ZpgmN)r'r()rrrrr�test_pgmOs(r*cCs<t|�dkr8|dtd�kr8|ddkr8|ddkr8dSd	S)
zPPM (portable pixmap)r$rr%r&s36rs 	

ZppmN)r'r()rrrrr�test_ppmWs(r+cCs|jd�rdSdS)zSun raster filesY�j�ZrastN)r)rrrrr�	test_rast_s
r,cCs|jd�rdSdS)zX bitmap (X10 or X11)s#define ZxbmN)r)rrrrr�test_xbmfs
r-cCs|jd�rdSdS)NsBMZbmp)r)rrrrr�test_bmpms
r.cCs"|jd�r|dd�dkrdSdS)NsRIFF��sWEBPZwebp)r)rrrrr�	test_webpssr1cCs|jd�rdSdS)Nsv/1Zexr)r)rrrrr�test_exrys
r2cCs�ddl}d}|jdd�r8|jddkr8|jdd�=d}y8|jdd�r`t|jdd�|d�ntdg|d�Wn*tk
r�|jjd�|jd�YnXdS)Nrr&z-rr�.z
[Interrupted]
)�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)r4�	recursiverrr�test�sr<cCs�ddl}ddl}x�|D]�}|jj|�rzt|ddd�|s>|rptd�ddl}|j|jj|d��}t||d�q�td�qt|ddd�|jj	�ytt
|��Wqtk
r�td	�YqXqWdS)
Nrz/:� )�endzrecursing down:�*z*** directory (use -r) ***�:z*** not found ***)r4�os�path�isdir�print�glob�joinr6�stdout�flushr�OSError)�listr;Ztoplevelr4rA�filenamerE�namesrrrr6�s"


r6�__main__)N)�__doc__rAr�__all__rrr�appendrrr"r#r)r*r+r,r-r.r1r2r<r6�__name__rrrr�<module>sD
















?>