File: //opt/alt/python37/lib64/python3.7/__pycache__/imghdr.cpython-37.opt-1.pyc
B
    � f�  �               @   s2  d Z ddlmZ dgZd%dd�Zg Zdd� Ze�e� dd	� Ze�e� d
d� Z	e�e	� dd
� Z
e�e
� dd� Ze�e� dd� Ze�e� dd� Z
e�e
� dd� Ze�e� dd� Ze�e� dd� Ze�e� dd� Ze�e� dd� Ze�e� dd� Ze�e� d d!� Zd"d#� Zed$k�r.e�  dS )&z<Recognize image file formats based on their first few bytes.�    )�PathLike�whatNc             C   s�   d }zl|d krNt | ttf�r2t| d�}|�d�}n| �� }| �d�}| �|� xtD ]}|||�}|rT|S qTW W d |r~|��  X d S )N�rb�    )	�
isinstance�strr   �open�read�tell�seek�tests�close)�file�h�f�locationZtfZres� r   �+/opt/alt/python37/lib64/python3.7/imghdr.pyr      s     
 
c             C   s   | dd� dkrdS dS )z JPEG data in JFIF or Exif format�   �
   )s   JFIFs   ExifZjpegNr   )r   r   r   r   r   �	test_jpeg%   s    r   c             C   s   | � d�rdS d S )Ns   �PNG
Zpng)�
startswith)r   r   r   r   r   �test_png,   s    
r   c             C   s   | dd� dkrdS dS )zGIF ('87 and '89 variants)Nr   )s   GIF87as   GIF89aZgifr   )r   r   r   r   r   �test_gif2   s    r   c             C   s   | dd� dkrdS dS )z-TIFF (can be in Motorola or Intel byte order)N�   )s   MMs   IIZtiffr   )r   r   r   r   r   �	test_tiff9   s    r   c             C   s   | � d�rdS dS )zSGI image librarys   �ZrgbN)r   )r   r   r   r   r   �test_rgb@   s    
r   c             C   s<