Your IP : 3.12.165.68


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

a

R�f9,�@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"ej�Z dS)%�)�abc)�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�3/opt/alt/python39/lib64/python3.9/importlib/util.pyrsrcCs\|�d�s|S|s&tdt|��d���d}|D]}|dkr>qH|d7}q.t||d�||�S)N�.zno package specified for z% (required for relative module names)r
r)�
startswith�ImportError�reprr)�name�package�level�	characterrrr�resolve_names

rcCsv|tjvrt||�Stj|}|dur*dSz
|j}Wn"tyVtd�|��d�Yn0|durntd�|���|SdS)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|}|tjvr�|�d�d}|r�t|dgd�}z
|j}Wq�ty�}z&td|�d|��|d�|�WYd}~q�d}~00nd}t	||�Stj|}|dur�dSz
|j
}Wn"ty�td�|��d�Yn0|dur�td	�|���|SdS)
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_specIs8

���


r4ccs�|tjv}tj�|�}|s6tt�|�}d|_|tj|<zLz
|VWn6tyx|stztj|=WntyrYn0Yn0Wd|_nd|_0dS)NTF)r r!�get�type�__initializing__�	Exception�KeyError)r�	is_reloadr'rrr�_module_to_loadvs


r;cst����fdd��}|S)NcsVtjdtdd��|i|��}t|dd�durR|j|_t|d�sR|j�d�d|_|S)N�7The import system now takes care of this automatically.���
stacklevel�__package__r*rr
)�warnings�warn�DeprecationWarning�getattr�__name__r@�hasattrr,)�args�kwargsr'��fxnrr�set_package_wrapper�s�
z(set_package.<locals>.set_package_wrapper��	functools�wraps)rJrKrrIr�set_package�s	rOcst����fdd��}|S)Ncs@tjdtdd��|g|�Ri|��}t|dd�dur<||_|S)Nr<r=r>�
__loader__)rArBrCrDrP)�selfrGrHr'rIrr�set_loader_wrapper�s�z&set_loader.<locals>.set_loader_wrapperrL)rJrRrrIr�
set_loader�srScs*tjdtdd�t����fdd��}|S)Nr<r=r>c
s�t|��p}||_z|�|�}Wnttfy4Yn0|rB||_n|�d�d|_�||g|�Ri|��Wd�S1s~0YdS)Nrr
)r;rP�
is_packagerr#r@r,)rQr/rGrHr'rTrIrr�module_for_loader_wrapper�s
z4module_for_loader.<locals>.module_for_loader_wrapper)rArBrCrMrN)rJrUrrIr�module_for_loader�s�rVc@seZdZdd�Zdd�ZdS)�_LazyModulec	Cs�tj|_|jj}|jjd}|jjd}|j}i}|��D]:\}}||vrT|||<q:t||�t||�kr:|||<q:|jj	�
|�|tjvr�t|�ttj|�kr�t
d|�d���|j�|�t||�S)N�__dict__�	__class__zmodule object for z. substituted in sys.modules during a lazy load)�types�
ModuleTyperYr"r�loader_staterX�items�id�loader�exec_moduler r!r$�updaterD)	rQ�attr�
original_name�
attrs_then�
original_type�	attrs_now�
attrs_updated�key�valuerrr�__getattribute__�s"


z_LazyModule.__getattribute__cCs|�|�t||�dSr)rj�delattr)rQrbrrr�__delattr__s
z_LazyModule.__delattr__N)rE�
__module__�__qualname__rjrlrrrrrW�s#rWc@s<eZdZedd��Zedd��Zdd�Zdd�Zd	d
�Z	dS)�
LazyLoadercCst|d�std��dS)Nr`z loader must define exec_module())rF�	TypeError)r_rrr�__check_eager_loaders
zLazyLoader.__check_eager_loadercs������fdd�S)Ncs��|i|���Srr)rGrH��clsr_rr�<lambda>�z$LazyLoader.factory.<locals>.<lambda>)�_LazyLoader__check_eager_loaderrrrrrr�factorys
zLazyLoader.factorycCs|�|�||_dSr)rvr_)rQr_rrr�__init__s
zLazyLoader.__init__cCs|j�|�Sr)r_�
create_module)rQr(rrrryszLazyLoader.create_modulecCs@|j|j_|j|_i}|j��|d<|j|d<||j_t|_dS)NrXrY)r_r"rPrX�copyrYr\rW)rQr'r\rrrr` s

zLazyLoader.exec_moduleN)
rErmrn�staticmethodrv�classmethodrwrxryr`rrrrro
s

ro)N)N)!�r�
_bootstraprrrr�_bootstrap_externalrrr	r
rr�
contextlibrrrMr rZrArrr)r4r;rOrSrVr[rW�Loaderrorrrr�<module>s6

-
'/

?>