
    ihB                     N    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e      Z	y)    )Path)ListUnion)Document)
BaseLoaderc                   F    e Zd ZdZdddeeef   deddfdZdee	   fd	Z
y)
NotionDirectoryLoaderzLoad `Notion directory` dump.zutf-8encodingpathr   returnNc                     || _         || _        y)zInitialize with a file path.N)	file_pathr   )selfr   r   s      i/var/www/html/dev/engine/venv/lib/python3.12/site-packages/langchain_community/document_loaders/notion.py__init__zNotionDirectoryLoader.__init__   s         c                 <   t        t        | j                        j                  d            }g }|D ][  }t	        || j
                        5 }|j                         }ddd       dt        |      i}|j                  t        |             ] |S # 1 sw Y   6xY w)zLoad documents.z**/*.mdr
   Nsource)page_contentmetadata)
listr   r   globopenr   readstrappendr   )r   pathsdocspftextr   s          r   loadzNotionDirectoryLoader.load   s    T$..)..y9: 	HAa$--0  Avvx  #a&)HKKdXFG		H
 	   s   BB	)__name__
__module____qualname____doc__r   r   r   r   r   r   r#    r   r   r	   r	   	   s;    'BI !U39- !C !d !
	d8n 	r   r	   N)
pathlibr   typingr   r   langchain_core.documentsr   )langchain_community.document_loaders.baser   r	   r(   r   r   <module>r-      s      - @J r   