ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/proc/self/root/proc/thread-self/root/lib64/python2.7/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/self/root/proc/thread-self/root/lib64/python2.7/imputil.pyc

�
\цdc@sZdZddlmZeddd�[ddlZddlZddlZddlZddlZddd	gZe	d
�Z
e	e�Zddd��YZddd��YZ
er�d
p�dZdeZd�Zdaad�Zd�Zd�Zd	e
fd��YZde
fd��YZd�Zddd��YZd�Zd�ZdS(s
Import utilities

Exported classes:
    ImportManager   Manage the import process

    Importer        Base class for replacing standard import functions
    BuiltinImporter Emulate the import mechanism for builtin and frozen modules

    DynLoadSuffixImporter
i����(twarnpy3ks1the imputil module has been removed in Python 3.0t
stackleveliNt
ImportManagertImportertBuiltinImportertcBsqeZdZee�d�Zd�Zd�Zd	Z	d	d�Z
d	d	d	d�Zd�Zd�Z
d�ZRS(
sManage the import process.cCsEt|t�rt|�}n|d|_||_|j|d<dS(s8Install this ImportManager into the specified namespace.t
__import__N(t
isinstancet_ModuleTypetvarstprevious_importert	namespacet_import_hook(tselfR((s/usr/lib64/python2.7/imputil.pytinstall!s

	cCs|j|jd<dS(s&Restore the previous import mechanism.RN(R
R(R
((s/usr/lib64/python2.7/imputil.pyt	uninstall1scCs,t|d�st�|jj||�dS(Nt__call__(thasattrtAssertionErrortfs_impt
add_suffix(R
tsuffixt
importFunc((s/usr/lib64/python2.7/imputil.pyR5scCs�tst�n|dkr7|jp(t}|�}n||_xGtj�D]9}|dtjkrM|j	|dt
|�j�qMqMW|j	dt�dS(Niis.py(
t_os_statt
_os_bootstraptNonetclsFilesystemImportert_FilesystemImporterRtimptget_suffixestC_EXTENSIONRtDynLoadSuffixImportertimport_filetpy_suffix_importer(R
Rtclstdesc((s/usr/lib64/python2.7/imputil.pyt__init__@s
	
c
CsS|jd�}|j|�}|rI|jj|||�}|rI|Snytj|d}Wn:tk
r�|j|d�}|s�td|�q�nXt	|�dkr�|s�|S|j
jd�s�|Sn|j
jd�}	|	r�|	j||d|�St	|�dkrBt
||d�rB|r;t||d�S|Sntd|�dS(	s5Python calls this hook to locate and import a module.t.isNo module named it	__ispkg__t__importer__iN(tsplitt_determine_import_contextR't
_do_importtsystmodulestKeyErrort_import_top_moduletImportErrortlent__dict__tgett_finish_importRtgetattr(
R
tfqnametglobalstlocalstfromlisttpartstparenttmodulet
top_moduletimporter((s/usr/lib64/python2.7/imputil.pyRVs2
%cCs�|s|jd�rdS|d}|drUtj|}||jksQt�|S|jd�}|dkrtdS|| }tj|}|j|ks�t�|S(sJReturns the context in which a module should be imported.

        The context could be a loaded (package) module and the imported module
        will be looked for within that package. The context could also be None,
        meaning there is no context -- the module should be looked for as a
        "top-level" module.
        R't__name__R&R%i����N(R2RR+R,R1RtrfindR>(R
R6t
parent_fqnameR:ti((s/usr/lib64/python2.7/imputil.pyR)�s	




cCsXxQtjD]F}t|t�r7|jj||�}n|j|�}|r
|Sq
WdS(N(R+tpathRt_StringTypeRtimport_from_dirt
import_topR(R
tnametitemR;((s/usr/lib64/python2.7/imputil.pyR.�scCs(|jjd�}|sntd�dS(s*Python calls this hook to reload a module.R'sreload not yet implementedN(R1R2tSystemError(R
R;R=((s/usr/lib64/python2.7/imputil.pyt_reload_hook�sN(R>t
__module__t__doc__R	t__builtin__RRRRRR$RR)R.RI(((s/usr/lib64/python2.7/imputil.pyRs			?	'	cBsVeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	s3Base class for replacing standard import functions.cCs|jd||�S(sImport a top-level module.N(t_import_oneR(R
RF((s/usr/lib64/python2.7/imputil.pyRE�scCs<|j||�}|s|S|jr8|j||�n|S(N(t
_load_tailR&t_import_fromlist(R
ttopR9R8tbottom((s/usr/lib64/python2.7/imputil.pyR3�s	cCswytj|SWntk
r"nX|j|||�}|dkrHdS|j||�}|rst|||�n|S(sImport a single module.N(R+R,R-tget_codeRt_process_resulttsetattr(R
R:tmodnameR5tresultR;((s/usr/lib64/python2.7/imputil.pyRMs
cBs�|\}}}e|e�}|r-|}nej|�}||_||_|jj|�|ej	|<|s�y||jUWq�|ej	kr�ej	|=n�q�Xnej	|}||_
|S(N(RRRt
new_moduleR'R&R1tupdateR+R,R>(R
RVR5tispkgtcodetvaluest	is_moduleR;((s/usr/lib64/python2.7/imputil.pyRSs&			



	cCsSxL|D]D}d|j|f}|j|||�}|std|�qqW|S(s�Import the rest of the modules, down from the top-level module.

        Returns the last module in the dotted list of modules.
        s%s.%ssNo module named (R>RMR/(R
tmR9tpartR5((s/usr/lib64/python2.7/imputil.pyRNAs
cCs�d|kr4t|�t|jjdg��}nxk|D]c}|dkr;t||�r;d|j|f}|j|||�}|s�td|�q�q;q;WdS(s*Import any sub-modules in the "from" list.t*t__all__s%s.%sscannot import name N(tlistR1R2RR>RMR/(R
tpackageR8tsubtsubnametsubmod((s/usr/lib64/python2.7/imputil.pyROMs	
cCsQ|d}|jd|}|j|||�}|s:dS|j||d|�S(s�Attempt to import the module relative to parent.

        This method is used when the import context specifies that <self>
        imported the parent module.
        iR%iN(R>RMRR3(R
R:R9R8ttop_namet
top_fqnameR<((s/usr/lib64/python2.7/imputil.pyR*_s
cCs
td�dS(s�Find and retrieve the code for the given module.

        parent specifies a parent module to define a context for importing. It
        may be None, indicating no particular context for the search.

        modname specifies a single module (not dotted) within the parent.

        fqname specifies the fully-qualified module name. This is a
        (potentially) dotted name from the "root" of the module namespace
        down to the modname.
        If there is no parent, then modname==fqname.

        This method should return None, or a 3-tuple.

        * If the module was not found, then None should be returned.

        * The first item of the 2- or 3-tuple should be the integer 0 or 1,
            specifying whether the module that was found is a package or not.

        * The second item is the code object for the module (it will be
            executed within the new module's namespace). This item can also
            be a fully-loaded module object (e.g. loaded from a shared lib).

        * The third item is a dictionary of name/value pairs that will be
            inserted into new module before the code object is executed. This
            is provided in case the module's code expects certain values (such
            as where the module was found). When the second item is a module
            object, then these names/values will be inserted *after* the module
            has been loaded/initialized.
        sget_code not implementedN(tRuntimeError(R
R:RUR5((s/usr/lib64/python2.7/imputil.pyRRrs(R>RJRKRER3RMRSRNROR*RR(((s/usr/lib64/python2.7/imputil.pyR�s		#		%			tctos.pycCs�t|d�j�}|r8|ddkr8|d}ntj||d�}yt|td�}Wntk
rwnnX|jd�|jtjd|��t	j
||�|j�|jdd�|jt
j��|j�|S(	sNCompile (and cache) a Python source file.

    The file specified by <pathname> is compiled to a code object and
    returned.

    Presuming the appropriate privileges exist, the bytecodes will be
    saved back to the filesystem for future imports. The source file's
    modification timestamp must be provided as a Long value.
    trUi����s
texectwbts<Ii(topentreadRLtcompilet_suffix_chartIOErrortwritetstructtpacktmarshaltdumptflushtseekRt	get_magictclose(tpathnamet	timestampt
codestringRZtf((s/usr/lib64/python2.7/imputil.pyt_compile�s 





cCs�tj}d}d|kr4d}ddlm}nxd|krYd}ddlm}nSd|kr~d}ddlm}n.d|kr�d}ddlm}n	td	�|dkr�|d
�}n|a	|a
dS(sISet up 'os' module replacement functions for use during import bootstrap.tposixt/i����(tstattnts\tdostos2sno os specific module foundcSsF|dkr|S|d}|dks2||kr:||S|||S(NRi����R�((tatbtseptlastchar((s/usr/lib64/python2.7/imputil.pytjoin�s
N(R+tbuiltin_module_namesRR�R�R�R�R�R/Rt
_os_path_join(tnamesR�R�R�((s/usr/lib64/python2.7/imputil.pyR�s&			cCs6yt|�}Wntk
r$dSX|jd@dkS(s&Local replacement for os.path.isdir().i�i@N(RtOSErrorRtst_mode(R}ts((s/usr/lib64/python2.7/imputil.pyt_os_path_isdir�s

cCs2yt|�}Wntk
r$dSXt|j�S(s,Return the file modification time as a Long.N(RR�Rtlongtst_mtime(R}R�((s/usr/lib64/python2.7/imputil.pyt
_timestamp�s

cBseZd�ZRS(cCsr|r
dStj|�r%tj}ntj|�r@tj}ndStj|d|dd|f�}d|ifS(NRi(RRt
is_builtint	C_BUILTINt	is_frozent	PY_FROZENtload_module(R
R:RUR5ttypeR;((s/usr/lib64/python2.7/imputil.pyRR�s!(R>RJRR(((s/usr/lib64/python2.7/imputil.pyR�sRcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs
g|_dS(N(tsuffixes(R
((s/usr/lib64/python2.7/imputil.pyR$scCs/t|d�st�|jj||f�dS(NR(RRR�tappend(R
RR((s/usr/lib64/python2.7/imputil.pyRscCs5|jt||�|�}|r1|j||�SdS(N(t_import_pathnameR�RSR(R
tdirR5RV((s/usr/lib64/python2.7/imputil.pyRDscCsg|st�x<|jD]1}|jt||�|�}|dk	r|SqW|jt|j|�|�S(N(Rt__path__R�R�Rt
__pkgdir__(R
R:RUR5tsubmodule_pathRZ((s/usr/lib64/python2.7/imputil.pyRRsc	Cs�t|�rc|jt|d�|�}|r_|d}||d<|g|d<d|d|fSdSxU|jD]J\}}||}yt|�}Wntk
r�qmX||||�SqmWdS(NR$iR�R�i(R�R�R�RR�RR�(	R
R}R5RVR[RRtfilenametfinfo((s/usr/lib64/python2.7/imputil.pyR�,s"	




(R>RJR$RRDRRR�(((s/usr/lib64/python2.7/imputil.pyRs
				c	Cs�|d t}t|d�}t|�}d}|dk	r�||kr�t|d�}|jd�tj�kr�tj	d|jd��d}||kr�t
j|�}q�n|j�n|dkr�|}t
||�}nd|i|d6fS(Ni����itrbis<Iit__file__(t_suffixR�R�RRoRpRR{RutunpackRwtloadR|R�(	R�R�R5tfilett_pytt_pycRZR�tt((s/usr/lib64/python2.7/imputil.pyR!Fs
RcBseZd�Zd�ZRS(cCs
||_dS(N(R#(R
R#((s/usr/lib64/python2.7/imputil.pyR$ZscCsGt||jd�}tj||||j�}||_d|ifS(Nii(RoR#RR�R�(R
R�R�R5tfpR;((s/usr/lib64/python2.7/imputil.pyR ]s	(R>RJR$R (((s/usr/lib64/python2.7/imputil.pyRYs	cCs^tjj�}|j�x>|D]6\}}|rM|G|jjdd�GHq |GdGHq WdS(NR's-- no importers-- non-existent module(R+R,titemstsortR1R2(R�RFR;((s/usr/lib64/python2.7/imputil.pyt_print_importersfs
cCs't�j�tjjdt��dS(Ni(RRR+RBtinsertR(((s/usr/lib64/python2.7/imputil.pyt_test_revampos
((((RKtwarningsRRR+RLRuRwR`R�RCRRRt	__debug__RrR�R�RRR�RR�R�RRR!RR�R�(((s/usr/lib64/python2.7/imputil.pyt<module>s4��
	
	$		
6	
		

Zerion Mini Shell 1.0