
    Ybc                     l    d dl mZ ddlmZ ddlmZmZmZmZm	Z	m
Z
 d Zd Zd Zd Zd	 Zd
 Zd Zd Zy)    )absolute_import   )TYPES)image_match
font_matchdocument_matchvideo_matchaudio_matcharchive_matchc                 <    t         D ]  }|j                  | k(  s y y)a  
    Checks if the given extension string is
    one of the supported by the file matchers.

    Args:
        ext (str): file extension string. E.g: jpg, png, mp4, mp3

    Returns:
        True if the file extension is supported.
        Otherwise False.
    TF)r   	extension)extkinds     2/usr/lib/python3/dist-packages/filetype/helpers.pyis_extension_supportedr      s'      >>S      c                 <    t         D ]  }|j                  | k(  s y y)z
    Checks if the given MIME type string is
    one of the supported by the file matchers.

    Args:
        mime (str): MIME string. E.g: image/jpeg, video/mpeg

    Returns:
        True if the MIME type is supported.
        Otherwise False.
    TF)r   mime)r   r   s     r   is_mime_supportedr      s'      99 r   c                     t        |       duS )z
    Checks if a given input is a supported type image.

    Args:
        obj: path to file, bytes or bytearray.

    Returns:
        True if obj is a valid image. Otherwise False.

    Raises:
        TypeError: if obj is not a supported type.
    N)r   objs    r   is_imager   /        s4''r   c                     t        |       duS )z
    Checks if a given input is a supported type archive.

    Args:
        obj: path to file, bytes or bytearray.

    Returns:
        True if obj is a valid archive. Otherwise False.

    Raises:
        TypeError: if obj is not a supported type.
    N)r   r   s    r   
is_archiver   ?   s     T))r   c                     t        |       duS )z
    Checks if a given input is a supported type audio.

    Args:
        obj: path to file, bytes or bytearray.

    Returns:
        True if obj is a valid audio. Otherwise False.

    Raises:
        TypeError: if obj is not a supported type.
    N)r
   r   s    r   is_audior   O   r   r   c                     t        |       duS )z
    Checks if a given input is a supported type video.

    Args:
        obj: path to file, bytes or bytearray.

    Returns:
        True if obj is a valid video. Otherwise False.

    Raises:
        TypeError: if obj is not a supported type.
    N)r	   r   s    r   is_videor    _   r   r   c                     t        |       duS )z
    Checks if a given input is a supported type font.

    Args:
        obj: path to file, bytes or bytearray.

    Returns:
        True if obj is a valid font. Otherwise False.

    Raises:
        TypeError: if obj is not a supported type.
    N)r   r   s    r   is_fontr"   o   s     c?$&&r   c                     t        |       duS )a  
    Checks if a given input is a supported type document.

    Args:
        obj: path to file, bytes or bytearray.

    Returns:
        True if obj is a valid document. Otherwise False.

    Raises:
        TypeError: if obj is not a supported type.
    N)r   r   s    r   is_documentr$      s     #d**r   N)
__future__r   typesr   matchr   r   r   r	   r
   r   r   r   r   r   r   r    r"   r$    r   r   <module>r)      s?    '  $$( * ( ( ' +r   