Your IP : 3.145.88.155


Current Path : /opt/alt/python39/lib64/python3.9/importlib/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/importlib/__pycache__/resources.cpython-39.opt-2.pyc

a

R�f)�@s�ddlZddlmZddlmZddlmZddlmZmZddl	m
Z
ddlmZdd	l
mZmZdd
lmZddlmZddlmZmZmZmZdd
lmZddlmZmZgd�ZeeefZeeej fZ!ed�dd�Z"ed�dd�Z#ed�dd�Z$eeej%d�dd�Z&dd�Z'ee!ed�dd�Z(d4ee!eeed!�d"d#�Z)ee!e*d�d$d%�Z+d5ee!eeed!�d&d'�Z,eej-d�d(d)�Z.ee!d*d�d+d,�Z/ed-d.��Z0eee1d/�d0d1�Z2eeed�d2d3�Z3dS)6�N�)�abc)�_common)�as_file)�contextmanager�suppress)�
import_module)�ResourceLoader)�BytesIO�
TextIOWrapper)�Path)�
ModuleType)�ContextManager�Iterable�Optional�Union)�cast)�BinaryIO�TextIO)�Package�Resourcer�contents�files�is_resource�open_binary�	open_text�path�read_binary�	read_text)�returncCst|d�r|St|�S)N�__spec__)�hasattrr��name�r$�8/opt/alt/python39/lib64/python3.9/importlib/resources.py�_resolve$s
r&cCs&t|�}|jjdur"td�|���|S)Nz{!r} is not a package)r&r �submodule_search_locations�	TypeError�format)�package�moduler$r$r%�_get_package+sr,cCs&tj�|�\}}|r"td�|���|S)Nz{!r} must be only a file name)�osr�split�
ValueErrorr))r�parent�	file_namer$r$r%�_normalize_path7sr2)r*rcCs,|j}t|jd�r(ttj|j�|j��SdS)N�get_resource_reader)r r!�loaderr�
resources_abc�ResourceReaderr3r#)r*�specr$r$r%�_get_resource_readerBs�r8cCs&|jjdus|jjs"td|����dS)NzPackage has no location )r �origin�has_location�FileNotFoundError�r*r$r$r%�_check_locationPsr=)r*�resourcerc
Cs�t|�}t|�}t|�}|dur*|�|�Stj�|jjp:d�}tj�	|�}tj�
||�}zt|dd�WSty�t
t|jj�}d}t|jjd�r�tt��|�|�}Wd�n1s�0Y|dur�|jj}d�||�}	t|	��t|�YS0dS)Nznon-existent file�rb)�mode�get_dataz{!r} resource not found in {!r})r2r,r8�
open_resourcer-r�abspathr r9�dirname�join�open�OSErrorrr	r4r!rrAr#r)r;r
)
r*r>�readerZabsolute_package_path�package_path�	full_pathr4�dataZpackage_name�messager$r$r%rUs2

�
(�r�utf-8�strict)r*r>�encoding�errorsrcCstt||�||d�S)N)rOrP)rr)r*r>rOrPr$r$r%rss�rcCs6t||��}|��Wd�S1s(0YdS�N)r�read)r*r>�fpr$r$r%r|srcCs:t||||��}|��Wd�S1s,0YdSrQ)rrR)r*r>rOrPrSr$r$r%r�s	rcCst�t|��SrQ)r�from_packager,r<r$r$r%r�srzContextManager[Path]cCs2tt|��}|rt||�St�t|��t|���SrQ)r8r,�_path_from_readerrrr�joinpathr2)r*r>rHr$r$r%r�s
��rccs�t|�}tt��"t|�|��VWd�dS1s80Y|�|�}tj|j|d��}|VWd�n1sx0YdS)N)�suffix)	r2rr;r�
resource_pathrBrZ	_tempfilerR)rHr>Z
norm_resourceZ
opener_reader�resr$r$r%rU�s
 
rU)r*r#rcCsTt|�}t|�t|�}|dur*|�|�Stt|��}||vrBdSt�|�|��S)NF)	r,r2r8r�setrrrT�is_file)r*r#rHZpackage_contentsr$r$r%r�s
rcCsdt|�}t|�}|dur |��S|jjdup6|jjdk}|sD|jjsHdStdd�t�|��	�D��S)N�	namespacer$css|]}|jVqdSrQr")�.0�itemr$r$r%�	<genexpr>��zcontents.<locals>.<genexpr>)
r,r8rr r9r:�listrrT�iterdir)r*rHr\r$r$r%r�s
�r)rMrN)rMrN)4r-�rr5rr�
contextlibrr�	importlibr�
importlib.abcr	�ior
r�pathlibr�typesr
�typingrrrrrZ	typing.iorr�__all__�strr�PathLikerr&r,r2r6r8r=rr�bytesrr�TraversablerrrU�boolrrr$r$r$r%�<module>sZ
� ��	��
�



?>