PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  lYkS @sdZddlmZddlZddlZddlZddlZddlZddl Z ddl m Z ddl Z ddddd d d d d ddg Z ddZddZddddd Zdddd ZedddZdddZejejjeddZGdd d ZGdd d Zy?ddlZddlmZddd ZejeeWnek rYnXd!dZdd"dZd#dZ d$dZ!d%dZ"d&d Z#dS)'zUtilities to support packages.)singledispatchN) ModuleType get_importeriter_importers get_loader find_loader walk_packages iter_modulesget_data ImpImporter ImpLoader read_code extend_pathc Csby |j}WnDtk rS|j|}|dkr<dStjj||SYn X||SdS)z'Return the finder-specific module spec.N) find_specAttributeError find_module importlibutilspec_from_loader)findernamerloaderr&/opt/python35/lib/python3.5/pkgutil.py _get_specs   rcCs]ddl}|jd}|tjjkrC|tjjkrCdS|jd|j|S)Nr)marshalreadrr MAGIC_NUMBER_BACKCOMPAT_MAGIC_NUMBERload)streamrmagicrrrr "s  c #siddxt||D]\}}}|||fV|ryt|WnUtk rz|dk rv||Yqtk r|dk r||nYqXttj|ddpg}fdd|D}t||d|EdHqWdS)aYields (module_finder, 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||.seenN__path__cs"g|]}|s|qSrr).0r%)r'rr fs z!walk_packages...)r __import__ ImportError Exceptiongetattrsysmodulesr)pathprefixonerrorimporterrispkgr)r'rr2s      ccs|dkrt}ntt|}i}xR|D]J}xAt||D]0\}}||krJd||<|||fVqJWq4WdS)a&Yields (module_finder, 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. N)rmapriter_importer_modules)r2r3Z importersyieldedirr6rrrr ks     cCs t|dsgS|j|S)Nr )hasattrr )r5r3rrrr9sr9c cs|jdks%tjj|j r)dSi}ddl}ytj|j}Wntk rkg}YnX|jx|D]}|j|}|dks}||krq}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) r2osisdirinspectlistdirOSErrorsort getmodulenamejoin) r5r3r:r@ filenamesfnmodnamer2r6 dircontentssubnamerrr_iter_file_finder_moduless<%     %     rKc Cs7tj$tjdttjdaWdQRXdS)Nignoreimp)warningscatch_warnings simplefilterPendingDeprecationWarningr import_modulerMrrrr _import_imps rSc@sCeZdZdZdddZdddZddd ZdS) r aPEP 302 Finder that wraps Python's "classic" import algorithm ImpImporter(dirname) produces a PEP 302 finder that searches that directory. ImpImporter(None) produces a PEP 302 finder 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. NcCs$tjdtt||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rNwarnDeprecationWarningrSr2)selfr2rrrr=s zImpImporter.__init__c Cs|jdd}||kr2|jdkr2dS|jdkrJd}ntjj|jg}ytj||\}}}Wntk rdSYnXt||||S)Nr+r7)splitr2r>realpathrMrr-r )rVfullnamer2rJfilefilenameetcrrrrs   zImpImporter.find_moduler$c cs|jdks%tjj|j r)dSi}ddl}ytj|j}Wntk rkg}YnX|jx|D]}|j|}|dks}||krq}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____doc__r=rr rrrrr s c@seZdZdZdZZddZddZddZd d Z d d Z d dZ dddZ dddZ ddZdddZdS)r zBPEP 302 Loader that wraps Python's "classic" import algorithm NcCs?tjdtt||_||_||_||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rNrTrUrSr[r\rZr])rVrZr[r\r]rrrr= s    zImpLoader.__init__c CsM|jz%tj||j|j|j}Wd|jrH|jjX|S)N)_reopenrM load_moduler[r\r]close)rVrZmodrrrrcs  % zImpLoader.load_modulec Cs't|d}|jSWdQRXdS)Nrb)openr)rVpathnamer[rrrr szImpLoader.get_datacCsz|jrv|jjrv|jd}|tjkrIt|jd|_n-|tjtjfkrvt|jd|_dS)Nrrf) r[closedr]rM PY_SOURCErgr\ PY_COMPILED C_EXTENSION)rVmod_typerrrrb$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)Nri)rpr]rM PKG_DIRECTORY)rVrZrrr is_package4szImpLoader.is_packagec Cs|j|}|jdkr|jd}|tjkrd|j|}t||jd|_ng|tjkr|j zt |j |_Wd|j j Xn$|tj kr|jj|_|jS)Nriexec)rpcoder]rMrl get_sourcecompiler\rmrbr r[rdrq _get_delegateget_code)rVrZrosourcerrrrx8s  zImpLoader.get_codec Cs|j|}|jdkr|jd}|tjkrn|jz|jj|_Wd|jjXn|tj krt j j |j ddrt|j ddd}|j|_WdQRXn$|tjkr|jj|_|jS)Nrir7rjrWrW)rpryr]rMrlrbr[rrdrmr>r2existsr\rgrqrwru)rVrZrofrrrruIs  zImpLoader.get_sourcecCs%t|j}t|d}|jS)Nr=)r r\rr)rVrspecrrrrw[szImpLoader._get_delegatecCsd|j|}|jd}|tjkr;|jjS|tjtjtjfkr`|j SdS)Nri) rpr]rMrqrw get_filenamerlrmrnr\)rVrZrorrrr}`s zImpLoader.get_filename)r^r_r`rartryr=rcr rbrprrrxrurwr}rrrrr s       ) zipimporterc csDttj|j}|j}t|}i}ddl}x|D]}|j|s\qD||djt j }t|dkr|djdr|d|krd||d<||ddfVt|dkrqD|j |d}|dkrqD|rDd|krD||krDd||<||dfVqDWdS) Nrrir7z __init__.pyTr=r+F) sorted zipimport_zip_directory_cachearchiver3lenr@ startswithrXr>seprD) r5r3dirlistZ_prefixZplenr:r@rGrHrrriter_zipimport_modulesns*    %  rcCs}ytj|}Wnetk rxxPtjD]?}y$||}tjj||PWq+tk riYq+Xq+Wd}YnX|S)zRetrieve a finder for the given path item The returned finder 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)r0path_importer_cacheKeyError path_hooks setdefaultr-)Z path_itemr5 path_hookrrrrs      ccs|jdr*dj|}t|d|kr}|jdd}tj|}t|dd}|dkrdSntjEdHtj }x|D]}t |VqWdS)aYield finders for the given module name If fullname contains a '.', the finders will be for the package containing fullname, otherwise they will be all registered top level finders (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 finders are produced. r+z'Relative module name {!r} not supportedrr(N) rformatr- rpartitionrrRr/r0 meta_pathr2r)rZmsgZpkg_nameZpkgr2itemrrrrs       cCs|tjkr,tj|}|dkr,dSt|tr|}t|dd}|dk rc|St|dddkrdS|j}n|}t|S)zGet a "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__. N __loader____spec__)r0r1 isinstancerr/r^r)Zmodule_or_namemodulerrZrrrrs    cCs|jdr*dj|}t|ytjj|}Wn[ttttfk r}z/d}t|j|t |||WYdd}~XnX|dk r|j SdS)zFind a "loader" object for fullname This is a backwards compatibility wrapper around importlib.util.find_spec that converts most failures to ImportError and only returns the loader rather than the full spec r+z'Relative module name {!r} not supportedz,Error while finding loader for {!r} ({}: {})N) rrr-rrrr TypeError ValueErrortyper)rZrr|exrrrrs 7cCs&t|ts|S|d}|dd}|jd\}}}|rytj|j}Wqttfk r}|SYqXn tj}x|D]}t|t sqt |}|dk rQg} t |dr|j |} | dk r'| j pg} n$t |dr'|j|\}} x'| D]} | |kr.|j| q.Wtjj||} tjj| ryt| } Wn?tk r}ztjjd| |fWYdd}~XqX| KxC| D];}|jd}| s|jdrq|j|qWWdQRXqW|S) aExtend 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). z.pkgNr+rrzCan't open %s: %s  #)rlistrr0r1r(rrr2strrr<rsubmodule_search_locationsrappendr>rEisfilergrBstderrwriterstripr)r2rZ sname_pkgZparent_package_Z final_nameZ search_pathdirrportionsr|ZportionZpkgfiler{rlinerrrrsP!          ! cCstjj|}|dkr"dS|j}|dksGt|d rKdStjj|pltjj |}|dkst|d rdS|j d}|j dt j j|jt j j|}|j|S)afGet 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. Nr __file__/r)rrrrr<r0r1get _bootstrap_loadrXinsertr>r2dirnamerrEr )packageZresourcer|rrepartsZ resource_namerrrr Ps  )$ra functoolsrZ simplegenericrimportlib.utilZimportlib.machineryr>Zos.pathr0typesrrN__all__rr rr r9rKregister machinery FileFinderrSr r rr~rr-rrrrrr rrrrsJ           9( Jc      ^