ok

Mini Shell

Direktori : /proc/self/root/usr/lib64/python2.7/
Upload File :
Current File : //proc/self/root/usr/lib64/python2.7/modulefinder.pyc

�
\цdc@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	e
ejd�r�dZndZe
ejjd��Ze
ejjd��Ze
ejjd	��Ze
ejjd
��ZeegZe
ej�ZiZd�ZiZd�Zd
fd��YZdfd��YZd�Zedkr�y
e�ZWnek
r�dGHnXndS(s3Find modules used by a script, using introspection.i����(t
generatorsNtnewlinestUtrt
LOAD_CONSTtIMPORT_NAMEt
STORE_NAMEtSTORE_GLOBALcCs-tj|g�}|j|�|t|<dS(N(tpackagePathMaptgettappend(tpackagenametpathtpaths((s$/usr/lib64/python2.7/modulefinder.pytAddPackagePath#s
cCs|t|<dS(N(treplacePackageMap(toldnametnewname((s$/usr/lib64/python2.7/modulefinder.pytReplacePackage/stModulecBs eZddd�Zd�ZRS(cCs:||_||_||_d|_i|_i|_dS(N(t__name__t__file__t__path__tNonet__code__tglobalnameststarimports(tselftnametfileR((s$/usr/lib64/python2.7/modulefinder.pyt__init__5s					cCsjd|jf}|jdk	r6|d|jf}n|jdk	r\|d|jf}n|d}|S(Ns	Module(%rs, %rt)(RRRR(Rts((s$/usr/lib64/python2.7/modulefinder.pyt__repr__Bs
N(Rt
__module__RRR!(((s$/usr/lib64/python2.7/modulefinder.pyR3s
tModuleFindercBseZddggd�Zd�Zd�Zd�Zd�Zd�Zdddd�Z	dd	�Z
d
�Zd�Zdd�Z
d
�Zd�Zd�Zd�Zdd�Zejd�Zejd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�ZRS(icCsd|dkrtj}n||_i|_i|_||_d|_||_||_g|_	dS(Ni(
RtsysRtmodulest
badmodulestdebugtindenttexcludest
replace_pathstprocessed_paths(RRR'R)R*((s$/usr/lib64/python2.7/modulefinder.pyRMs							cGsT||jkrPxt|j�D]
}dGqW|Gx|D]}t|�Gq8WHndS(Ns   (R'trangeR(trepr(Rtleveltstrtargstitarg((s$/usr/lib64/python2.7/modulefinder.pytmsgYs
cGs=|d}||jkr9|jd|_|j|�ndS(Nii(R'R(R3(RR0R.((s$/usr/lib64/python2.7/modulefinder.pytmsginbs
cGs=|d}||jkr9|jd|_|j|�ndS(Nii(R'R(R3(RR0R.((s$/usr/lib64/python2.7/modulefinder.pytmsgouths
cCsN|jdd|�t|t�}ddtjf}|jd|||�dS(Nit
run_scripttRt__main__(R3topent	READ_MODEtimpt	PY_SOURCEtload_module(Rtpathnametfptstuff((s$/usr/lib64/python2.7/modulefinder.pyR6nscCsktjj|�\}}tjj|�\}}t|t�}|dtjf}|j||||�dS(NR(	tosRtsplittsplitextR9R:R;R<R=(RR>tdirRtextR?R@((s$/usr/lib64/python2.7/modulefinder.pyt	load_filets
i����c	Cs�|jdd||||�|j|d|�}|j||�\}}|j||�}|se|S|jr�|j||�ndS(Nitimport_hookR.(R3tdetermine_parenttfind_head_packaget	load_tailRtensure_fromlistR(	RRtcallertfromlistR.tparenttqttailtm((s$/usr/lib64/python2.7/modulefinder.pyRG{s	cCs�|jdd||�|s)|dkr=|jdd�dS|j}|dkr|jrh|d8}n|dkr�|j|}||ks�t�|jdd|�|S|jd�|kr�td�ndj	|j
d�| �}|j|}|jdd|�|S|jrK|j|}||ks4t�|jdd|�|Sd|kr�|jd�}|| }|j|}|j|ks�t�|jdd|�|S|jdd�dS(	NiRHisdetermine_parent -> Noneisdetermine_parent ->t.srelative importpath too deep(R4R5RRRR%tAssertionErrortcounttImportErrortjoinRBtrfind(RRLR.tpnameRNR1((s$/usr/lib64/python2.7/modulefinder.pyRH�sB		


	


cCs/|jdd||�d|krL|jd�}|| }||d}n|}d}|rtd|j|f}n|}|j|||�}|r�|jdd||f�||fS|r|}d}|j|||�}|r|jdd||f�||fSn|jdd|�td	|�dS(
NiRIRRiR7s%s.%ssfind_head_package ->s"raise ImportError: No module namedsNo module named (R4tfindRt
import_moduleR5RRU(RRNRR1theadRPtqnameRO((s$/usr/lib64/python2.7/modulefinder.pyRI�s.


cCs�|jdd||�|}x�|r�|jd�}|dkrOt|�}n|| ||d}}d|j|f}|j|||�}|s|jdd|�td|�qqW|jdd	|�|S(
NiRJRRiis%s.%ss"raise ImportError: No module namedsNo module named sload_tail ->(R4RYtlenRRZR5RU(RRORPRQR1R[tmname((s$/usr/lib64/python2.7/modulefinder.pyRJ�s	cCs�|jdd|||�x�|D]�}|dkri|s�|j|�}|rf|j||d�qfq�q t||�s d|j|f}|j|||�}|s�td|�q�q q WdS(NiRKt*is%s.%ssNo module named (R3tfind_all_submodulesRKthasattrRRZRU(RRQRMt	recursivetsubtalltsubnametsubmod((s$/usr/lib64/python2.7/modulefinder.pyRK�s
cCs|js
dSi}g}x%tj�D]}|j|d�q&Wx�|jD]�}ytj|�}Wn*tjk
r�|jdd|�qKnXxp|D]h}d}x:|D]2}	t	|	�}
||
|	kr�||
 }Pq�q�W|r�|dkr�|||<q�q�WqKW|j
�S(Niiscan't list directoryR(RR;tget_suffixesR
RAtlistdirterrorR3RR]tkeys(RRQR%tsuffixesttripleRDtnamesRtmodtsufftn((s$/usr/lib64/python2.7/modulefinder.pyR`�s,	

cCsW|jdd|||�y|j|}Wntk
r=nX|jdd|�|S||jkrx|jdd�dS|r�|jdkr�|jdd�dSy+|j||o�|j|�\}}}Wn%tk
r�|jddd�dSXz|j	||||�}Wd|r&|j
�nX|r@t|||�n|jdd|�|S(NiRZsimport_module ->simport_module -> None(R4R%tKeyErrorR5R&RRtfind_moduleRUR=tclosetsetattr(RtpartnametfqnameRNRQR?R>R@((s$/usr/lib64/python2.7/modulefinder.pyRZ�s6
	"
c
Csr|\}}}|jdd||o'd|�|tjkrf|j||�}|jdd|�|S|tjkr�t|j�d|d�}	nr|tjkr|jd�tj	�kr�|jdd|�t
d	|�n|jd�tj|�}	nd}	|j|�}||_|	r[|jr?|j|	�}	n|	|_|j|	|�n|jdd|�|S(
NiR=R?sload_module ->s
texecis#raise ImportError: Bad magic numbersBad magic number in %s(R4R;t
PKG_DIRECTORYtload_packageR5R<tcompiletreadtPY_COMPILEDt	get_magicRUtmarshaltloadRt
add_moduleRR*treplace_paths_in_codeRt	scan_code(
RRvR?R>t	file_infotsuffixtmodettypeRQtco((s$/usr/lib64/python2.7/modulefinder.pyR=s0
			cCsQ||jkri|j|<n|r<d|j||j<nd|j|d<dS(Nit-(R&R(RRRL((s$/usr/lib64/python2.7/modulefinder.pyt_add_badmodule5s
cCs,||jkr#|j||�dSy|j||d|�Wn<tk
r{}|jddt|��|j||�n�X|r(x�|D]�}||jkr�|j||�q�ny |j|||gd|�Wq�tk
r }|jddt|��|d|}|j||�q�Xq�WndS(NR.isImportError:RR(R&R�RGRUR3R/(RRRLRMR.R3Rctfullname((s$/usr/lib64/python2.7/modulefinder.pyt_safe_import_hook=s&
 c
cs�|j}|j}|j}x�|r�|d}|tkru|d|dd!�\}d||ffV|d}qn|tkr�|dtkr�|d|d �\}}	d||||	ffV|d}qn|tkr�|d}q|d}qWdS(	Nis<Hiitstores<xHxHitimport(tco_codetco_namest	co_constst	STORE_OPSRRt
HAVE_ARGUMENT(
RR�tunpacktcodeRmtconststctopargtoparg_1toparg_2((s$/usr/lib64/python2.7/modulefinder.pytscan_opcodesTs$				



c
csi|j}|j}|j}ttt}x9|rd|d}|tkr�|d|dd!�\}d||ffV|d}q,n|ddd�|kr>|d|d �\}	}
}||	}|dkr�d	||
||ffVnD|dkrd
||
||ffVnd|||
||ffV|d}q,n|tkrW|d}q,|d}q,WdS(Nis<HiiR�i	s<xHxHxHi����R�tabsolute_importtrelative_import(R�R�R�RRR�R�(
RR�R�R�RmR�tLOAD_LOAD_AND_IMPORTR�R�R�R�toparg_3R.((s$/usr/lib64/python2.7/modulefinder.pytscan_opcodes_25ls0				




cCs�|j}tjd
kr$|j}n	|j}x||�D]\}}|dkrk|\}d|j|<q:|dkr�|\}}d}	|dk	r�d|kr�d}	ng|D]}
|
dkr�|
^q�}n|dkr�d}nd	}|j|||d
|�|	r@d}|jr;|j	j
|jd|�}n|dkr\|j	j
|�}n|dk	r�|jj|j�|j
j|j
�|jdkr�d|j
|<q�q�d|j
|<q@q:|dkr4|\}}}|r|j|||d
|�q@|j|d
|�}
|j|
jd|d
d�q:t|��q:Wx9|jD].}t|t|��rN|j||�qNqNWdS(NiiR�iR�R�iR_i����R.RRR�(ii(simportsabsolute_import(R�R$tversion_infoR�R�RRR�RR%R	RtupdateRRRHtRuntimeErrorR�t
isinstanceR�R�(RR�RQR�tscannertwhatR0RRMt	have_startfR.tmmRNR�((s$/usr/lib64/python2.7/modulefinder.pyR��sR				(		 cCs�|jdd||�tj|�}|r4|}n|j|�}||_|g|_|jtj|g�|_|jd|j�\}}}|j||||�|j	dd|�|S(NiRyRsload_package ->(
R4RR	R�RRRRrR=R5(RRvR>RRQR?tbufR@((s$/usr/lib64/python2.7/modulefinder.pyRy�s		cCs5||jkr|j|St|�|j|<}|S(N(R%R(RRvRQ((s$/usr/lib64/python2.7/modulefinder.pyR��scCs�|dk	r |jd|}n|}||jkrT|jdd|�t|�n|dkr�|tjkr�ddddtjffS|j	}ntj
||�S(NRRisfind_module -> ExcludedR7(RRR)R5RUR$tbuiltin_module_namesR;t	C_BUILTINRRr(RRRRNR�((s$/usr/lib64/python2.7/modulefinder.pyRr�scCs<HddGHddGH|jj�}|j�xE|D]=}|j|}|jrVdGndGd|G|jpndGHq3W|j�\}}|r�Hd	GHxH|D]=}|j|j�}|j�d
G|GdGdj|�GHq�Wn|r8Hd
GdGHxH|D]=}|j|j�}|j�d
G|GdGdj|�GHq�WndS(s�Print a report to stdout, listing the found modules with their
        paths, as well as modules that are missing, or seem to be missing.
        s
  %-25s %stNametFiles----tPRQs%-25sR7sMissing modules:t?s
imported froms, s7Submodules thay appear to be missing, but could also bes#global names in the parent package:N(R�R�(s----s----(R%RjtsortRRtany_missing_maybeR&RV(RRjtkeyRQtmissingtmaybeRtmods((s$/usr/lib64/python2.7/modulefinder.pytreport�s6		


	

!

cCs|j�\}}||S(s�Return a list of modules that appear to be missing. Use
        any_missing_maybe() if you want to know which modules are
        certain to be missing, and which *may* be missing.
        (R�(RR�R�((s$/usr/lib64/python2.7/modulefinder.pytany_missingscCs"g}g}x�|jD]�}||jkr1qn|jd�}|dkr_|j|�qn||d}|| }|jj|�}|dk	r�||j|kr�|j|�q||jkr�q|jr�|j|�q|j|�q|j|�qW|j	�|j	�||fS(s�Return two lists, one with modules that are certainly missing
        and one with modules that *may* be missing. The latter names could
        either be submodules *or* just global names in the package.

        The reason it can't always be determined is that it's impossible to
        tell which names are imported when "from module import *" is done
        with an extension module, short of actually importing it.
        RRiiN(
R&R)RWR
R%R	RRRR�(RR�R�RR1Retpkgnametpkg((s$/usr/lib64/python2.7/modulefinder.pyR�s0	

	

cCs�tjj|j�}}x>|jD]3\}}|j|�r#||t|�}Pq#q#W|jr�||jkr�||kr�|j	dd||f�n|j	dd|f�|jj
|�nt|j�}xMt
t|��D]9}t||t|��r�|j||�||<q�q�Wtj|j|j|j|j|jt|�|j|j||j|j|j|j|j�S(Nisco_filename %r changed to %rs co_filename %r remains unchanged( RARtnormpathtco_filenameR*t
startswithR]R'R+R5R
tlistR�R,R�R�R�ttypestCodeTypetco_argcountt
co_nlocalstco_stacksizetco_flagsR�ttupleR�tco_varnamestco_nametco_firstlinenot	co_lnotabtco_freevarstco_cellvars(RR�tnew_filenametoriginal_filenameR�RR�R1((s$/usr/lib64/python2.7/modulefinder.pyR�Ds*N(RR"RRR3R4R5R6RFRGRHRIRJRKR`RZR=R�R�tstructR�R�R�R�RyR�RrR�R�R�R�(((s$/usr/lib64/python2.7/modulefinder.pyR#Ks4						#							6			%		.cCs"ddl}y#|jtjdd�\}}Wn|jk
rM}|GHdSXd}d}g}g}x�|D]�\}}	|dkr�|d}n|dkr�d}n|dkr�||	jtj�}n|dkr�d}n|d	krm|j|	�qmqmW|sd
}
n
|d}
tj}tjj	|
�|d<||}|dkrxdGHx |D]}dGt
|�GHq\Wnt|||�}
xz|dD]n}|dkr�d}q�n|r�|d
dkr�|
j|d
 ddg�q|
j|�q�|
j|�q�W|
j|
�|
j�|
S(Ni����isdmp:qx:is-ds-ms-ps-qs-xshello.pyspath:s   i����s.*R_(tgetoptR$targvRiRBRAtpathsepR
RtdirnameR-R#RGRRFR6R�(R�toptsR0R3R'tdomodstaddpathtexcludetotatscriptRtitemtmfR2((s$/usr/lib64/python2.7/modulefinder.pyttest`sX#
			





R8s
[interrupt]( t__doc__t
__future__RtdisR;R~RAR$R�R�Rat
__stdout__R:tchrtopnametindexRRRRR�R�RRRRRR#R�RR�tKeyboardInterrupt(((s$/usr/lib64/python2.7/modulefinder.pyt<module>s>			��	;



Zerion Mini Shell 1.0