Your IP : 3.145.152.49


Current Path : /opt/alt/python310/lib64/python3.10/importlib/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/importlib/__pycache__/resources.cpython-310.pyc

o

6��fI�@s�ddlZddlZddlmZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
dd	lmZmZdd
lmZddlmZddlmZmZmZdd
lmZddlmZmZddlmZddlmZgd�Z ee!efZ"ee!ej#fZ$de"de$defdd�Z%		d3de"de$de!de!def
dd�Z&de"de$de'fdd�Z(		d3de"de$de!de!de!f
dd �Z)de"de$dd!fd"d#�Z*d$d%�Z+d&d'�Z,d(d)�Z-de"d*e!de.fd+d,�Z/de"dee!fd-d.�Z0ed/d0��Z1e1�2e�d1d2��Z3dS)4�N�)�_common)�as_file�files)�ResourceReader)�suppress)�ResourceLoader)�
ModuleSpec)�BytesIO�
TextIOWrapper)�Path)�
ModuleType)�ContextManager�Iterable�Union)�cast)�BinaryIO�TextIO)�Sequence)�singledispatch)�Package�Resourcerr�contentsr�is_resource�open_binary�	open_text�path�read_binary�	read_text�package�resource�returnc	Cs&t�|�}t�|�}t�|�}|dur|�|�Stt|j�}|jdur'|j}n|j	dur8t
j�t
j�
|j	��g}|D]N}t
j�||�}z	t|dd�WSty�tt|j�}d}t|jd�rztt��
|�|�}Wd�n1suwY|dur�t|�YSYq:wt|�d|j����)zDReturn a file-like object opened for binary reading of the resource.N�rb)�mode�get_dataz resource not found in )r�normalize_path�get_package�get_resource_reader�
open_resourcerr	�__spec__�submodule_search_locations�origin�osr�dirname�abspath�join�open�OSErrorr�loader�hasattrrr$r
�FileNotFoundError�name)	rr �reader�spec�pathsZpackage_path�	full_pathr2�data�r;�:/opt/alt/python310/lib64/python3.10/importlib/resources.pyr(s4






���r�utf-8�strict�encoding�errorscCstt||�||d�S)zBReturn a file-like object opened for text reading of the resource.)r?r@)rr)rr r?r@r;r;r<rJs�rcCs6t||��}|��Wd�S1swYdS)z+Return the binary contents of the resource.N)r�read)rr �fpr;r;r<rVs$�rcCs:t||||��}|��Wd�S1swYdS)z�Return the decoded string of the resource.

    The decoding-related arguments have the same semantics as those of
    bytes.decode().
    N)rrA)rr r?r@rBr;r;r<r\s$�rzContextManager[Path]cCs@t�t�|��}|rt|t�|��St�t�|��t�|���S)akA context manager providing a file path object to the resource.

    If the resource does not already exist on its own on the file system,
    a temporary file will be created. If the file was created, the file
    will be deleted upon exiting the context manager (no exception is
    raised if the file was deleted prior to the context manager
    exiting).
    )rr'r&�_path_from_readerr%rrZjoinpath)rr r6r;r;r<rks����rcCst||�p	t||�S�N)�_path_from_resource_path�_path_from_open_resource�r6r r;r;r<rC�s�rCcCs:tt��t|�|��Wd�S1swYdSrD)rr4rZ
resource_pathrGr;r;r<rE�s
$�rEcCs$t�|�|����}tj|j|d�S)N)�suffix)�ior
r(rArZ	_tempfile)r6r Zsavedr;r;r<rF�srFr5cCsZt�|�}t�|�t�|�}|dur|�|�Stt|��}||vr$dSt�|�|��S)zYTrue if 'name' is a resource inside 'package'.

    Directories are *not* resources.
    NF)	rr&r%r'r�setr�from_package�is_file)rr5r6Zpackage_contentsr;r;r<r�s



rcCsTt�|�}t�|�}|durt|���St�|�}|��r(tdd�|��D��SgS)z�Return an iterable of entries in 'package'.

    Note that not all entries are resources.  Specifically, directories are
    not considered resources.  Use `is_resource()` on each entry returned here
    to check if it is a resource or not.
    Ncss�|]}|jVqdSrD)r5)�.0�itemr;r;r<�	<genexpr>�s�zcontents.<locals>.<genexpr>)	rr&r'�_ensure_sequencerrK�is_dir�listZiterdir)rr6Z
transversabler;r;r<r�s


rcCst|�SrD)rR��iterabler;r;r<rP�srPcCs|SrDr;rSr;r;r<�_�srU)r=r>)4r,rI�rrr�abcr�
contextlibrZ
importlib.abcr�importlib.machineryr	r
rZpathlibr�typesr
�typingrrrrZ	typing.iorrZcollections.abcr�	functoolsr�__all__�strr�PathLikerrr�bytesrrrrCrErF�boolrrrP�registerrUr;r;r;r<�<module>s~%�����
�	�����
���
�


?>