Your IP : 3.137.181.194


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/pkgutil.cpython-33.pyo

�
��f#Tc@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddddd	d
ddd
ddgZ
dd�Zdd�Zddddd	�Zdddd
�Zddd�Zee�Zddd�Zejejje�Gdd�d�ZGdd
�d
�Zy?ddlZddlmZddd�Zejee�Wnek
r�YnXdd�Zdd d�Zd!d�Zd"d�Zd#d�Zd$d�Z dS(%uUtilities to support packages.iN(uwarn(u
ModuleTypeuget_importeruiter_importersu
get_loaderufind_loaderu
walk_packagesuiter_modulesuget_datauImpImporteru	ImpLoaderu	read_codeuextend_pathcCsKddl}|jd�}|tj�kr1dS|jd�|j|�S(Niii(umarshalureaduimpu	get_magicuNoneuload(ustreamumarshalumagic((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu	read_codes
cs�i���fdd�}y�j|_Wnttfk
rEYnXd��fdd���j|_�j|_�|_|S(u/Make a trivial single-dispatch generic functioncs�|d}y
|j}Wntk
r7t|�}YnXy
|j}Wn`tk
r�y0Gdd�d|t�}|jdd�}Wntk
r�tf}YnXYnXx8|D]#}|�kr��|||�Sq�W�||�SdS(NicBs|EeZdZdS(u+simplegeneric.<locals>.wrapper.<locals>.clsN(u__name__u
__module__u__qualname__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyucls+suclsi(u	__class__uAttributeErrorutypeu__mro__uobjectu	TypeError(uargsukwuobuclsumrout(ufuncuregistry(u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuwrapper!s"






usimplegeneric.<locals>.wrappercs-|dkr��fdd�S|��<|S(Ncs
��|�S(N((uf(uregisterutyp(u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu<lambda><su1simplegeneric.<locals>.register.<locals>.<lambda>(uNone(utypufunc(uregisteruregistry(utypu,/opt/alt/python33/lib64/python3.3/pkgutil.pyuregister:s
usimplegeneric.<locals>.registerN(u__name__u	TypeErroruAttributeErroruNoneu__dict__u__doc__uregister(ufuncuwrapper((ufuncuregisteruregistryu,/opt/alt/python33/lib64/python3.3/pkgutil.pyu
simplegenerics	u
simplegenericuc#sidd��x�t||�D]�\}}}|||fV|ryt|�WnXtk
r}|dk	ry||�nYqtk
r�|dk	r�||�n�YqXttj|dd�p�g}�fdd�|D�}x&t||d|�D]}|Vq�WqqWdS(u�Yields (module_loader, name, ispkg) for all modules recursively
    on path, or, if path is None, all accessible modules.

    'path' should be either None or a list of paths to look for
    modules in.

    'prefix' is a string to output on the front of every module name
    on output.

    Note that this function must import all *packages* (NOT all
    modules!) on the given path, in order to access the __path__
    attribute to find submodules.

    'onerror' is a function which gets called with one argument (the
    name of the package which was being imported) if any exception
    occurs while trying to import a package.  If no onerror function is
    supplied, ImportErrors are caught and ignored, while all other
    exceptions are propagated, terminating the search.

    Examples:

    # list all modules python can access
    walk_packages()

    # list all submodules of ctypes
    walk_packages(ctypes.__path__, ctypes.__name__+'.')
    cSs||krdSd||<dS(NT(uTrue(upum((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuseencsuwalk_packages.<locals>.seenu__path__cs"g|]}�|�s|�qS(((u.0up(useen(u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu
<listcomp>zs	u!walk_packages.<locals>.<listcomp>u.N(	uiter_modulesu
__import__uImportErroruNoneu	Exceptionugetattrusysumodulesu
walk_packages(upathuprefixuonerroruimporterunameuispkguitem((useenu,/opt/alt/python33/lib64/python3.3/pkgutil.pyu
walk_packagesFs"


ccs�|dkrt�}ntt|�}i}xU|D]M}xDt||�D]3\}}||krJd||<|||fVqJqJWq4WdS(u&Yields (module_loader, name, ispkg) for all submodules on path,
    or, if path is None, all top-level modules on sys.path.

    'path' should be either None or a list of paths to look for
    modules in.

    'prefix' is a string to output on the front of every module name
    on output.
    iN(uNoneuiter_importersumapuget_importeruiter_importer_modules(upathuprefixu	importersuyieldeduiunameuispkg((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuiter_modules�s

cCs t|d�sgS|j|�S(Nuiter_modules(uhasattruiter_modules(uimporteruprefix((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuiter_importer_modules�suiter_importer_modulesccs�|jdks%tjj|j�r)dSi}ddl}ytj|j�}Wntk
rkg}YnX|j�x|D]}|j|�}|dks}||kr�q}ntjj	|j|�}d}|rctjj|�rcd|krc|}ytj|�}	Wntk
r&g}	YnXx9|	D]+}|j|�}
|
dkr.d}Pq.q.Wq}n|r}d|kr}d||<|||fVq}q}WdS(Niu__init__u.iFT(upathuNoneuosuisdiruinspectulistdiruOSErrorusortu
getmodulenameujoinuFalseuTrue(uimporteruprefixuyieldeduinspectu	filenamesufnumodnameupathuispkgudircontentsusubname((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu_iter_file_finder_modules�s<%


%


u_iter_file_finder_modulescBsG|EeZdZdZd	dd�Zd	dd�Zddd�Zd	S(
uImpImporteru�PEP 302 Importer that wraps Python's "classic" import algorithm

    ImpImporter(dirname) produces a PEP 302 importer that searches that
    directory.  ImpImporter(None) produces a PEP 302 importer that searches
    the current sys.path, plus any modules that are frozen or built-in.

    Note that ImpImporter does not currently support being used by placement
    on sys.meta_path.
    cCstdt�||_dS(Nu5This emulation is deprecated, use 'importlib' instead(uwarnuDeprecationWarningupath(uselfupath((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu__init__�suImpImporter.__init__cCs�|jd�d}||kr2|jdkr2dS|jdkrJd}ntjj|j�g}ytj||�\}}}Wntk
r�dSYnXt||||�S(Nu.ii����(	usplitupathuNoneuosurealpathuimpufind_moduleuImportErroru	ImpLoader(uselfufullnameupathusubnameufileufilenameuetc((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyufind_module�s	
	uImpImporter.find_moduleuccs�|jdks%tjj|j�r)dSi}ddl}ytj|j�}Wntk
rkg}YnX|j�x|D]}|j|�}|dks}||kr�q}ntjj	|j|�}d}|rctjj|�rcd|krc|}ytj|�}	Wntk
r&g}	YnXx9|	D]+}|j|�}
|
dkr.d}Pq.q.Wq}n|r}d|kr}d||<|||fVq}q}WdS(Niu__init__u.iFT(upathuNoneuosuisdiruinspectulistdiruOSErrorusortu
getmodulenameujoinuFalseuTrue(uselfuprefixuyieldeduinspectu	filenamesufnumodnameupathuispkgudircontentsusubname((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuiter_modules�s<%


%


uImpImporter.iter_modulesN(u__name__u
__module__u__qualname__u__doc__uNoneu__init__ufind_moduleuiter_modules(u
__locals__((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuImpImporter�s	cBs�|EeZdZdZdZZdd�Zdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zddd�Z
ddd�Zdd�Zddd�ZdS(u	ImpLoaderuBPEP 302 Loader that wraps Python's "classic" import algorithm
    cCs5tdt�||_||_||_||_dS(Nu5This emulation is deprecated, use 'importlib' instead(uwarnuDeprecationWarningufileufilenameufullnameuetc(uselfufullnameufileufilenameuetc((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu__init__s			uImpLoader.__init__cCsP|j�z%tj||j|j|j�}Wd|jrK|jj�nX|S(N(u_reopenuimpuload_moduleufileufilenameuetcuclose(uselfufullnameumod((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuload_module!s
%	uImpLoader.load_modulecCs&t|d��}|j�SWdQXdS(Nurb(uopenuread(uselfupathnameufile((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuget_data,suImpLoader.get_datacCs�|jr||jjr||jd}|tjkrIt|jd�|_q||tjtjfkr|t|jd�|_q|ndS(Niururb(	ufileucloseduetcuimpu	PY_SOURCEuopenufilenameuPY_COMPILEDuC_EXTENSION(uselfumod_type((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu_reopen0s
uImpLoader._reopencCsG|dkr|j}n+||jkrCtd|j|f��n|S(Nu,Loader for module %s cannot handle module %s(uNoneufullnameuImportError(uselfufullname((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu	_fix_name8suImpLoader._fix_namecCs#|j|�}|jdtjkS(Ni(u	_fix_nameuetcuimpu
PKG_DIRECTORY(uselfufullname((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu
is_package@suImpLoader.is_packagec
Cs�|j|�}|jdkr�|jd}|tjkrd|j|�}t||jd�|_q�|tj	kr�|j
�zt|j�|_Wd|jj
�Xq�|tjkr�|j�j�|_q�n|jS(Niuexec(u	_fix_nameucodeuNoneuetcuimpu	PY_SOURCEu
get_sourceucompileufilenameuPY_COMPILEDu_reopenu	read_codeufileucloseu
PKG_DIRECTORYu
_get_delegateuget_code(uselfufullnameumod_typeusource((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuget_codeDs

uImpLoader.get_codec
Cs|j|�}|jdkr|jd}|tjkrn|j�z|jj�|_Wd|jj	�Xq|tj
kr�tjj
|jdd��r�t|jdd�d�}|j�|_|j	�q�q|tjkr|j�j�|_qn|jS(Niiuri����i����(u	_fix_nameusourceuNoneuetcuimpu	PY_SOURCEu_reopenufileureaducloseuPY_COMPILEDuosupathuexistsufilenameuopenu
PKG_DIRECTORYu
_get_delegateu
get_source(uselfufullnameumod_typeuf((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu
get_sourceUs 

uImpLoader.get_sourcecCst|j�jd�S(Nu__init__(uImpImporterufilenameufind_module(uself((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu
_get_delegateisuImpLoader._get_delegatecCsd|j|�}|jd}|tjkr;|j�j�S|tjtjtjfkr`|j	SdS(Ni(u	_fix_nameuetcuimpu
PKG_DIRECTORYu
_get_delegateuget_filenameu	PY_SOURCEuPY_COMPILEDuC_EXTENSIONufilenameuNone(uselfufullnameumod_type((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuget_filenamels
uImpLoader.get_filenameN(u__name__u
__module__u__qualname__u__doc__uNoneucodeusourceu__init__uload_moduleuget_datau_reopenu	_fix_nameu
is_packageuget_codeu
get_sourceu
_get_delegateuget_filename(u
__locals__((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu	ImpLoaders
(uzipimporterc	csRttj|j�}|j}t|�}i}ddl}x|D]}|j|�s_qDn||d�jt	j
�}t|�dkr�|djd�r�|d|kr�d||d<|ddfVq�nt|�dkr�qDn|j|d�}|dkrqDn|rDd|krD||krDd||<||dfVqDqDWdS(	Niiiu__init__.pyu__init__u.TF(usortedu	zipimportu_zip_directory_cacheuarchiveuprefixulenuinspectu
startswithusplituosusepuTrueu
getmodulenameuFalse(	uimporteruprefixudirlistu_prefixuplenuyieldeduinspectufnumodname((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuiter_zipimport_moduleszs*	
%
uiter_zipimport_modulescCs}ytj|}Wnetk
rxxPtjD]?}y$||�}tjj||�PWq+tk
riYq+Xq+Wd}YnX|S(uRetrieve a PEP 302 importer for the given path item

    The returned importer is cached in sys.path_importer_cache
    if it was newly created by a path hook.

    The cache (or part of it) can be cleared manually if a
    rescan of sys.path_hooks is necessary.
    N(usysupath_importer_cacheuKeyErroru
path_hooksu
setdefaultuImportErroruNone(u	path_itemuimporteru	path_hook((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuget_importer�s	

	ccs�|jd�r-dj|�}t|��nd|kr�|jd�d}tj|�}t|dd�}|dkr�dSn"xtj	D]}|Vq�Wtj
}x|D]}t|�Vq�WdS(u�Yield PEP 302 importers for the given module name

    If fullname contains a '.', the importers will be for the package
    containing fullname, otherwise they will be all registered top level
    importers (i.e. those on both sys.meta_path and sys.path_hooks).

    If the named module is in a package, that package is imported as a side
    effect of invoking this function.

    If no module name is specified, all top level importers are produced.
    u.u'Relative module name {!r} not supportediu__path__N(u
startswithuformatuImportErroru
rpartitionu	importlibu
import_moduleugetattruNoneusysu	meta_pathupathuget_importer(ufullnameumsgupkg_nameupkgupathuimporteruitem((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuiter_importers�s		
cCsr|tjkrtj|}nt|t�rb|}t|dd�}|dk	rV|S|j}n|}t|�S(uGet a PEP 302 "loader" object for module_or_name

    Returns None if the module cannot be found or imported.
    If the named module is not already imported, its containing package
    (if any) is imported, in order to establish the package __path__.
    u
__loader__N(usysumodulesu
isinstanceu
ModuleTypeugetattruNoneu__name__ufind_loader(umodule_or_nameumoduleuloaderufullname((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu
get_loader�scCs�|jd�r-dj|�}t|��nd}|jd�d}|r�tj|�}t|dd�}|dkr�dSnytj||�SWn[tt	t
tfk
r�}z/d}t|j|t|�|��|�WYdd}~XnXdS(u#Find a PEP 302 "loader" object for fullname

    This is s convenience wrapper around :func:`importlib.find_loader` that
    sets the *path* argument correctly when searching for submodules, and
    also ensures parent packages (if any) are imported before searching for
    submodules.
    u.u'Relative module name {!r} not supportediu__path__u,Error while finding loader for {!r} ({}: {})N(
u
startswithuformatuImportErroruNoneu
rpartitionu	importlibu
import_moduleugetattrufind_loaderuAttributeErroru	TypeErroru
ValueErrorutype(ufullnameumsgupathupkg_nameupkguex((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyufind_loader�scCs�t|t�s|S|d}|dd�}|jd�\}}}|r�ytj|j}Wq�ttfk
r}|SYq�Xn	tj}xm|D]e}t|t	�s�q�nt
|�}|dk	r't|d�r�|j
|�\}	}
nd}	g}
x-|
D]"}||kr�|j|�q�q�Wntjj||�}tjj|�r�yt|�}
Wn?tk
r�}ztjjd||f�WYdd}~Xq�XxF|
D]>}|jd�}|s�|jd�r�q�n|j|�q�W|
j�q�q�W|S(u�Extend a package's path.

    Intended use is to place the following code in a package's __init__.py:

        from pkgutil import extend_path
        __path__ = extend_path(__path__, __name__)

    This will add to the package's __path__ all subdirectories of
    directories on sys.path named after the package.  This is useful
    if one wants to distribute different parts of a single logical
    package as multiple directories.

    It also looks for *.pkg files beginning where * matches the name
    argument.  This feature is similar to *.pth files (see site.py),
    except that it doesn't special-case lines starting with 'import'.
    A *.pkg file is trusted at face value: apart from checking for
    duplicates, all entries found in a *.pkg file are added to the
    path, regardless of whether they are exist the filesystem.  (This
    is a feature.)

    If the input path is not a list (as is the case for frozen
    packages) it is returned unchanged.  The input path is not
    modified; an extended copy is returned.  Items are only appended
    to the copy at the end.

    It is assumed that sys.path is a sequence.  Items of sys.path that
    are not (unicode or 8-bit) strings referring to existing
    directories are ignored.  Unicode items of sys.path that cause
    errors when used as filenames may cause this function to raise an
    exception (in line with os.path.isdir() behavior).
    u.pkgNu.ufind_loaderuCan't open %s: %s
u
u#(u
isinstanceulistu
rpartitionusysumodulesu__path__uKeyErroruAttributeErrorupathustruget_importeruNoneuhasattrufind_loaderuappenduosujoinuisfileuopenuIOErrorustderruwriteurstripu
startswithuclose(upathunameu	sname_pkguparent_packageu_u
final_nameusearch_pathudirufinderuloaderuportionsuportionupkgfileufumsguline((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuextend_pathsJ!
	

!
cCs�t|�}|dks(t|d�r,dStjj|�pJ|j|�}|dksit|d�rmdS|jd�}|jdt	j
j|j��t	j
j
|�}|j|�S(ufGet a resource from a package.

    This is a wrapper round the PEP 302 loader get_data API. The package
    argument should be the name of a package, in standard module format
    (foo.bar). The resource argument should be in the form of a relative
    filename, using '/' as the path separator. The parent directory name '..'
    is not allowed, and nor is a rooted name (starting with a '/').

    The function returns a binary string, which is the contents of the
    specified resource.

    For packages located in the filesystem, which have already been imported,
    this is the rough equivalent of

        d = os.path.dirname(sys.modules[package].__file__)
        data = open(os.path.join(d, resource), 'rb').read()

    If the package cannot be located or loaded, or it uses a PEP 302 loader
    which does not support get_data(), then None is returned.
    uget_datau__file__u/iN(u
get_loaderuNoneuhasattrusysumodulesugetuload_moduleusplituinsertuosupathudirnameu__file__ujoinuget_data(upackageuresourceuloaderumodupartsu
resource_name((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyuget_data]s!(!u__doc__uosusysu	importlibuimpuos.pathuwarningsuwarnutypesu
ModuleTypeu__all__u	read_codeu
simplegenericuNoneu
walk_packagesuiter_modulesuiter_importer_modulesu_iter_file_finder_modulesuregisteru	machineryu
FileFinderuImpImporteru	ImpLoaderu	zipimportuzipimporteruiter_zipimport_modulesuImportErroruget_importeruiter_importersu
get_loaderufind_loaderuextend_pathuget_data(((u,/opt/alt/python33/lib64/python3.3/pkgutil.pyu<module>sD	
(:(Hb
\

?>