Your IP : 3.144.4.50


Current Path : /opt/alt/python38/lib64/python3.8/importlib/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/importlib/__pycache__/resources.cpython-38.opt-2.pyc

U

i�f@%�	@s�ddlZddlZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
mZddlmZdd	lmZdd
lmZmZmZmZmZddlmZddlmZmZdd
lmZdddddddddg	Zee efZ!ee ej"fZ#ed�dd�Z$e d�dd�Z%eeej&d�dd�Z'dd �Z(e!e#ed!�d"d�Z)d-e!e#e e ed%�d&d�Z*e!e#e+d!�d'd�Z,d.e!e#e e e d%�d(d�Z-ee!e#eed!�d)d��Z.e!e e/d*�d+d�Z0e!ee d�d,d�Z1dS)/�N�)�abc)�contextmanager�suppress)�
import_module)�ResourceLoader)�BytesIO�
TextIOWrapper)�Path)�
ModuleType)�Iterable�Iterator�Optional�Set�Union)�cast)�BinaryIO�TextIO)�ZipImportError�Package�Resource�contents�is_resource�open_binary�	open_text�path�read_binary�	read_text)�returncCs\t|d�r0|jjdkr*td�|jj���qX|Sn(t|�}|jjdkrTtd�|���n|SdS)N�__spec__z{!r} is not a package)�hasattrr�submodule_search_locations�	TypeError�format�namer)�package�module�r'�8/opt/alt/python38/lib64/python3.8/importlib/resources.py�_get_package"s
�r)cCs,tj�|�\}}|r$td�|���n|SdS)Nz{!r} must be only a file name)�osr�split�
ValueErrorr#)r�parent�	file_namer'r'r(�_normalize_path6sr/)r%rcCs,|j}t|jd�r(ttj|j�|j��SdS)N�get_resource_reader)rr �loaderr�
resources_abc�ResourceReaderr0r$)r%�specr'r'r(�_get_resource_readerBs�r5cCs&|jjdks|jjs"td|����dS)NzPackage has no location )r�origin�has_location�FileNotFoundError)r%r'r'r(�_check_locationPsr9)r%�resourcerc
Cs�t|�}t|�}t|�}|dk	r*|�|�St|�tj�|jj	�}tj�
|�}tj�||�}zt|dd�WSt
k
r�tt|jj�}d}t|jjd�r�tt
��|�|�}W5QRX|dkr�|jj}d�||�}	t|	��nt|�YSYnXdS)N�rb)�mode�get_data�{!r} resource not found in {!r})r/r)r5�
open_resourcer9r*r�abspathrr6�dirname�join�open�OSErrorrrr1r rr=r$r#r8r)
r%r:�reader�absolute_package_path�package_path�	full_pathr1�data�package_name�messager'r'r(rUs2

�
�utf-8�strict)r%r:�encoding�errorsrcCs
t|�}t|�}t|�}|dk	r2t|�|�||�St|�tj�|j	j
�}tj�|�}tj�||�}zt
|d||d�WStk
�rtt|j	j�}d}	t|j	jd�r�tt��|�|�}	W5QRX|	dkr�|j	j}
d�||
�}t|��ntt|	�||�YSYnXdS)N�r)r<rNrOr=r>)r/r)r5r	r?r9r*rr@rr6rArBrCrDrrr1r rr=r$r#r8r)r%r:rNrOrErFrGrHr1rIrJrKr'r'r(rts2
�
c
Cs:t|�}t|�}t||��}|��W5QR�SQRXdS�N)r/r)r�read)r%r:�fpr'r'r(r�sc
Cs>t|�}t|�}t||||��}|��W5QR�SQRXdSrQ)r/r)rrR)r%r:rNrOrSr'r'r(r�s	c	cst|�}t|�}t|�}|dk	rNzt|�|��VWdStk
rJYqVXnt|�d}|jjdk	r|t|jj�j	}||}|dk	r�|�
�r�|Vnxt||��}|��}W5QRXt
��\}}z$t�||�t�|�t|�VW5zt�|�Wntk
�rYnXXdSrQ)r/r)r5r
�
resource_pathr8r9rr6r-�existsrrR�tempfileZmkstempr*�remove�write�close)	r%r:rEZ	file_path�package_directoryrSrI�fdZraw_pathr'r'r(r�s6

)r%r$rc	Cs|t|�}t|�t|�}|dk	r*|�|�Sztt|��}Wnttfk
rTYdSX||krbdSt|j	j
�j|}|��S)NF)
r)r/r5r�setr�NotADirectoryErrorr8r
rr6r-�is_file)r%r$rEZpackage_contentsrr'r'r(r�s
cCsTt|�}t|�}|dk	r |��S|jjdks4|jjs8dSt|jj�j}t�	|�SdS)Nr')
r)r5rrr6r7r
r-r*�listdir)r%rErZr'r'r(r�s)rLrM)rLrM)2r*rV�rr2�
contextlibrr�	importlibr�
importlib.abcr�iorr	�pathlibr
�typesr�typingrr
rrrrZ	typing.iorrZ	zipimportr�__all__�strr�PathLikerr)r/r3r5r9rr�bytesrrr�boolrrr'r'r'r(�<module>sh�

�!��"
��.

?>