B
    u9aÓ  ã               @   s.  d dl mZ dgZd$dd„Zg Zdd„ Ze e¡ dd„ Ze e¡ d	d
„ Ze e¡ dd„ Z	e e	¡ dd„ Z
e e
¡ dd„ Ze e¡ dd„ Ze e¡ dd„ Ze e¡ dd„ Ze e¡ dd„ Ze e¡ dd„ Ze e¡ dd„ Ze e¡ dd„ Ze e¡ dd „ Zd!d"„ Zed#kr*eƒ  dS )%é    )ÚPathLikeÚwhatNc             C   s„   d }zl|d krNt | ttfƒr2t| dƒ}| d¡}n|  ¡ }|  d¡}|  |¡ xtD ]}|||ƒ}|rT|S qTW W d |r~| ¡  X d S )NÚrbé    )	Ú
isinstanceÚstrr   ÚopenÚreadÚtellÚseekÚtestsÚclose)ÚfileÚhÚfÚlocationZtfZres© r   ú/usr/lib/python3.7/imghdr.pyr      s     




 
c             C   s   | dd… dkrdS d S )Né   é
   )s   JFIFs   ExifZjpegr   )r   r   r   r   r   Ú	test_jpeg%   s    r   c             C   s   |   d¡rdS d S )Ns   ‰PNG

Zpng)Ú
startswith)r   r   r   r   r   Útest_png,   s    
r   c             C   s   | d d… dkrdS d S )Nr   )s   GIF87as   GIF89aZgifr   )r   r   r   r   r   Útest_gif2   s    r   c             C   s   | d d… dkrdS d S )Né   )s   MMs   IIZtiffr   )r   r   r   r   r   Ú	test_tiff9   s    r   c             C   s   |   d¡rdS d S )Ns   ÚZrgb)r   )r   r   r   r   r   Útest_rgb@   s    
r   c             C   s<   t | ƒdkr8| d tdƒkr8| d dkr8| d dkr8dS d S )	Né   r   ó   Pé   s   14r   s    	
Zpbm)ÚlenÚord)r   r   r   r   r   Útest_pbmG   s    (r"   c             C   s<   t | ƒdkr8| d tdƒkr8| d dkr8| d dkr8dS d S )	Nr   r   r   r   s   25r   s    	
Zpgm)r    r!   )r   r   r   r   r   Útest_pgmO   s    (r#   c             C   s<   t | ƒdkr8| d tdƒkr8| d dkr8| d dkr8dS d S )	Nr   r   r   r   s   36r   s    	
Zppm)r    r!   )r   r   r   r   r   Útest_ppmW   s    (r$   c             C   s   |   d¡rdS d S )Ns   Y¦j•Zrast)r   )r   r   r   r   r   Ú	test_rast_   s    
r%   c             C   s   |   d¡rdS d S )Ns   #define Zxbm)r   )r   r   r   r   r   Útest_xbmf   s    
r&   c             C   s   |   d¡rdS d S )Ns   BMZbmp)r   )r   r   r   r   r   Útest_bmpm   s    
r'   c             C   s"   |   d¡r| dd… dkrdS d S )Ns   RIFFé   é   s   WEBPZwebp)r   )r   r   r   r   r   Ú	test_webps   s    r*   c             C   s   |   d¡rdS d S )Ns   v/1Zexr)r   )r   r   r   r   r   Útest_exry   s    
r+   c              C   s    dd l } d}| jdd … r8| jd dkr8| jdd…= d}y8| jdd … r`t| jdd … |dƒ ntdg|dƒ W n* tk
rš   | j d¡ |  d¡ Y nX d S )Nr   r   z-rr   Ú.z
[Interrupted]
)ÚsysÚargvÚtestallÚKeyboardInterruptÚstderrÚwriteÚexit)r-   Ú	recursiver   r   r   Útestƒ   s    r5   c          	   C   sÊ   dd l }dd l}x´| D ]¬}|j |¡rzt|d dd |s>|rptdƒ dd l}| |j |d¡¡}t||dƒ qÂtdƒ qt|d dd |j 	¡  ytt
|ƒƒ W q tk
rÀ   td	ƒ Y qX qW d S )
Nr   z/:ú )Úendzrecursing down:Ú*z*** directory (use -r) ***ú:z*** not found ***)r-   ÚosÚpathÚisdirÚprintÚglobÚjoinr/   ÚstdoutÚflushr   ÚOSError)Úlistr4   Ztoplevelr-   r:   Úfilenamer>   Únamesr   r   r   r/   ’   s"    


r/   Ú__main__)N)r:   r   Ú__all__r   r   r   Úappendr   r   r   r   r"   r#   r$   r%   r&   r'   r*   r+   r5   r/   Ú__name__r   r   r   r   Ú<module>   sB   














