File: //proc/self/root/var/opt/nydus/ops/importlib_resources/__pycache__/_common.cpython-39.pyc
a
�,�hI � @ s� d dl mZ d dlZd dlZd dlZddlmZmZmZm Z m
Z
mZ dd� Zdd� Z
d d
� Zejddd
��Ze
ejdd� ��Ze�e�ejdd� ��ZdS )� )�absolute_importN� )�Path�package_spec�FileNotFoundError�ZipPath�singledispatch�suppressc C s t | �}t|�pt|�S )z=
Return a Traversable object for the given package.
)r �from_traversable_resources�fallback_resources)�package�spec� r �L/opt/nydus/tmp/pip-target-wkfpz8uv/lib/python/importlib_resources/_common.py�from_package
s r c C s6 t t�� | j�� W d � S 1 s(0 Y dS )z|
If the spec.loader implements TraversableResources,
directly or implicitly, it will have a ``files()`` method.
N)r �AttributeError�loader�files)r
r r r r
s
r
c C sJ t | j�j}z&| jj}|�|�}t|t|�d �W S tyD Y n0 |S )N�/) r �origin�parentr �archive�relative_tor �str� Exception)r
�package_directory�archive_path�rel_pathr r r r s
r � c c s� t j|d�\}}zHt�|| � � t�|� t|�V W zt�|� W q~ tyV Y q~0 n$zt�|� W n tyz Y n0 0 d S )N��suffix)�tempfile�mkstemp�os�write�closer �remover )�readerr �fd�raw_pathr r r � _tempfile* s
�r* c c s: t | j| jd��}|V W d � n1 s,0 Y dS )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 dS )z7
Degenerate behavior for pathlib.Path objects.
Nr )r- r r r �_F s r0 )r )�
__future__r r# r! �
contextlibZ_compatr r r r r r r r
r �contextmanagerr* r/ �registerr0 r r r r �<module> s