Hacked By AnonymousFox

Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/modulefinder.pyo

�
zfc@sldZddlmZddlZddlZddlZddlZddlZddlZddl	Z	e
ejd�r�dZndZej
dZej
dZej
d	Zej
d
ZeefZejZejZd�ZiZd�ZiZd
�Zdfd��YZdfd��YZd�Zedkrhy
e�ZWnek
rddGHnXndS(s3Find modules used by a script, using introspection.i����(t
generatorsNtnewlinestUtrt
LOAD_CONSTtIMPORT_NAMEt
STORE_NAMEtSTORE_GLOBALccs�d}t|�}d}x�||kr�t||�}|}|d}d}|tkr�t||�t||d�d|}d}|d}|tkr�|d}q�n|||fVqWdS(Niiiii(tlentordtNonet
HAVE_ARGUMENTtEXTENDED_ARG(tcodetextended_argtntitoptoffsettarg((s$/usr/lib64/python2.7/modulefinder.pyt_unpack_opargss
*
cCs-tj|g�}|j|�|t|<dS(N(tpackagePathMaptgettappend(tpackagenametpathtpaths((s$/usr/lib64/python2.7/modulefinder.pytAddPackagePath6s
cCs|t|<dS(N(treplacePackageMap(toldnametnewname((s$/usr/lib64/python2.7/modulefinder.pytReplacePackageBstModulecBs eZddd�Zd�ZRS(cCs:||_||_||_d|_i|_i|_dS(N(t__name__t__file__t__path__R
t__code__tglobalnameststarimports(tselftnametfileR((s$/usr/lib64/python2.7/modulefinder.pyt__init__Hs					cCsjd|jf}|jdk	r6|d|jf}n|jdk	r\|d|jf}n|d}|S(Ns	Module(%rs, %rt)(R!R"R
R#(R'ts((s$/usr/lib64/python2.7/modulefinder.pyt__repr__Us
N(R!t
__module__R
R*R-(((s$/usr/lib64/python2.7/modulefinder.pyR Fs
tModuleFindercBseZddggd�Zd�Zd�Zd�Zd�Zd�Zdddd�Z	dd	�Z
d
�Zd�Zdd�Z
d
�Zd�Zd�Zd�Zdd�Zejd�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�ZRS(icCsd|dkrtj}n||_i|_i|_||_d|_||_||_g|_	dS(Ni(
R
tsysRtmodulest
badmodulestdebugtindenttexcludest
replace_pathstprocessed_paths(R'RR3R5R6((s$/usr/lib64/python2.7/modulefinder.pyR*`s							cGsT||jkrPxt|j�D]
}dGqW|Gx|D]}t|�Gq8WHndS(Ns   (R3trangeR4trepr(R'tleveltstrtargsRR((s$/usr/lib64/python2.7/modulefinder.pytmsgls
cGs=|d}||jkr9|jd|_|j|�ndS(Nii(R3R4R=(R'R<R:((s$/usr/lib64/python2.7/modulefinder.pytmsginus
cGs=|d}||jkr9|jd|_|j|�ndS(Nii(R3R4R=(R'R<R:((s$/usr/lib64/python2.7/modulefinder.pytmsgout{s
c	CsW|jdd|�t|t��/}ddtjf}|jd|||�WdQXdS(Nit
run_scripttRt__main__(R=topent	READ_MODEtimpt	PY_SOURCEtload_module(R'tpathnametfptstuff((s$/usr/lib64/python2.7/modulefinder.pyR@�sc	Csttjj|�\}}tjj|�\}}t|t��/}|dtjf}|j||||�WdQXdS(NR(	tosRtsplittsplitextRCRDRERFRG(R'RHtdirR(textRIRJ((s$/usr/lib64/python2.7/modulefinder.pyt	load_file�s
i����c	Cs�|jdd||||�|j|d|�}|j||�\}}|j||�}|se|S|jr�|j||�ndS(Nitimport_hookR:(R=tdetermine_parenttfind_head_packaget	load_tailR#tensure_fromlistR
(	R'R(tcallertfromlistR:tparenttqttailtm((s$/usr/lib64/python2.7/modulefinder.pyRQ�s	cCs�|jdd||�|s)|dkr=|jdd�dS|j}|dkr�|jrh|d8}n|dkr�|j|}|jdd|�|S|jd�|kr�td�ndj|j	d�| �}|j|}|jdd|�|S|jr'|j|}|jdd|�|Sd|krp|j
d�}|| }|j|}|jdd|�|S|jdd�dS(	NiRRisdetermine_parent -> Noneisdetermine_parent ->t.srelative importpath too deep(R>R?R
R!R#R1tcounttImportErrortjoinRLtrfind(R'RVR:tpnameRXR((s$/usr/lib64/python2.7/modulefinder.pyRR�s<		


	


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(
NiRSR\iRAs%s.%ssfind_head_package ->s"raise ImportError: No module namedsNo module named (R>tfindR!t
import_moduleR?R
R^(R'RXR(RtheadRZtqnameRY((s$/usr/lib64/python2.7/modulefinder.pyRS�s.


cCs�|jdd||�|}x�|r�|jd�}|dkrOt|�}n|| ||d}}d|j|f}|j|||�}|s|jdd|�td|�qqW|jdd	|�|S(
NiRTR\iis%s.%ss"raise ImportError: No module namedsNo module named sload_tail ->(R>RbRR!RcR?R^(R'RYRZR[RRdtmname((s$/usr/lib64/python2.7/modulefinder.pyRT�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(NiRUt*is%s.%ssNo module named (R=tfind_all_submodulesRUthasattrR!RcR^(R'R[RWt	recursivetsubtalltsubnametsubmod((s$/usr/lib64/python2.7/modulefinder.pyRU�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*(R#REtget_suffixesRRKtlistdirterrorR=R
Rtkeys(R'R[R1tsuffixesttripleRNtnamesR(tmodtsuffR((s$/usr/lib64/python2.7/modulefinder.pyRh�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(NiRcsimport_module ->simport_module -> None(R>R1tKeyErrorR?R2R
R#tfind_moduleR^RGtclosetsetattr(R'tpartnametfqnameRXR[RIRHRJ((s$/usr/lib64/python2.7/modulefinder.pyRcs6
	"
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(
NiRGRIsload_module ->s
texecis#raise ImportError: Bad magic numbersBad magic number in %s(R>REt
PKG_DIRECTORYtload_packageR?RFtcompiletreadtPY_COMPILEDt	get_magicR^tmarshaltloadR
t
add_moduleR"R6treplace_paths_in_codeR$t	scan_code(
R'R}RIRHt	file_infotsuffixtmodettypeR[tco((s$/usr/lib64/python2.7/modulefinder.pyRG-s0
			cCsQ||jkri|j|<n|r<d|j||j<nd|j|d<dS(Nit-(R2R!(R'R(RV((s$/usr/lib64/python2.7/modulefinder.pyt_add_badmoduleHs
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:R\(R2R�RQR^R=R;(R'R(RVRWR:R=Rktfullname((s$/usr/lib64/python2.7/modulefinder.pyt_safe_import_hookPs&
 c
cs|j}|j}|j}gt|�D]'\}}}|tkr(||f^q(}	x�t|	�D]�\}
\}}ttkr�d||ffVqbn|tkrb|
dkrb|	|
ddt	krb||	|
dd}d|||ffVqbqbqbWdS(Ntstoreiitimport(
tco_codetco_namest	co_constsRRt	enumeratetct	STORE_OPSRR(
R'R�tunpackR
Rutconstst_RRtopargsRtopargRW((s$/usr/lib64/python2.7/modulefinder.pytscan_opcodesgs			c
cs~|j}|j}|j}gt|�D]'\}}}|tkr(||f^q(}x"t|�D]\}	\}}
|tkr�d||
ffVqbn|tkrb|	dkrb||	dd||	ddko�tknrb|||	dd}|||	dd}|dkr4d|||
ffVqb|dkrXd|||
ffVqbd||||
ffVqbqbqbWdS(	NR�iiii����R�tabsolute_importtrelative_import(	R�R�R�RRR�R�RR(
R'R�R
RuR�R�RRR�RR�R:RW((s$/usr/lib64/python2.7/modulefinder.pytscan_opcodes_25zs&			4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�iRgi����R:R\R�(ii(R�R�(R�R0tversion_infoR�R�R%R
R�R#R1RR!tupdateR&R$RRtRuntimeErrorR�t
isinstanceR�R�(R'R�R[R
tscannertwhatR<R(RWt	have_startfR:tmmRXR�((s$/usr/lib64/python2.7/modulefinder.pyR��sR				(		 cCs�|jdd||�tj|�}|r4|}n|j|�}||_|g|_|jtj|g�|_|jd|j�\}}}|j||||�|j	dd|�|r�|j
�n|S(NiR�R*sload_package ->(R>RRR�R"R#RRyRGR?Rz(R'R}RHRR[RItbufRJ((s$/usr/lib64/python2.7/modulefinder.pyR��s		
cCs5||jkr|j|St|�|j|<}|S(N(R1R (R'R}R[((s$/usr/lib64/python2.7/modulefinder.pyR��scCs�|dk	r |jd|}n|}||jkrT|jdd|�t|�n|dkr�|tjkr�ddddtjffS|j	}ntj
||�S(NR\isfind_module -> ExcludedRA(R
R!R5R?R^R0tbuiltin_module_namesREt	C_BUILTINRRy(R'R(RRXR�((s$/usr/lib64/python2.7/modulefinder.pyRy�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----tPR[s%-25sRAsMissing modules:t?s
imported froms, s7Submodules that appear to be missing, but could also bes#global names in the parent package:N(R�R�(s----s----(R1RrtsortR#R"tany_missing_maybeR2R_(R'RrtkeyR[tmissingtmaybeR(tmods((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�(R'R�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.
        R\iiN(
R2R5R`RR1RR
R%R&R�(R'R�R�R(RRmtpkgnametpkg((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( RKRtnormpathtco_filenameR6t
startswithRR3R7R?RtlistR�R8R�R�R�ttypestCodeTypetco_argcountt
co_nlocalstco_stacksizetco_flagsR�ttupleR�tco_varnamestco_nametco_firstlinenot	co_lnotabtco_freevarstco_cellvars(R'R�tnew_filenametoriginal_filenameR�RR�R((s$/usr/lib64/python2.7/modulefinder.pyR�Ls*N(R!R.R
R*R=R>R?R@RPRQRRRSRTRURhRcRGR�R�tstructR�R�R�R�R�R�RyR�R�R�R�(((s$/usr/lib64/python2.7/modulefinder.pyR/^s4						#								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.*Rg(tgetoptR0targvRqRLRKtpathsepRRtdirnameR9R/RQR
RPR@R�(R�toptsR<R=R3tdomodstaddpathtexcludetotatscriptRtitemtmfR((s$/usr/lib64/python2.7/modulefinder.pyttesthsX#
			





RBs
[interrupt]( t__doc__t
__future__RtdisRER�RKR0R�R�Rit
__stdout__RDtopmapRRRRR�RRRRRRRR R/R�R!R�tKeyboardInterrupt(((s$/usr/lib64/python2.7/modulefinder.pyt<module>sB	



					��	;



Hacked By AnonymousFox1.0, Coded By AnonymousFox