U
    hN                     @   s@   d dl Z d dlmZ d dlmZ d dlmZ G dd deZdS )    N)Path)Union)
TextLoaderc                       s.   e Zd ZdZeeef d fddZ  ZS )PythonLoaderzFLoad `Python` files, respecting any non-default encoding if specified.)	file_pathc              	      s:   t |d}t|j\}}W 5 Q R X t j||d dS )ziInitialize with a file path.

        Args:
            file_path: The path to the file to load.
        rb)r   encodingN)opentokenizedetect_encodingreadlinesuper__init__)selfr   fr   _	__class__ O/tmp/pip-unpacked-wheel-9gdii04g/langchain_community/document_loaders/python.pyr      s    zPythonLoader.__init__)	__name__
__module____qualname____doc__r   strr   r   __classcell__r   r   r   r   r      s   r   )r
   pathlibr   typingr   Z)langchain_community.document_loaders.textr   r   r   r   r   r   <module>   s   