Your IP : 18.218.50.170


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/pkgutil.cpython-35.opt-2.pyc



���]kS�@s�ddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlZdddddd	d
ddd
dgZdd�Z
dd
�Zddddd�Zdddd	�Zeddd��Zddd�Zejejje�dd�ZGdd�d�ZGdd�d�Zy?ddlZddlmZddd�Zejee�Wnek
r�YnXd d�Zdd!d�Zd"d�Zd#d�Z d$d�Z!d%d
�Z"dS)&�)�singledispatchN)�
ModuleType�get_importer�iter_importers�
get_loader�find_loader�
walk_packages�iter_modules�get_data�ImpImporter�	ImpLoader�	read_code�extend_pathcCsby
|j}WnDtk
rS|j|�}|dkr<dStjj||�SYnX||�SdS)N)�	find_spec�AttributeError�find_module�	importlib�util�spec_from_loader)�finder�namer�loader�r�,/opt/alt/python35/lib64/python3.5/pkgutil.py�	_get_specs

rcCs]ddl}|jd�}|tjjkrC|tjjkrCdS|jd�|j|�S)Nr��)�marshal�readrr�MAGIC_NUMBER�_BACKCOMPAT_MAGIC_NUMBER�load)�streamr�magicrrrr
"s
�c
#sidd��x�t||�D]�\}}}|||fV|ryt|�WnUtk
rz|dk	rv||�Yqtk
r�|dk	r�||�n�YqXttj|dd�p�g}�fdd�|D�}t||d|�EdHqWdS)NcSs||krdSd||<dS)NTr)�p�mrrr�seenOszwalk_packages.<locals>.seen�__path__cs"g|]}�|�s|�qSrr)�.0r%)r'rr�
<listcomp>fs	z!walk_packages.<locals>.<listcomp>�.)r	�
__import__�ImportError�	Exception�getattr�sys�modulesr)�path�prefix�onerror�importerr�ispkgr)r'rr2s 


ccs�|dkrt�}ntt|�}i}xR|D]J}xAt||�D]0\}}||krJd||<|||fVqJWq4WdS)N�)r�mapr�iter_importer_modules)r2r3Z	importers�yielded�irr6rrrr	ks

cCs t|d�sgS|j|�S)Nr	)�hasattrr	)r5r3rrrr9�sr9ccs�|jdks%tjj|j�r)dSi}ddl}ytj|j�}Wntk
rkg}YnX|j�x|D]}|j|�}|dks}||kr�q}tjj|j|�}d}|rZtjj|�rZd|krZ|}ytj|�}	Wntk
r#g}	YnXx3|	D](}|j|�}
|
dkr+d}Pq+Wq}|r}d|kr}d||<|||fVq}WdS)Nr�__init__Fr+Tr7)	r2�os�isdir�inspect�listdir�OSError�sort�
getmodulename�join)r5r3r:r@�	filenames�fn�modnamer2r6�dircontents�subnamerrr�_iter_file_finder_modules�s<%


%


rKc
Cs7tj��$tjdt�tjd�aWdQRXdS)N�ignore�imp)�warnings�catch_warnings�simplefilter�PendingDeprecationWarningr�
import_modulerMrrrr�_import_imp�s
rSc@s=eZdZddd�Zddd�Zddd�ZdS)	rNcCs$tjdt�t�||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rN�warn�DeprecationWarningrSr2)�selfr2rrrr=�s	zImpImporter.__init__c
Cs�|jd�d}||kr2|jdkr2dS|jdkrJd}ntjj|j�g}ytj||�\}}}Wntk
r�dSYnXt||||�S)Nr+r7���)�splitr2r>�realpathrMrr-r)rV�fullnamer2rJ�file�filename�etcrrrr�s	
	zImpImporter.find_moduler$ccs�|jdks%tjj|j�r)dSi}ddl}ytj|j�}Wntk
rkg}YnX|j�x|D]}|j|�}|dks}||kr�q}tjj|j|�}d}|rZtjj|�rZd|krZ|}ytj|�}	Wntk
r#g}	YnXx3|	D](}|j|�}
|
dkr+d}Pq+Wq}|r}d|kr}d||<|||fVq}WdS)Nrr=Fr+Tr7)	r2r>r?r@rArBrCrDrE)rVr3r:r@rFrGrHr2r6rIrJrrrr	�s<%


%


zImpImporter.iter_modules)�__name__�
__module__�__qualname__r=rr	rrrrr�sc@s�eZdZdZZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�Zdd�Z
ddd�ZdS)rNcCs?tjdt�t�||_||_||_||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rNrTrUrSr[r\rZr])rVrZr[r\r]rrrr=s				zImpLoader.__init__cCsM|j�z%tj||j|j|j�}Wd|jrH|jj�X|S)N)�_reopenrM�load_moduler[r\r]�close)rVrZ�modrrrrbs
%	zImpLoader.load_modulec	Cs't|d��}|j�SWdQRXdS)N�rb)�openr)rV�pathnamer[rrrr
 szImpLoader.get_datacCsz|jrv|jjrv|jd}|tjkrIt|jd�|_n-|tjtjfkrvt|jd�|_dS)N��rre)	r[�closedr]rM�	PY_SOURCErfr\�PY_COMPILED�C_EXTENSION)rV�mod_typerrrra$s
zImpLoader._reopencCsD|dkr|j}n(||jkr@td|j|f��|S)Nz,Loader for module %s cannot handle module %s)rZr-)rVrZrrr�	_fix_name,szImpLoader._fix_namecCs#|j|�}|jdtjkS)Nrh)ror]rM�
PKG_DIRECTORY)rVrZrrr�
is_package4szImpLoader.is_packagec
Cs�|j|�}|jdkr�|jd}|tjkrd|j|�}t||jd�|_ng|tjkr�|j	�zt
|j�|_Wd|jj�Xn$|tj
kr�|j�j�|_|jS)Nrh�exec)ro�coder]rMrk�
get_source�compiler\rlrar
r[rcrp�
_get_delegate�get_code)rVrZrn�sourcerrrrw8s

zImpLoader.get_codec
Cs�|j|�}|jdkr�|jd}|tjkrn|j�z|jj�|_Wd|jj�Xn�|tj	kr�t
jj|j
dd��r�t|j
dd�d��}|j�|_WdQRXn$|tjkr�|j�j�|_|jS)Nrhr7rirWrW)rorxr]rMrkrar[rrcrlr>r2�existsr\rfrprvrt)rVrZrn�frrrrtIs

zImpLoader.get_sourcecCs%t|j�}t|d�}|jS)Nr=)rr\rr)rVr�specrrrrv[szImpLoader._get_delegatecCsd|j|�}|jd}|tjkr;|j�j�S|tjtjtjfkr`|j	SdS)Nrh)
ror]rMrprv�get_filenamerkrlrmr\)rVrZrnrrrr|`s
zImpLoader.get_filename)r^r_r`rsrxr=rbr
rarorqrwrtrvr|rrrrrs
	)�zipimporterc	csDttj|j�}|j}t|�}i}ddl}x|D]�}|j|�s\qD||d�jt	j
�}t|�dkr�|djd�r�|d|kr�d||d<||ddfVt|�dkr�qD|j|d�}|dkrqD|rDd|krD||krDd||<||dfVqDWdS)	Nrrhr7z__init__.pyTr=r+F)�sorted�	zipimport�_zip_directory_cache�archiver3�lenr@�
startswithrXr>�seprD)	r5r3�dirlistZ_prefixZplenr:r@rGrHrrr�iter_zipimport_modulesns*	
%
r�cCs}ytj|}Wnetk
rxxPtjD]?}y$||�}tjj||�PWq+tk
riYq+Xq+Wd}YnX|S)N)r0�path_importer_cache�KeyError�
path_hooks�
setdefaultr-)Z	path_itemr5�	path_hookrrrr�s	

	ccs�|jd�r*dj|�}t|��d|kr}|jd�d}tj|�}t|dd�}|dkr�dSntjEdHtj	}x|D]}t
|�Vq�WdS)Nr+z'Relative module name {!r} not supportedrr()r��formatr-�
rpartitionrrRr/r0�	meta_pathr2r)rZ�msgZpkg_nameZpkgr2�itemrrrr�s	
cCs�|tjkr,tj|}|dkr,dSt|t�r�|}t|dd�}|dk	rc|St|dd�dkrdS|j}n|}t|�S)N�
__loader__�__spec__)r0r1�
isinstancerr/r^r)Zmodule_or_name�modulerrZrrrr�s
cCs�|jd�r*dj|�}t|��ytjj|�}Wn[ttttfk
r�}z/d}t|j|t	|�|��|�WYdd}~XnX|dk	r�|j
SdS)Nr+z'Relative module name {!r} not supportedz,Error while finding loader for {!r} ({}: {}))r�r�r-rrrr�	TypeError�
ValueError�typer)rZr�r{�exrrrr�s7cCs&t|t�s|S|d}|dd�}|jd�\}}}|r�ytj|j}Wq�ttfk
r}|SYq�Xn	tj}x�|D]�}t|t	�s�q�t
|�}|dk	rQg}	t|d�r|j|�}
|
dk	r'|
j
p�g}	n$t|d�r'|j|�\}}	x'|	D]}||kr.|j|�q.Wtjj||�}tjj|�r�yt|�}
Wn?tk
r�}ztjjd||f�WYdd}~Xq�X|
�KxC|
D];}|jd�}|s�|jd�rq�|j|�q�WWdQRXq�W|S)Nz.pkgr+rrzCan't open %s: %s
�
�#)r��listr�r0r1r(r�rr2�strrr<r�submodule_search_locationsr�appendr>rE�isfilerfrB�stderr�write�rstripr�)r2rZ	sname_pkgZparent_package�_Z
final_nameZsearch_path�dirr�portionsr{ZportionZpkgfilerzr��linerrrr�sP!
	

!
cCs�tjj|�}|dkr"dS|j}|dksGt|d�rKdStjj|�pltjj	|�}|dks�t|d�r�dS|j
d�}|jdtj
j|j��tj
j|�}|j|�S)Nr
�__file__�/r)rrrrr<r0r1�get�
_bootstrap�_loadrX�insertr>r2�dirnamer�rEr
)�packageZresourcer{rrd�partsZ
resource_namerrrr
Ps	)#�	functoolsrZ
simplegenericr�importlib.utilZimportlib.machineryr>Zos.pathr0�typesrrN�__all__rr
rr	r9rK�register�	machinery�
FileFinderrSrrrr}r�r-rrrrrr
rrrr�<module>sH	9(Jc
^

?>