
    :Qg                        U d dl mZ d dlmZmZmZ d dlZd dlm	Z	 d dl
mZ d dlmZmZmZ d dlmZ d dlmZmZ d d	lmZmZ d
Zded<    eej4                        e		 dddd	 	 	 	 	 	 	 	 	 dd              Zy)    )annotations)IOAnyOptionalN)add_chunking_strategy)	HtmlTable)ElementElementMetadataTable)FileType)exactly_onespooled_to_bytes_io_if_needed)apply_metadataget_last_modified_datetsvstrDETECTION_ORIGINF)fileinclude_headerc                  t        | |       |rdnd}| rt        j                  | d|      }n'|J t        |      }t        j                  |d|      }t	        j
                  |j                  d|d            }t        | | rt        |       nd|j                  	      }t        |_        t        |j                  |
      gS )aT  Partitions TSV files into document elements.

    Parameters
    ----------
    filename
        A string defining the target filename path.
    file
        A file-like object using "rb" mode --> open(filename, "rb").
    include_header
        Determines whether or not header info info is included in text and medatada.text_as_html.
    )filenamer   r   N	)sepheaderF )indexr   na_rep)r   last_modifiedtext_as_html)textmetadata)r   pdread_csvr   r   from_html_textto_htmlr
   r   htmlr   detection_originr   r    )	r   r   r   kwargsr   	dataframef
html_tabler!   s	            W/var/www/html/answerous/venv/lib/python3.12/site-packages/unstructured/partition/tsv.pypartition_tsvr-      s    ( - QdFKKd6B	 *$/KKtF;	))nRHJ :B,X6__H
 !1Hz:;;    )N)
r   zOptional[str]r   zOptional[IO[bytes]]r   boolr(   r   returnzlist[Element])
__future__r   typingr   r   r   pandasr"   unstructured.chunkingr   unstructured.common.html_tabler   unstructured.documents.elementsr	   r
   r   unstructured.file_utils.modelr   $unstructured.partition.common.commonr   r   &unstructured.partition.common.metadatar   r   r   __annotations__TSVr-    r.   r,   <module>r=      s    " $ $  7 4 K K 2 Z #  "*< !% 	*<*< *< 	*<
 *< *<  *<r.   