a
    ӗa                     @   s   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 Zdd ZejdddZ	ej
ejd	d
 Zeejejdd ZdS )    Nc                 C   s
   t | jS )z=
    Return a Traversable object for the given package.

    )fallback_resources__spec__)package r   4/home/manager/Python-3.9.10/Lib/importlib/_common.pyfrom_package	   s    r   c                 C   sN   t | jj}z(| jj}||}t|t|d W S  t	yH   Y n0 |S )N/)
pathlibPathoriginparentloaderarchiverelative_tozipfilestr	Exception)specZpackage_directoryZarchive_pathZrel_pathr   r   r   r      s    
r    c                 c   s   t j|d\}}zJt||   t| t|V  W zt| W q tyX   Y q0 n$zt| W n ty|   Y n0 0 d S )Nsuffix)	tempfilemkstemposwritecloser	   r
   removeFileNotFoundError)readerr   fdZraw_pathr   r   r   	_tempfile   s    
r    c                 c   s:   t | j| jd}|V  W d   n1 s,0    Y  dS )zu
    Given a Traversable object, return that object as a
    path on the local file system in a context manager.
    r   N)r    
read_bytesname)pathlocalr   r   r   as_file-   s    r%   c                 c   s
   | V  dS )z7
    Degenerate behavior for pathlib.Path objects.
    Nr   )r#   r   r   r   _8   s    r&   )r   )r   r	   r   r   	functools
contextlibr   r   contextmanagerr    singledispatchr%   registerr
   r&   r   r   r   r   <module>   s   	
