ok

Mini Shell

Direktori : /proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/modulefinder.cpython-37.opt-2.pyc

B

0��c�Y�	@sddlZddlZddlZddlZddlZddlZddlZddlZe�	��e�
de�ddlZWdQRXej
dZej
dZej
dZej
dZeefZejZiZdd�ZiZd	d
�ZGdd�d�ZGd
d�d�Zdd�Zedk�ry
e�ZWnek
�red�YnXdS)�N�ignore�
LOAD_CONST�IMPORT_NAME�
STORE_NAME�STORE_GLOBALcCst�|g��|�dS)N)�packagePathMap�
setdefault�append)Zpackagename�path�r�1/opt/alt/python37/lib64/python3.7/modulefinder.py�AddPackagePathsr
cCs|t|<dS)N)�replacePackageMap)Zoldname�newnamerrr�ReplacePackage*src@seZdZddd�Zdd�ZdS)�ModuleNcCs(||_||_||_d|_i|_i|_dS)N)�__name__�__file__�__path__�__code__�globalnames�starimports)�self�name�filer
rrr�__init__0szModule.__init__cCsLd|jf}|jdk	r&|d|jf}|jdk	r@|d|jf}|d}|S)Nz	Module(%rz, %r�))rrr)r�srrr�__repr__=s

zModule.__repr__)NN)r�
__module__�__qualname__rrrrrrr.s

rc@s�eZdZddggfdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zd6dd�Z	d7dd�Z
dd�Zdd�Zd8dd�Z
dd�Zdd�Zdd�Zd d!�Zd9d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd:d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS);�ModuleFinderNrcCsB|dkrtj}||_i|_i|_||_d|_||_||_g|_dS)Nr)	�sysr
�modules�
badmodules�debug�indent�excludes�
replace_paths�processed_paths)rr
r%r'r(rrrrHszModuleFinder.__init__cGs^||jkrZxt|j�D]}tddd�qWt|dd�x|D]}tt|�dd�q<Wt�dS)Nz   � )�end)r%�ranger&�print�repr)r�level�str�args�i�argrrr�msgTs

zModuleFinder.msgcGs,|d}||jkr(|jd|_|j|�dS)Nr�)r%r&r4)rr1r/rrr�msgin]s
zModuleFinder.msgincGs,|d}||jkr(|jd|_|j|�dS)Nrr5)r%r&r4)rr1r/rrr�msgoutcs
zModuleFinder.msgoutc	CsB|�dd|�t|��"}ddtjf}|�d|||�WdQRXdS)N��
run_script��r�__main__)r4�open�imp�	PY_SOURCE�load_module)r�pathname�fp�stuffrrrr9is
zModuleFinder.run_scriptc	CsTtj�|�\}}tj�|�\}}t|��"}|dtjf}|�||||�WdQRXdS)Nr;)�osr
�split�splitextr=r>r?r@)rrA�dirrZextrBrCrrr�	load_fileos

zModuleFinder.load_file���c	Cs\|�dd||||�|j||d�}|�||�\}}|�||�}|sF|S|jrX|�||�dS)N��import_hook)r/)r4�determine_parent�find_head_package�	load_tailr�ensure_fromlist)	rr�caller�fromlistr/�parent�q�tail�mrrrrKvszModuleFinder.import_hookcCs&|�dd||�|r|dkr,|�dd�dS|j}|dkr�|jrH|d8}|dkrl|j|}|�dd|�|S|�d�|kr�td��d�|�d�d|��}|j|}|�dd|�|S|jr�|j|}|�dd|�|Sd|k�r|�	d�}|d|�}|j|}|�dd|�|S|�dd�dS)	N�rLrzdetermine_parent -> Noner5zdetermine_parent ->�.zrelative importpath too deep)
r6r7rrr#�count�ImportError�joinrE�rfind)rrPr/ZpnamerRr2rrrrL�s<





zModuleFinder.determine_parentcCs�|�dd||�d|kr@|�d�}|d|�}||dd�}n|}d}|r\d|j|f}n|}|�|||�}|r�|�dd||f�||fS|r�|}d}|�|||�}|r�|�dd||f�||fS|�dd|�td	|��dS)
NrVrMrWr5r:z%s.%szfind_head_package ->z"raise ImportError: No module namedzNo module named )r6�findr�
import_moduler7rY)rrRrr2�headrTZqnamerSrrrrM�s.
zModuleFinder.find_head_packagecCs�|�dd||�|}xz|r�|�d�}|dkr4t|�}|d|�||dd�}}d|j|f}|�|||�}|s|�dd|�td|��qW|�dd	|�|S)
NrVrNrWrr5z%s.%sz"raise ImportError: No module namedzNo module named zload_tail ->)r6r\�lenrr]r7rY)rrSrTrUr2r^ZmnamerrrrN�s
zModuleFinder.load_tailcCs�|�dd|||�xl|D]d}|dkrF|s||�|�}|r||�||d�qt||�sd|j|f}|�|||�}|std|��qWdS)NrVrO�*r5z%s.%szNo module named )r4�find_all_submodulesrO�hasattrrr]rY)rrUrQ�	recursive�sub�all�subnameZsubmodrrrrO�s


zModuleFinder.ensure_fromlistc
	Cs�|js
dSi}g}|tjjdd�7}|tjjdd�7}|tjjdd�7}x�|jD]�}yt�|�}Wn$tk
r�|�	dd|�wVYnXx\|D]T}d}x6|D].}t
|�}	||	d�|kr�|d|	�}Pq�W|r�|dkr�|||<q�WqVW|��S)Nr8zcan't list directoryr)r�	importlib�	machinery�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXESrD�listdir�OSErrorr4r_�keys)
rrUr#�suffixesrG�namesr�modZsuff�nrrrra�s.

z ModuleFinder.find_all_submodulescCs|�dd|||�y|j|}Wntk
r4YnX|�dd|�|S||jkrb|�dd�dS|r�|jdkr�|�dd�dSy|�||o�|j|�\}}}Wn"tk
r�|�ddd�dSXz|�||||�}Wd|r�|�	�X|r�t
|||�|�dd|�|S)NrJr]zimport_module ->zimport_module -> None)r6r#�KeyErrorr7r$r�find_modulerYr@�close�setattr)rZpartname�fqnamerRrUrBrArCrrrr]�s6

zModuleFinder.import_modulec
Cs2|\}}}|�dd||od|�|tjkrH|�||�}|�dd|�|S|tjkrht|��d|d�}	n~|tjkr�y|��}
t	j
�|
|i�Wn:tk
r�}z|�ddt
|�|��Wdd}~XYnXt�t|
�dd��}	nd}	|�|�}||_|	�r |j�r|�|	�}	|	|_|�|	|�|�dd|�|S)	Nr8r@rBzload_module ->�
�execzraise ImportError: �)r6r>Z
PKG_DIRECTORY�load_packager7r?�compile�readZPY_COMPILEDrg�_bootstrap_external�
_classify_pycrYr0�marshal�loads�
memoryview�
add_modulerr(�replace_paths_in_coder�	scan_code)rrwrBrA�	file_info�suffix�mode�typerU�co�data�excrrrr@s4





zModuleFinder.load_modulecCs<||jkri|j|<|r*d|j||j<nd|j|d<dS)Nr5�-)r$r)rrrPrrr�_add_badmodule4s


zModuleFinder._add_badmodulecCs||jkr|�||�dSy|j|||d�Wn@tk
rn}z"|�ddt|��|�||�Wdd}~XYn�X|�rx�|D]�}||jkr�|�||�q|y|j|||g|d�Wq|tk
r�}z.|�ddt|��|d|}|�||�Wdd}~XYq|Xq|WdS)N)r/r8zImportError:rW)r$r�rKrYr4r0)rrrPrQr/r4rd�fullnamerrr�_safe_import_hook<s&


zModuleFinder._safe_import_hookccs�|j}|j}|j}dd�t�|�D�}x�t|�D]�\}\}}|tkrVd||ffVq0|tkr0|dkr0||dd||ddkr�tkr0nq0|||dd}	|||dd}
|	dkr�d|
||ffVq0d|	|
||ffVq0q0WdS)	NcSs"g|]\}}}|tkr||f�qSr)�EXTENDED_ARG)�.0�_�opr3rrr�
<listcomp>Xsz-ModuleFinder.scan_opcodes.<locals>.<listcomp>�storer8r5r�absolute_import�relative_import)	�co_code�co_names�	co_consts�disZ_unpack_opargs�	enumerate�	STORE_OPSrr)rr��coderp�constsZopargsr2r�Zopargr/rQrrr�scan_opcodesSs 0zModuleFinder.scan_opcodescCs�|j}|j}�xT||�D�]F\}}|dkr<|\}d|j|<q|dk�r|\}}d}	|dk	rtd|krfd}	dd�|D�}|j|||dd�|	�r`d}
|jr�|j�|jd	|�}
|
dkr�|j�|�}
|
dk	r�|j�|
j�|j	�|
j	�|
j
dkr�d|j	|<n
d|j	|<q|d
k�rX|\}}}|�r4|j||||d�n"|j||d�}|j|jd|dd�qt|��qWx,|j
D]"}
t|
t|���rl|�|
|��qlWdS)Nr�r5r�rr`cSsg|]}|dkr|�qS)r`r)r��frrrr�usz*ModuleFinder.scan_code.<locals>.<listcomp>)r/rWr�)r�r�rr�rr#�getr�updaterrrL�RuntimeErrorr��
isinstancer�r�)rr�rUr��scannerZwhatr1rrQZ	have_starZmmr/rR�crrrr�hsH



zModuleFinder.scan_codecCs�|�dd||�t�|�}|r"|}|�|�}||_|g|_|jt�|g�|_|�d|j�\}}}z"|�||||�|�	dd|�|S|r�|�
�XdS)Nr8r{rzload_package ->)r6rr�r�rrrrtr@r7ru)rrwrArrUrB�bufrCrrrr{�s

zModuleFinder.load_packagecCs*||jkr|j|St|�|j|<}|S)N)r#r)rrwrUrrrr��s

zModuleFinder.add_modulecCsr|dk	r|jd|}n|}||jkr<|�dd|�t|��|dkrf|tjkr`ddddtjffS|j}t�	||�S)NrWrJzfind_module -> Excludedr:)
rr'r7rYr"�builtin_module_namesr>Z	C_BUILTINr
rt)rrr
rRr�rrrrt�s

zModuleFinder.find_modulecCs"t�tdd�tdd�t|j���}xJ|D]B}|j|}|jrTtddd�ntddd�td||jppd	�q2W|��\}}|r�t�td
�x2|D]*}t|j|���}td|dd
�|��q�W|�rt�tddd�td�x2|D]*}t|j|���}td|dd
�|��q�WdS)Nz
  %-25s %s)�NameZFile)z----z----�Pr*)r+rUz%-25sr:zMissing modules:�?z
imported fromz, z7Submodules that appear to be missing, but could also bez#global names in the parent package:)	r-�sortedr#rnrr�any_missing_mayber$rZ)rrn�keyrU�missing�mayberZmodsrrr�report�s0



zModuleFinder.reportcCs|��\}}||S)N)r�)rr�r�rrr�any_missing�szModuleFinder.any_missingcCs�g}g}x�|jD]�}||jkr q|�d�}|dkr>|�|�q||dd�}|d|�}|j�|�}|dk	r�||j|kr�|�|�q�||jkr�q�|jr�|�|�q�|�|�q|�|�qW|��|��||fS)NrWrr5)	r$r'r[r	r#r�rr�sort)rr�r�rr2rfZpkgnameZpkgrrrr��s0	



zModuleFinder.any_missing_maybecCstj�|j�}}x2|jD](\}}|�|�r||t|�d�}PqW|jr�||jkr�||krt|�	dd||f�n|�	dd|f�|j�
|�t|j�}x8t
t|��D](}t||t|��r�|�||�||<q�Wt�|j|j|j|j|j|jt|�|j|j||j|j|j|j|j �S)Nr8zco_filename %r changed to %rz co_filename %r remains unchanged)!rDr
�normpath�co_filenamer(�
startswithr_r%r)r7r	�listr�r,r�r�r��types�CodeType�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksize�co_flagsr��tupler��co_varnames�co_name�co_firstlineno�	co_lnotab�co_freevars�co_cellvars)rr�Znew_filenameZoriginal_filenamer�r;r�r2rrrr�s,



z"ModuleFinder.replace_paths_in_code)NNrI)rI)r)rI)N)rrr rr4r6r7r9rHrKrLrMrNrOrar]r@r�r�r�r�r{r�rtr�r�r�r�rrrrr!Fs2	

#

1
".r!c
Cs�ddl}y|�tjdd�d�\}}Wn,|jk
rR}zt|�dSd}~XYnXd}d}g}g}xb|D]Z\}}	|dkr�|d}|dkr�d}|dkr�||	�tj�}|dkr�d}|dkrj|�|	�qjW|s�d	}
n|d}
tj	dd�}tj	�
|
�|d<||}|dk�r0td
�x|D]}tdt|���qWt|||�}
xp|dd�D]`}|dk�r`d}�qJ|�r�|dd�d
k�r�|
�
|dd�ddg�n
|
�
|�n
|
�|��qJW|
�|
�|
��|
S)Nrr5zdmp:qx:z-dz-mz-pz-qz-xzhello.pyzpath:z   ���z.*r`)�getoptr"�argv�errorr-rErD�pathsepr	r
�dirnamer.r!rKrHr9r�)r�Zoptsr1r4r%ZdomodsZaddpathZexclude�o�aZscriptr
�item�mfr3rrr�test:sX



r�r<z
[interrupted])r�Zimportlib._bootstrap_externalrgZimportlib.machineryr�rDr"r��warnings�catch_warnings�simplefilter�DeprecationWarningr>Zopmaprrrrr�r�rr
rrrr!r�rr��KeyboardInterruptr-rrrr�<module>s>




w;



Zerion Mini Shell 1.0