
    %js                         d dl Z d dlZ	 d dlmZ n# e$ r	 d dlmZ Y nw xY w	 d dlmZ n# e$ r	 d dlmZ Y nw xY w G d de          Z	d Z
 G d de          Z G d	 d
e          ZdS )    N)urlopen)urlparsec                       e Zd Zd Zd ZdS )Filesc                 "    || _         || _        d S )N)_base_external_file_access)selfbaseexternal_file_accesss      Z/home/rurouni/.hermes/hermes-agent/venv/lib/python3.11/site-packages/mammoth/docx/files.py__init__zFiles.__init__   s    
%9"""    c                    | j         s"t          d                    |                    	 t          |          r!t	          j        t          |                    S | j        3t          t          j
                            | j        |          d          S t          d                    |                    # t          $ r=}d                    || j        t          |                    }t          |          d }~ww xY w)NzEcould not open external image '{0}', external file access is disabledrbz8could not find external image '{0}', fileobj has no namezDcould not open external image: '{0}' (document directory: '{1}')
{2})r	   !ExternalFileAccessIsDisabledErrorformat_is_absolute
contextlibclosingr   r   openospathjoinInvalidFileReferenceErrorIOErrorstr)r
   urierrormessages       r   r   z
Files.open   s    ) 	3W^^_bcc  
	5C   x!)'#,,777'BGLLS994@@@/0j0q0qru0v0vwww 	5 	5 	5]ddTZU- -G+G444	5s#   /B7 9B7 "B7 7
C>8C99C>N)__name__
__module____qualname__r   r    r   r   r   r      s2        : : :5 5 5 5 5r   r   c                 2    t          |           j        dk    S )N )r   scheme)urls    r   r   r   %   s    C==2%%r   c                       e Zd ZdS )r   Nr!   r"   r#   r$   r   r   r   r   )           Dr   r   c                       e Zd ZdS )r   Nr*   r$   r   r   r   r   -   r+   r   r   )r   r   urllib2r   ImportErrorurllib.requesturllib.parser   objectr   r   
ValueErrorr   r   r$   r   r   <module>r3      sL   				    ' ' ' '&&&&&&&&'"%%%%%%% " " "!!!!!!!!"5 5 5 5 5F 5 5 50& & &	 	 	 	 	
 	 	 		 	 	 	 	(A 	 	 	 	 	s    * 88