Your IP : 18.119.124.24


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

o

6��f�,�@s(	ddlmZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
dd
lmZddlZddlZddlZddlZddlZdd�Zdd�Zd#dd�Zd#dd�Zedd��Zdd�Zdd�Zdd�ZGdd �d ej�ZGd!d"�d"e�ZdS)$�)�Loader)�module_from_spec)�
_resolve_name)�spec_from_loader)�
_find_spec)�MAGIC_NUMBER)�_RAW_MAGIC_NUMBER)�cache_from_source)�
decode_source)�source_from_cache)�spec_from_file_location�)�contextmanagerNcCs	t�t|�S�N)�_imp�source_hashr)�source_bytes�r�5/opt/alt/python310/lib64/python3.10/importlib/util.pyrsrcCs^	|�d�s|S|stdt|��d���d}|D]}|dkr n|d7}qt||d�||�S)N�.zno package specified for z% (required for relative module names)r
r)�
startswith�ImportError�reprr)�name�package�level�	characterrrr�resolve_names

rcCsp	|tjvrt||�Stj|}|durdSz|j}Wnty*td�|��d�w|dur6td�|���|S)N�{}.__spec__ is not set�{}.__spec__ is None)�sys�modulesr�__spec__�AttributeError�
ValueError�format)r�path�module�specrrr�_find_spec_from_path*s



�r)c	
Cs�	|�d�rt||�n|}|tjvrH|�d�d}|rAt|dgd�}z|j}Wnty@}z
td|�d|��|d�|�d}~wwd}t	||�Stj|}|durSdSz|j
}Wntygtd�|��d�w|durstd	�|���|S)
Nrr
�__path__)�fromlistz __path__ attribute not found on z while trying to find )rrr)
rrr r!�
rpartition�
__import__r*r#�ModuleNotFoundErrorrr"r$r%)	rr�fullname�parent_name�parent�parent_path�er'r(rrr�	find_specIs@

�����


�r4ccs��|tjv}tj�|�}|stt�|�}d|_|tj|<z-z|VWnty=|s;ztj|=Wn	ty:YnwYnwWd|_dSWd|_dSd|_w)NTF)r r!�get�type�__initializing__�	Exception�KeyError)r�	is_reloadr'rrr�_module_to_loadvs,�


����
�r;c�	t����fdd��}|S)NcsVtjdtdd��|i|��}t|dd�dur)|j|_t|d�s)|j�d�d|_|S)N�kThe import system now takes care of this automatically; this decorator is slated for removal in Python 3.12���
stacklevel�__package__r*rr
)�warnings�warn�DeprecationWarning�getattr�__name__rA�hasattrr,)�args�kwargsr'��fxnrr�set_package_wrapper�s�
z(set_package.<locals>.set_package_wrapper��	functools�wraps)rKrLrrJr�set_package�s
rPcr<)Ncs@tjdtdd��|g|�Ri|��}t|dd�dur||_|S)Nr=r>r?�
__loader__)rBrCrDrErQ)�selfrHrIr'rJrr�set_loader_wrapper�s�z&set_loader.<locals>.set_loader_wrapperrM)rKrSrrJr�
set_loader�srTcs,	tjdtdd�t����fdd��}|S)Nr=r>r?c
s�t|��8}||_z|�|�}WnttfyYnw|r!||_n|�d�d|_�||g|�Ri|��Wd�S1s?wYdS)Nrr
)r;rQ�
is_packagerr#rAr,)rRr/rHrIr'rUrJrr�module_for_loader_wrapper�s
�$�z4module_for_loader.<locals>.module_for_loader_wrapper)rBrCrDrNrO)rKrVrrJr�module_for_loader�s�rWc@seZdZ	dd�Zdd�ZdS)�_LazyModulecCs�	tj|_|jj}|jjd}|j}i}|��D]\}}||vr%|||<qt||�t||�kr5|||<q|jj	�
|�|tjvrUt|�ttj|�krUt
d|�d���|j�|�t||�S)N�__dict__zmodule object for z. substituted in sys.modules during a lazy load)�types�
ModuleType�	__class__r"r�loader_staterY�items�id�loader�exec_moduler r!r$�updaterE)rR�attr�
original_name�
attrs_then�	attrs_now�
attrs_updated�key�valuerrr�__getattribute__�s$
�

z_LazyModule.__getattribute__cCs	|�|�t||�dSr)rj�delattr)rRrcrrr�__delattr__s
z_LazyModule.__delattr__N)rF�
__module__�__qualname__rjrlrrrrrX�s"rXc@s>eZdZ	edd��Zedd��Zdd�Zdd�Zd	d
�Z	dS)�
LazyLoadercCst|d�s	td��dS)Nraz loader must define exec_module())rG�	TypeError)r`rrr�__check_eager_loaders
�zLazyLoader.__check_eager_loadercs	������fdd�S)Ncs��|i|���Srr)rHrI��clsr`rr�<lambda>sz$LazyLoader.factory.<locals>.<lambda>)�_LazyLoader__check_eager_loaderrrrrrr�factorys
zLazyLoader.factorycCs|�|�||_dSr)rur`)rRr`rrr�__init__s

zLazyLoader.__init__cCs|j�|�Sr)r`�
create_module)rRr(rrrrxszLazyLoader.create_modulecCsB	|j|j_|j|_i}|j��|d<|j|d<||j_t|_dS)NrYr\)r`r"rQrY�copyr\r]rX)rRr'r]rrrra"s


zLazyLoader.exec_moduleN)
rFrmrn�staticmethodru�classmethodrvrwrxrarrrrros

ror) �_abcr�
_bootstraprrrr�_bootstrap_externalrrr	r
rr�
contextlibrrrNr rZrBrrr)r4r;rPrTrWr[rXrorrrr�<module>s:

-
(.

?>