a �DOg��@s.ddlmZdgZd$dd�ZgZdd�Ze�e�dd�Ze�e�d d �Ze�e�d d �Z e�e �d d�Z e�e �dd�Z e�e �dd�Z e�e �dd�Z e�e �dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd�Ze�e�dd �Zd!d"�Zed#k�r*e�dS)%�)�PathLike�whatNcCs�d}z�|durNt|ttf�r2t|d�}|�d�}n|��}|�d�}|�|�tD](}|||�}|rR|W|rx|��SqRW|r�|��n|r�|��0dS)N�rb� ) � isinstance�strr�open�read�tell�seek�tests�close)�file�h�f�locationZtf�res�r�/usr/lib64/python3.9/imghdr.pyr s"      �cCs|dd�dvrdSdS)N�� )sJFIFsExifZjpegr�rrrrr� test_jpeg%srcCs|�d�rdSdS)Ns�PNG  Zpng�� startswithrrrr�test_png,s rcCs|dd�dvrdSdS)Nr)sGIF87asGIF89aZgifrrrrr�test_gif2srcCs|dd�dvrdSdS)N�)sMMsIIZtiffrrrrr� test_tiff9srcCs|�d�rdSdS)Ns�Zrgbrrrrr�test_rgb@s rcCs<t|�dkr8|dtd�kr8|ddvr8|ddvr8dSdS) N�r�P�s14r� Zpbm��len�ordrrrr�test_pbmGs � � �r'cCs<t|�dkr8|dtd�kr8|ddvr8|ddvr8dSdS) Nr rr!r"s25rr#Zpgmr$rrrr�test_pgmOs � � �r(cCs<t|�dkr8|dtd�kr8|ddvr8|ddvr8dSdS) Nr rr!r"s36rr#Zppmr$rrrr�test_ppmWs � � �r)cCs|�d�rdSdS)NsY�j�Zrastrrrrr� test_rast_s r*cCs|�d�rdSdS)Ns#define Zxbmrrrrr�test_xbmfs r+cCs|�d�rdSdS)NsBMZbmprrrrr�test_bmpms r,cCs"|�d�r|dd�dkrdSdS)NsRIFF�� sWEBPZwebprrrrr� test_webpssr/cCs|�d�rdSdS)Nsv/1Zexrrrrrr�test_exrys r0cCs�ddl}d}|jdd�r8|jddkr8|jdd�=d}z8|jdd�r`t|jdd�|d�ntdg|d�Wn(ty�|j�d�|�d�Yn0dS)Nrr"z-rr�.z [Interrupted] )�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)r2� recursiverrr�test�s   r:c Cs�ddl}ddl}|D]�}|j�|�r~t|ddd�|s<|rttd�ddl}|�|j�|�|�d��}t||d�q�td�qt|ddd�|j � �ztt |��Wqt y�td �Yq0qdS) Nrz/:� )�endzrecursing down:�*z*** directory (use -r) ***�:z*** not found ***) r2�os�path�isdir�print�glob�join�escaper4�stdout�flushr�OSError)�listr9Ztoplevelr2r?�filenamerC�namesrrrr4�s"    r4�__main__)N)r?r�__all__rr r�appendrrrrr'r(r)r*r+r,r/r0r:r4�__name__rrrr�sB