a
    bgB                     @   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                   @   sB   e Zd ZdZddeeef eddddZee	 dd	d
Z
dS )NotionDirectoryLoaderzLoad `Notion directory` dump.zutf-8encodingN)pathr	   returnc                C   s   || _ || _dS )zInitialize with a file path.N)	file_pathr	   )selfr
   r	    r   y/var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/site-packages/langchain_community/document_loaders/notion.py__init__   s    zNotionDirectoryLoader.__init__)r   c              	   C   sz   t t| jd}g }|D ]X}t|| jd}| }W d   n1 sL0    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   