Your IP : 18.189.143.150


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

o

6��fQ_�@s	ddlZddlZddlZddlZddlZddlZddlZejdZ	ejdZ
ejdZejdZeefZ
ejZdZdZdZdZd	Zd
ZdZiZdd
�ZiZdd�Zddd�ZGdd�d�ZGdd�d�Zdd�Zedkr�ze�ZWdSe y�e!d�YdSwdS)�N�
LOAD_CONST�IMPORT_NAME�
STORE_NAME�STORE_GLOBAL������cCst�|g��|�dS�N)�packagePathMap�
setdefault�append)Zpackagename�path�r�3/opt/alt/python310/lib64/python3.10/modulefinder.py�AddPackagePath&srcCs|t|<dSr)�replacePackageMap)Zoldname�newnamerrr�ReplacePackage1srcCs	tjj��tjj�||�}|durtdj|d�|d��|jtjjur,ddddt	ffS|jtjj
ur;ddddtffS|j}|j�
|�rPdtj�|�ddtffSt|jtjj�r[t}nt|jtjj�rft}nt|jtjj�rqt}nddddtffSt�|�}tj�|�d}|||d|ffS)NzNo module named {name!r})�name�����rb)�	importlib�	machinery�
PathFinder�invalidate_caches�	find_spec�ImportError�format�loader�BuiltinImporter�
_C_BUILTIN�FrozenImporter�
_PY_FROZEN�origin�
is_package�osr�dirname�_PKG_DIRECTORY�
isinstance�SourceFileLoader�
_PY_SOURCE�ExtensionFileLoader�_C_EXTENSION�SourcelessFileLoader�_PY_COMPILED�
_SEARCH_ERROR�io�	open_code�splitext)rr�specZ	file_path�kind�file�suffixrrr�_find_module5s,
r;c@seZdZddd�Zdd�ZdS)�ModuleNcCs(||_||_||_d|_i|_i|_dSr)�__name__�__file__�__path__�__code__�globalnames�starimports)�selfrr9rrrr�__init__ds
zModule.__init__cCsLd|jf}|jdur|d|jf}|jdur |d|jf}|d}|S)Nz	Module(%rz, %r�))r=r>r?)rC�srrr�__repr__qs

zModule.__repr__)NN)r=�
__module__�__qualname__rDrGrrrrr<bs

r<c@s�eZdZd6dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zd7dd�Z	d8dd�Z
dd�Zdd�Zd9dd�Z
dd�Zdd�Zdd�Zd d!�Zd8d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd:d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS);�ModuleFinderNrcCsZ|durtj}||_i|_i|_||_d|_|dur|ng|_|dur%|ng|_g|_dS)Nr)	�sysr�modules�
badmodules�debug�indent�excludes�
replace_paths�processed_paths)rCrrNrPrQrrrrD|s
zModuleFinder.__init__cGsZ||jkr+t|j�D]}tddd�q
t|dd�|D]
}tt|�dd�qt�dSdS)N�   � ��end)rN�rangerO�print�repr)rC�level�str�args�i�argrrr�msg�s

�zModuleFinder.msgcGs0|d}||jkr|jd|_|j|�dSdS�Nrr�rNrOr_�rCr\rZrrr�msgin��

�zModuleFinder.msgincGs0|d}||jkr|jd|_|j|�dSdSr`rarbrrr�msgout�rdzModuleFinder.msgoutcCsX|�dd|�t�|��}ddtf}|�d|||�Wd�dS1s%wYdS)Nr�
run_scriptrr�__main__)r_r4r5r.�load_module)rC�pathname�fp�stuffrrrrf�s

"�zModuleFinder.run_scriptcCsjtj�|�\}}tj�|�\}}t�|��}|dtf}|�||||�Wd�dS1s.wYdS)Nr)r)r�splitr6r4r5r.rh)rCri�dirrZextrjrkrrr�	load_file�s
"�zModuleFinder.load_filerc	Cs\|�dd||||�|j||d�}|�||�\}}|�||�}|s#|S|jr,|�||�dS)Nr�import_hook�rZ)r_�determine_parent�find_head_package�	load_tailr?�ensure_fromlist)	rCr�caller�fromlistrZ�parent�q�tail�mrrrro�szModuleFinder.import_hookcCs$|�dd||�|r|dkr|�dd�dS|j}|dkr\|jr$|d8}|dkr6|j|}|�dd|�|S|�d�|krAtd��d�|�d�d|��}|j|}|�dd|�|S|jrm|j|}|�dd|�|Sd|vr�|�	d�}|d|�}|j|}|�dd|�|S|�dd�dS)	N�rqrzdetermine_parent -> Nonerzdetermine_parent ->�.zrelative importpath too deep)
rcrer=r?rL�countr �joinrl�rfind)rCrurZZpnamerwr]rrrrq�s<




zModuleFinder.determine_parentcCs�|�dd||�d|vr |�d�}|d|�}||dd�}n|}d}|r.d|j|f}n|}|�|||�}|rF|�dd||f�||fS|rb|}d}|�|||�}|rb|�dd||f�||fS|�dd|�td	|��)
Nr{rrr|rr�%s.%szfind_head_package ->�"raise ImportError: No module named�No module named )rc�findr=�
import_modulerer )rCrwrr]�headryZqnamerxrrrrr�s.
zModuleFinder.find_head_packagecCs�|�dd||�|}|rG|�d�}|dkrt|�}|d|�||dd�}}d|j|f}|�|||�}|sE|�dd|�td|��|s|�dd	|�|S)
Nr{rsr|rrr�r�r�zload_tail ->)rcr��lenr=r�rer )rCrxryrzr]r�Zmnamerrrrs�s
�	zModuleFinder.load_tailcCs�|�dd|||�|D]2}|dkr"|s!|�|�}|r!|�||d�qt||�s=d|j|f}|�|||�}|s=td|��qdS)Nr{rt�*rr�r�)r_�find_all_submodulesrt�hasattrr=r�r )rCrzrv�	recursive�sub�all�subnameZsubmodrrrrts
�
��zModuleFinder.ensure_fromlistc
	Cs�|jsdSi}g}|tjjdd�7}|tjjdd�7}|tjjdd�7}|jD]F}zt�|�}WntyC|�	dd|�Yq*w|D])}d}|D]}t
|�}	||	d�|krd|d|	�}nqL|ro|dkro|||<qFq*|��S)Nrzcan't list directoryrD)r?rr�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXESr)�listdir�OSErrorr_r��keys)
rCrzrL�suffixesrm�namesr�modZsuff�nrrrr�s6
����	z ModuleFinder.find_all_submodulescCs|�dd|||�z|j|}Wn	tyYn
w|�dd|�|S||jvr0|�dd�dS|r?|jdur?|�dd�dSz|�||oG|j|�\}}}Wnty_|�ddd�YdSwz|�||||�}W|rp|�	�n|rx|�	�ww|r�t
|||�|�dd|�|S)Nrr�zimport_module ->zimport_module -> None)rcrL�KeyErrorrerMr?�find_moduler rh�close�setattr)rCZpartname�fqnamerwrzrjrirkrrrr�,sD�

����
�zModuleFinder.import_modulec
Cs|\}}}|�dd||o
d|�|tkr#|�||�}|�dd|�|S|tkr0t|��|d�}	n9|tkrgz|��}
tj	�
|
|i�WntyZ}z|�ddt|�|��d}~wwt
�t|
�dd��}	nd}	|�|�}||_|	r�|jr{|�|	�}	|	|_|�|	|�|�dd|�|S)Nrrhrjzload_module ->�execzraise ImportError: �)rcr+�load_packagerer.�compile�readr2r�_bootstrap_external�
_classify_pycr r[�marshal�loads�
memoryview�
add_moduler>rQ�replace_paths_in_coder@�	scan_code)rCr�rjri�	file_infor:�mode�typerz�co�data�excrrrrhLs8
��

zModuleFinder.load_modulecCs>||jvr
i|j|<|rd|j||j<dSd|j|d<dS)Nr�-)rMr=)rCrrurrr�_add_badmoduleis


zModuleFinder._add_badmodulecCsJ||jvr
|�||�dSz
|j|||d�WnCty9}z|�ddt|��|�||�WYd}~dSd}~wtyZ}z|�ddt|��|�||�WYd}~dSd}~ww|r�|D]C}|d|}||jvrs|�||�q_z|j|||g|d�Wq_ty�}z|�ddt|��|�||�WYd}~q_d}~wwdSdS)NrprzImportError:zSyntaxError:r|)rMr�ror r_r[�SyntaxError)rCrrurvrZr_r��fullnamerrr�_safe_import_hookqs:
���
���zModuleFinder._safe_import_hookccs��|j}|j}|j}dd�t�|�D�}t|�D]`\}\}}|tvr+d||ffVq|tkrx|dkrx||dd||ddkrItkrxnq|||dd}	|||dd}
|	dkrmd|
||ffVn
d|	|
||ffVqqdS)	NcSs"g|]
\}}}|tkr||f�qSr)�EXTENDED_ARG)�.0�_�opr^rrr�
<listcomp>�s�z-ModuleFinder.scan_opcodes.<locals>.<listcomp>�storerrr�absolute_import�relative_import)	�co_code�co_names�	co_consts�disZ_unpack_opargs�	enumerate�	STORE_OPSrr)rCr��coder��constsZopargsr]r�ZopargrZrvrrr�scan_opcodes�s&�0��zModuleFinder.scan_opcodescCs||j}|j}||�D]�\}}|dkr|\}d|j|<q
|dkr~|\}}d}	|dur6d|vr/d}	dd�|D�}|j|||dd�|	r}d}
|jrQ|j�|jd	|�}
|
dur[|j�|�}
|
durx|j�|
j�|j	�|
j	�|
j
durwd|j	|<q
d|j	|<q
|d
kr�|\}}}|r�|j||||d�q
|j||d�}|j|jd|dd�q
t|��|j
D]}
t|
t|��r�|�|
|�q�dS)Nr�rr�rr�cSsg|]}|dkr|�qS)r�r)r��frrrr��sz*ModuleFinder.scan_code.<locals>.<listcomp>rpr|r�)r�r�rAr�r?rL�getr=�updaterBr@rq�RuntimeErrorr�r,r�r�)rCr�rzr��scannerZwhatr\rrvZ	have_starZmmrZrw�crrrr��sP

�
�

��zModuleFinder.scan_codecCs�|�dd||�t�|�}|r|}|�|�}||_|g|_|jt�|g�|_|�d|j�\}}}z|�||||�|�	dd|�|W|rJ|�
�SS|rR|�
�ww)Nrr�rDzload_package ->)rcrr�r�r>r?r
r�rhrer�)rCr�rirrzrjZbufrkrrrr��s$


�
�zModuleFinder.load_packagecCs*||jvr
|j|St|�|j|<}|Sr)rLr<)rCr�rzrrrr��s

zModuleFinder.add_modulecCsn|dur|jd|}n|}||jvr|�dd|�t|��|dur2|tjvr/ddddtffS|j}t||�S)Nr|rzfind_module -> Excludedr)	r=rPrer rK�builtin_module_namesr$rr;)rCrrrwr�rrrr��s


zModuleFinder.find_modulecCs	t�tdd�tdd�t|j���}|D]!}|j|}|jr*tddd�ntddd�td||jp8d	�q|��\}}|rbt�td
�|D]}t|j|���}td|dd
�|��qL|r�t�tddd�td�|D]}t|j|���}td|dd
�|��qsdSdS)Nz
  %-25s %s)�NameZFile)�----r��PrTrUrzz%-25srzMissing modules:�?z
imported fromz, z7Submodules that appear to be missing, but could also bez#global names in the parent package:)	rX�sortedrLr�r?r>�any_missing_mayberMr~)rCr��keyrz�missing�mayberZmodsrrr�report�s6
�zModuleFinder.reportcCs	|��\}}||Sr)r�)rCr�r�rrr�any_missing szModuleFinder.any_missingcCs�	g}g}|jD]V}||jvrq|�d�}|dkr|�|�q||dd�}|d|�}|j�|�}|durY||j|vrD|�|�q||jvrJq|jrS|�|�q|�|�q|�|�q|��|��||fS)Nr|rr)	rMrPrrrLr�rArB�sort)rCr�r�rr]r�ZpkgnameZpkgrrrr�(s2




zModuleFinder.any_missing_maybecCs�tj�|j�}}|jD]\}}|�|�r!||t|�d�}nq|jrH||jvrH||kr9|�	dd||f�n	|�	dd|f�|j�
|�t|j�}t
t|��D]}t||t|��rg|�||�||<qS|jt|�|d�S)Nrzco_filename %r changed to %rz co_filename %r remains unchanged)r��co_filename)r)r�normpathr�rQ�
startswithr�rNrRrer�listr�rWr,r�r��replace�tuple)rCr�Znew_filenameZoriginal_filenamer��rr�r]rrrr�Vs*
���
�z"ModuleFinder.replace_paths_in_code)NrNN)NNr)r)rr)r=rHrIrDr_rcrerfrnrorqrrrsrtr�r�rhr�r�r�r�r�r�r�r�r�r�r�rrrrrJzs4
	

#
 
1
".rJc
Cs�ddl}z|�tjdd�d�\}}Wn|jy+}zt|�WYd}~dSd}~wwd}d}g}g}|D]-\}}	|dkrB|d}|dkrHd}|dkrT||	�tj�}|dkrZd}|dkrc|�|	�q6|sid	}
n|d}
tj	dd�}tj	�
|
�|d<||}|dkr�td
�|D]	}tdt|��q�t|||�}
|dd�D]+}|dkr�d}q�|r�|dd�d
kr�|
�
|dd�ddg�q�|
�
|�q�|
�|�q�|
�|
�|
��|
S)Nrrzdmp:qx:z-dz-mz-pz-qz-xzhello.pyzpath:rS���z.*r�)�getoptrK�argv�errorrXrlr)�pathseprrr*rYrJrornrfr�)r�Zoptsr\r_rNZdomodsZaddpathZexclude�o�aZscriptr�item�mfr^rrr�testns^��
�
r�rgz
[interrupted]r)"r�Zimportlib._bootstrap_externalr�importlib.machineryr�r)r4rKZopmaprrrrr�r�r3r.r2r0r+r$r&r
rrrr;r<rJr�r=r��KeyboardInterruptrXrrrr�<module>sN




-w;��

?>