
    Ύi                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
mZmZmZ ddlmZmZ eej        ef         ZeZd Zeddee         defd            Zd	ej        dee         fd
Zej        dee         dej        fd            Zej        dedej        fd            Zej        dddej        fd            Zd Zd	ej        fdZe j        	 dej        dd            Z d Z!dede"fdZ#ej        d             Z$e$                    ej%                  e j        d                         Ze j        dej&        fd            Z'e j        d             Z(d Z)dS )    N)OptionalUnioncast   )ResourceReaderTraversablec                 l     t                      t          j                   f fd	            }|S )a1  
    Replace 'package' parameter as 'anchor' and warn about the change.

    Other errors should fall through.

    >>> files('a', 'b')
    Traceback (most recent call last):
    TypeError: files() takes from 0 to 1 positional arguments but 2 were given

    Remove this compatibility in Python 3.14.
    c                     |ur7| ur | |          S t          j        dt          d            |          S | u r
             S  |           S )Nz/First parameter to files is renamed to 'anchor'   )
stacklevel)warningswarnDeprecationWarning)anchorpackagefunc	undefineds     N/var/www/icac/venv/lib/python3.11/site-packages/importlib_resources/_common.pywrapperz"package_to_anchor.<locals>.wrapper!   s    )##Y&&tFG,,,MA"   
 4== y  466MtF||    )object	functoolswraps)r   r   r   s   ` @r   package_to_anchorr      sS     I_T )        Nr   r   returnc                 :    t          t          |                     S )z3
    Get a Traversable resource for an anchor.
    )from_packageresolve)r   s    r   filesr   3   s    
 (((r   r   c                 d    | j         }t          |j        dd          }|dS  ||j                  S )z?
    Return the package's loader if it's a ResourceReader.
    get_resource_readerN)__spec__getattrloadername)r   specreaders      r   r!   r!   ;   s<     DT["7>>F~t6$)r   candc                 6    t          t          j        |           S N)r   types
ModuleTyper(   s    r   r   r   K   s     $'''r   c                 *    t          j        |           S r*   )	importlibimport_moduler-   s    r   _r1   P   s    "4(((r   c                 N    t          t                      j        d                   S )N__name__)r   _infer_caller	f_globalsr-   s    r   r1   r1   U   s    =??,Z8999r   c                      fd} d }t          j                    t          j        |           }t          j        ||          }t	          |          j        S )zS
    Walk the stack and find the frame of the first caller not in this module.
    c                 0    | j         d         j         k    S )Nr   )filename)
frame_infostacks    r   is_this_filez#_infer_caller.<locals>.is_this_file_   s    "eAh&777r   c                     | j         dk    S )Nr   )function)r9   s    r   
is_wrapperz!_infer_caller.<locals>.is_wrapperb   s    "i//r   )inspectr:   	itertoolsfilterfalsenextframe)r;   r>   not_this_filecallersr:   s       @r   r4   r4   Z   sk    
8 8 8 8 80 0 0 MOOE),>>M#J>>G==r   c                     ddl m}  ||           }|j                            |j                  }|                                S )z=
    Return a Traversable object for the given package.

    r   )	wrap_spec)future.adaptersrG   r$   r!   r%   r   )r   rG   r&   r'   s       r   r   r   l   sJ     +*****9WD[,,TY77F<<>>r    )
_os_removec             #   ~  K   t          j        |          \  }}	 	 t          j        | |                        t          j        |           n# t          j        |           w xY w~ t          j        |          V  	  ||           d S # t          $ r Y d S w xY w# 	  ||           w # t          $ r Y w w xY wxY wN)suffix)tempfilemkstemposwriteclosepathlibPathFileNotFoundError)r'   rM   rJ   fdraw_paths        r   	_tempfilerX   y   s       #6222LB	HR"""HRLLLLBHRLLLLl8$$$$$	Jx       	 	 	DD		Jx      	 	 	D	sR   A B A%%B  B 
BBB< B,+B<,
B96B<8B99B<c                 8    t          | j        | j                  S rL   )rX   
read_bytesr%   paths    r   
_temp_filer]      s    T_TY7777r   r\   c                     t          j        t                    5  |                                 cddd           S # 1 swxY w Y   dS )a  
    Some Traversables implement ``is_dir()`` to raise an
    exception (i.e. ``FileNotFoundError``) when the
    directory doesn't exist. This function wraps that call
    to always return a boolean and only return True
    if there's a dir and it exists.
    NF)
contextlibsuppressrU   is_dirr[   s    r   _is_present_dirrb      s     
	.	/	/  {{}}               5s   ;??c                 \    t          |           rt          |           nt          |           S )zu
    Given a Traversable object, return that object as a
    path on the local file system in a context manager.
    )rb   	_temp_dirr]   r[   s    r   as_filere      s)     .d33I9T???D9I9IIr   c              #      K   | V  dS )z7
    Degenerate behavior for pathlib.Path objects.
    N r[   s    r   r1   r1      s       JJJJJr   dirc              #   l   K   | 5 }t          j        |          V  ddd           dS # 1 swxY w Y   dS )zF
    Wrap tempfile.TemporaryDirectory to return a pathlib object.
    N)rS   rT   )rh   results     r   
_temp_pathrk      s      
 
 #l6"""""# # # # # # # # # # # # # # # # # #s   )--c              #      K   |                                  sJ t          t          j                              5 }t	          ||           V  ddd           dS # 1 swxY w Y   dS )zt
    Given a traversable dir, recursively replicate the whole tree
    to the file system in a context manager.
    N)ra   rk   rN   TemporaryDirectory_write_contents)r\   temp_dirs     r   rd   rd      s       ;;==	H/11	2	2 .hh-----. . . . . . . . . . . . . . . . . .s   AA Ac                 (   |                      |j                  }|                                r<|                                 |                                D ]}t          ||           n'|                    |                                           |S r*   )joinpathr%   ra   mkdiriterdirrn   write_bytesrZ   )targetsourcechilditems       r   rn   rn      s    OOFK((E}} /NN$$ 	) 	)DE4((((	) 	&++--...Lr   r*   )rI   )*r_   r   r/   r?   r@   rP   rS   rN   r+   r   typingr   r   r   abcr   r   r,   strPackageAnchorr   r   r!   singledispatchr   registerr1   r4   r   contextmanagerremoverX   r]   boolrb   re   rT   rm   rk   rd   rn   rg   r   r   <module>r      s)                    				     ( ( ( ( ( ( ( ( ( ( , , , , , , , ,
 #%
&	  @ ) )(6" )k ) ) ) )!1 h~6N      ((6" (u'7 ( ( ( ( 	)C )E$ ) ) ) ) 	:D :U% : : : :  $
%* 
 
 
 
   y    48 8 8
+ 
$ 
 
 
 
 J J J 	',     #H/ # # # # . . .    r   