
    j                         d dl Z d dlmZmZ d dlmZ ddlmZmZ ddl	m
Z
 dZ	 d dlZg dZg dZ G d	 d
e      Zy# e$ r  e j                         ZY ,w xY w)    N)BinaryIOAny)
from_bytes   )DocumentConverterDocumentConverterResult)
StreamInfo)ztext/zapplication/jsonzapplication/markdown)z.txtz.textz.mdz	.markdownz.jsonz.jsonlc                   @    e Zd ZdZdedededefdZdededede	fdZ
y)	PlainTextConverterz%Anything with content type text/plainfile_streamstream_infokwargsreturnc                     |j                   xs dj                         }|j                  xs dj                         }|j                  y|t        v ryt
        D ]  }|j                  |      s y y)N TF)mimetypelower	extensioncharsetACCEPTED_FILE_EXTENSIONSACCEPTED_MIME_TYPE_PREFIXES
startswith)selfr   r   r   r   r   prefixs          l/root/aria/tools/markitdown-venv/lib/python3.12/site-packages/markitdown/converters/_plain_text_converter.pyacceptszPlainTextConverter.accepts$   sz      ((.B557 **0b779	 * 001 	F""6*	     c                     |j                   r*|j                         j                  |j                         }n0t        t	        |j                               j                               }t        |      S )N)markdown)r   readdecodestrr   bestr   )r   r   r   r   text_contents        r   convertzPlainTextConverter.convert<   sX     &++-44[5H5HILz+*:*:*<=BBDEL&==r   N)__name__
__module____qualname____doc__r   r	   r   boolr   r   r%    r   r   r   r   !   s[    /   	
 
0>>  > 	>
 
!>r   r   )systypingr   r   charset_normalizerr   _base_converterr   r   _stream_infor	   _dependency_exc_infomammothImportErrorexc_infor   r   r   r+   r   r   <module>r5      s`    
   ) H %  *
  &>* &>)  *'3<<>*s   < AA