Your IP : 3.147.78.249


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/imghdr.cpython-34.pyo

�
i f�
�@sidZdgZddd�ZgZdd�Zeje�dd�Zeje�dd	�Zeje�d
d�Zeje�dd
�Z	eje	�dd�Z
eje
�dd�Zeje�dd�Zeje�dd�Z
eje
�dd�Zeje�dd�Zeje�dd�Zdd�Zedkree�ndS)z<Recognize image file formats based on their first few bytes.�whatNc
Cs�d}z�|dkrpt|t�rEt|d�}|jd�}qp|j�}|jd�}|j|�nx'tD]}|||�}|rw|SqwWWd|r�|j�nXdS)N�rb� )�
isinstance�str�open�read�tell�seek�tests�close)�file�h�f�locationZtf�res�r�+/opt/alt/python34/lib64/python3.4/imghdr.pyr	s 
cCs|dd�dkrdSdS)z JPEG data in JFIF or Exif format��
�JFIF�ExifZjpegN)rrr)r
rrrr�	test_jpeg#srcCs|jd�rdSdS)Ns�PNG

Zpng)�
startswith)r
rrrr�test_png*srcCs|dd�dkrdSdS)zGIF ('87 and '89 variants)Nr�GIF87a�GIF89aZgif)rrr)r
rrrr�test_gif0srcCs|dd�dkrdSdS)z-TIFF (can be in Motorola or Intel byte order)N��MM�IIZtiff)rrr)r
rrrr�	test_tiff7sr cCs|jd�rdSdS)zSGI image librarys�ZrgbN)r)r
rrrr�test_rgb>sr!cCsPt|�dkrL|dtd�krL|ddkrL|ddkrLdSd	S)
zPBM (portable bitmap)���P�s14rs 	

ZpbmN)�len�ord)r
rrrr�test_pbmEs6r(cCsPt|�dkrL|dtd�krL|ddkrL|ddkrLdSd	S)
zPGM (portable graymap)r"r#r$r%s25rs 	

ZpgmN)r&r')r
rrrr�test_pgmMs6r)cCsPt|�dkrL|dtd�krL|ddkrL|ddkrLdSd	S)
zPPM (portable pixmap)r"r#r$r%s36rs 	

ZppmN)r&r')r
rrrr�test_ppmUs6r*cCs|jd�rdSdS)zSun raster filesY�j�ZrastN)r)r
rrrr�	test_rast]sr+cCs|jd�rdSdS)zX bitmap (X10 or X11)s#define ZxbmN)r)r
rrrr�test_xbmdsr,cCs|jd�rdSdS)NsBMZbmp)r)r
rrrr�test_bmpksr-cCs�ddl}d}|jdd�rQ|jddkrQ|jdd�=d}nyJ|jdd�r�t|jdd�|d�ntdg|d�Wn/tk
r�|jjd�|jd�YnXdS)Nr#r%z-rr�.z
[Interrupted]
)�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)r/�	recursiverrr�testus&	 
r7cCsddl}ddl}x�|D]�}|jj|�r�t|ddd�|sW|r�td�ddl}|j|jj|d��}t||d�q�td�qt|ddd�|jj	�ytt
|��Wqtk
r�td	�YqXqWdS)
Nr#z/:�end� zrecursing down:�*z*** directory (use -r) ***�:z*** not found ***)r/�os�path�isdir�print�glob�joinr1�stdout�flushr�OSError)�listr6Ztoplevelr/r<�filenamer@�namesrrrr1�s"




r1�__main__)�__doc__�__all__rr
r�appendrrr r!r(r)r*r+r,r-r7r1�__name__rrrr�<module>s:	












?>