a
    ¡˜ëj¦  ã                   @  s¨   U d dl mZ d dlmZmZmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZ d	Zd
ed< dddddgddœdddddddddœdd„ZdS )é    )Úannotations)ÚIOÚAnyÚOptional)ÚElement)Ú&convert_file_to_html_text_using_pandoc)ÚFileType)Úexactly_one)Úget_last_modified_date)Úpartition_htmlÚepubÚstrÚDETECTION_ORIGINNÚautoF)ÚfileÚmetadata_filenameÚmetadata_last_modifiedÚ	languagesÚdetect_language_per_elementzOptional[str]zOptional[IO[bytes]]zOptional[list[str]]Úboolr   zlist[Element])Úfilenamer   r   r   r   r   ÚkwargsÚreturnc          	   
   K  sR   t | |d� | rt| ƒnd}td| |d�}tf ||p6| tj|p@|||tdœ|¤ŽS )aò  Partitions an EPUB document. The document is first converted to HTML and then
    partitioned using partition_html.

    Parameters
    ----------
    filename
        A string defining the target filename path.
    file
        A file-like object using "rb" mode --> open(filename, "rb").
    metadata_last_modified
        The last modified date for the document.
    languages
        User defined value for `metadata.languages` if provided. Otherwise language is detected
        using naive Bayesian filter via `langdetect`. Multiple languages indicates text could be
        in either language.
        Additional Parameters:
            detect_language_per_element
                Detect language per element instead of at the document level.
    )r   r   Nr   )Zsource_formatr   r   )Útextr   Zmetadata_file_typer   r   r   Zdetection_origin)r	   r
   r   r   r   ZEPUBr   )	r   r   r   r   r   r   r   Zlast_modifiedZ	html_text© r   úZ/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/unstructured/partition/epub.pyÚpartition_epub   s     ÿùør   )N)Ú
__future__r   Útypingr   r   r   Zunstructured.documents.elementsr   Z'unstructured.file_utils.file_conversionr   Zunstructured.file_utils.modelr   Z$unstructured.partition.common.commonr	   Z&unstructured.partition.common.metadatar
   Zunstructured.partition.htmlr   r   Ú__annotations__r   r   r   r   r   Ú<module>   s     ÿù