
    js                         d dl Z d dlZ	 d dlmZ 	 d dlmZ  G d de      Z	d Z
 G d de      Z G d	 d
e      Zy# e$ r	 d dlmZ Y 9w xY w# e$ r	 d dlmZ Y Cw xY w)    N)urlopen)urlparsec                       e Zd Zd Zd Zy)Filesc                      || _         || _        y )N)_base_external_file_access)selfbaseexternal_file_accesss      S/root/aria/tools/markitdown-venv/lib/python3.12/site-packages/mammoth/docx/files.py__init__zFiles.__init__   s    
%9"    c                    | j                   st        dj                  |            	 t        |      rt	        j
                  t        |            S | j                  4t        t        j                  j                  | j                  |      d      S t        dj                  |            # t        $ r6}dj                  || 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 
	5C !))'#,77'BGGLLS94@@/0j0q0qru0vww 	5]ddTZZU-G+G44	5s#   (B+ ?B+ B+ +	C*41C%%C*N)__name__
__module____qualname__r   r    r   r   r   r      s    :5r   r   c                 2    t        |       j                  dk7  S )N )r   scheme)urls    r   r   r   %   s    C=2%%r   c                       e Zd Zy)r   Nr!   r"   r#   r$   r   r   r   r   )       r   r   c                       e Zd Zy)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      sm    	 '"%
5F 50&	
 		(A 	Q  '&'  "!"s    < A A
	A
AA