o
    ZhB                     @   sH   d dl mZ d dlmZmZ d dlmZ d dlmZ G dd deZ	dS )    )Path)ListUnion)Document)
BaseLoaderc                   @   sF   e Zd ZdZdddeeef deddfdd	Zdee	 fd
dZ
dS )NotionDirectoryLoaderzLoad `Notion directory` dump.zutf-8encodingpathr	   returnNc                C   s   || _ || _dS )zInitialize with a file path.N)	file_pathr	   )selfr
   r	    r   b/var/www/html/lang_env/lib/python3.10/site-packages/langchain_community/document_loaders/notion.py__init__   s   
zNotionDirectoryLoader.__init__c              	   C   sz   t t| jd}g }|D ],}t|| jd}| }W d   n1 s&w   Y  dt|i}|t	||d q|S )zLoad documents.z**/*.mdr   Nsource)Zpage_contentmetadata)
listr   r   globopenr	   readstrappendr   )r   pathsdocspftextr   r   r   r   load   s   
zNotionDirectoryLoader.load)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r   r   r   r   	   s    $r   N)
pathlibr   typingr   r   Zlangchain_core.documentsr   Z)langchain_community.document_loaders.baser   r   r   r   r   r   <module>   s
    