3 fm@s&dZdnZdoZeeZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ dpddZ ee jZdjdddZejedZdZdZdgZd gZeZZdqd!d"d#d$Zd%d&Zd'd(Zd)d*Zd+d,Z d-d.Z!d/d0Z"drd1d2Z#dsd3d4Z$dtd6d7Z%d8d9Z&e'Z(dud!e(d:d;d<Z)Gd=d>d>Z*Gd?d@d@Z+GdAdBdBe+Z,GdCdDdDZ-GdEdFdFe-e,Z.GdGdHdHe-e+Z/gZ0GdIdJdJe-e+Z1GdKdLdLZ2GdMdNdNZ3GdOdPdPZ4GdQdRdRZ5dvdSdTZ6dUdVZ7dWdXZ8dYdZZ9d[d\d]d^d_d`dadbdcdddedfdgdhdidjdkZ:dldmZ;d!S)wa^Core implementation of path-based import. This module is NOT meant to be directly imported! It has been designed such that it can be bootstrapped into Python as the implementation of import. As such it requires the injection of specific modules and attributes in order to work. One should use importlib as the public-facing version of this module. wincygwindarwincs<tjjtr0tjjtrdndfdd}ndd}|S)N PYTHONCASEOKs PYTHONCASEOKcs tjkS)z5True if filenames must be checked case-insensitively.)_osenviron)keyr5/usr/lib64/python3.6/importlib/_bootstrap_external.py _relax_case%sz%_make_relax_case.._relax_casecSsdS)z5True if filenames must be checked case-insensitively.Frrrrr r )s)sysplatform startswith_CASE_INSENSITIVE_PLATFORMS#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)r r)rr _make_relax_cases  rcCst|d@jddS)z*Convert a 32-bit integer to little-endian.llittle)intto_bytes)xrrr _w_long/srcCs tj|dS)z/Convert 4 bytes in little-endian to an integer.r)r from_bytes) int_bytesrrr _r_long4srcGstjdd|DS)zReplacement for os.path.join().cSsg|]}|r|jtqSr)rstrippath_separators).0partrrr ;sz_path_join..)path_sepjoin) path_partsrrr _path_join9s r"cCs`ttdkr$|jt\}}}||fSx2t|D]&}|tkr.|j|dd\}}||fSq.Wd|fS)z Replacement for os.path.split().)maxsplit)lenr rpartitionrreversedrsplit)pathfront_tailrrrr _path_split?s  r.cCs tj|S)z~Stat the path. Made a separate function to make it easier to override in experiments (e.g. cache stat results). )rstat)r*rrr _path_statKsr0c Cs0y t|}Wntk r dSX|jd@|kS)z1Test whether the path is the specified mode type.Fi)r0OSErrorst_mode)r*mode stat_inforrr _path_is_mode_typeUs  r5cCs t|dS)zReplacement for os.path.isfile.i)r5)r*rrr _path_isfile^sr6cCs|s tj}t|dS)zReplacement for os.path.isdir.i@)rgetcwdr5)r*rrr _path_isdircsr8cCsdj|t|}tj|tjtjBtjB|d@}y2tj|d}|j |WdQRXtj ||Wn:t k rytj |Wnt k rYnXYnXdS)zBest-effort function to write data to a path atomically. Be prepared to handle a FileExistsError if concurrent writing of the temporary file is attempted.z{}.{}iwbN) formatidropenO_EXCLO_CREATO_WRONLY_ioFileIOwritereplacer1unlink)r*datar3path_tmpfdfilerrr _write_atomicjsrJi3 rs __pycache__zopt-z.pyz.pycN) optimizationc Cs|dk r4tjdt|dk r(d}t||r0dnd}tj|}t|\}}|jd\}}}tj j } | dkrrt ddj |r~|n||| g} |dkrtj jdkrd}ntj j}t|}|dkr|jstd j|d j| t|} t|t| tdS) aGiven the path to a .py file, return the path to its .pyc file. The .py file does not need to exist; this simply returns the path to the .pyc file calculated as if the .py file were imported. The 'optimization' parameter controls the presumed optimization level of the bytecode file. If 'optimization' is not None, the string representation of the argument is taken and verified to be alphanumeric (else ValueError is raised). The debug_override parameter is deprecated. If debug_override is not None, a True value is the same as setting 'optimization' to the empty string while a False value is equivalent to setting 'optimization' to '1'. If sys.implementation.cache_tag is None then NotImplementedError is raised. NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Noner%r#.z$sys.implementation.cache_tag is Nonez{!r} is not alphanumericz{}.{}{}) _warningswarnDeprecationWarning TypeErrorrfspathr.r'r implementation cache_tagNotImplementedErrorr flagsoptimizestrisalnum ValueErrorr;_OPTr"_PYCACHEBYTECODE_SUFFIXES) r*debug_overriderMmessageheadr-basesepresttagalmost_filenamerrr cache_from_sources0    rhcCstjjdkrtdtj|}t|\}}t|\}}|tkrNtdj t||j d}|d krptdj |nV|dkr|j ddd }|j t stdj t |tt d}|jstd j ||jdd }t||td S) anGiven the path to a .pyc. file, return the path to its .py file. The .pyc file does not need to exist; this simply returns the path to the .py file calculated to correspond to the .pyc file. If path does not conform to PEP 3147/488 format, ValueError will be raised. If sys.implementation.cache_tag is None then NotImplementedError is raised. Nz$sys.implementation.cache_tag is Nonez%{} not bottom-level directory in {!r}rNrKz!expected only 2 or 3 dots in {!r}z9optimization portion of filename does not start with {!r}z4optimization level {!r} is not an alphanumeric valuerO>rKri)r rUrVrWrrTr.r^r\r;countr)r r]r&r[ partitionr"SOURCE_SUFFIXES)r*rbpycache_filenamepycache dot_countrM opt_level base_filenamerrr source_from_cache4s.        rsc Cst|dkrdS|jd\}}}| s:|jdddkr>|Sy t|}Wn$ttfk rn|dd }YnXt|r||S|S) zConvert a bytecode file path to a source path (if possible). This function exists purely for backwards-compatibility for PyImport_ExecCodeModuleWithFilenames() in the C API. rONrNrir#pyrv)r&r'lowerrsrWr\r6) bytecode_pathrer, extension source_pathrrr _get_sourcefileVs  r{c CsH|jttr.yt|Stk r*YqDXn|jttr@|SdSdS)N)endswithtuplermrhrWr_)filenamerrr _get_cachedisrc Cs4yt|j}Wntk r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.i)r0r2r1)r*r3rrr _calc_modeus  rc sDdfdd }y tj}Wntk r4dd}YnX|||S)zDecorator to verify that the module being requested matches the one the loader can handle. The first argument (self) must define _name which the second argument is compared against. If the comparison fails then ImportError is raised. NcsB|dkr|j}n |j|kr0td|j|f|d||f||S)Nzloader for %s cannot handle %s)name)r ImportError)selfrargskwargs)methodrr _check_name_wrappers  z(_check_name.._check_name_wrappercSs<x(dD] }t||rt||t||qW|jj|jdS)N __module____name__ __qualname____doc__)rrrr)hasattrsetattrgetattr__dict__update)newoldrDrrr _wraps  z_check_name.._wrap)N) _bootstrapr NameError)rrrr)rr _check_names  rcCs<|j|\}}|dkr8t|r8d}tj|j|dt|S)zTry to find a loader for the specified module by delegating to self.find_loader(). This method is deprecated in favor of finder.find_spec(). Nz,Not importing directory {}: missing __init__rO) find_loaderr&rPrQr; ImportWarning)rfullnameloaderportionsmsgrrr _find_module_shims rc Csi}|dk r||d<nd}|dk r*||d<|dd}|dd}|dd}|tkr|dj||}tjd |t|f|nVt|dkrd j|}tjd |t|n*t|dkrd j|}tjd |t||dk r|yt|d } Wntk rYn2Xt || kr4d j|}tjd |t|f|y|dd@} Wntk rZYn"Xt || kr|td j|f||ddS)azValidate the header of the passed-in bytecode against source_stats (if given) and returning the bytecode that can be compiled by compile(). All other arguments are used to enhance error reporting. ImportError is raised when the magic number is incorrect or the bytecode is found to be stale. EOFError is raised when the data is found to be truncated. Nrz r*r zbad magic number in {!r}: {!r}z{}z+reached EOF while reading timestamp in {!r}z0reached EOF while reading size of source in {!r}mtimezbytecode is stale for {!r}sizel) MAGIC_NUMBERr;r_verbose_messagerr&EOFErrorrKeyErrorr) rF source_statsrr* exc_detailsmagic raw_timestampraw_sizera source_mtime source_sizerrr _validate_bytecode_headersL                   rcCsPtj|}t|tr8tjd||dk r4tj|||Stdj |||ddS)zddl}tj|j}|j|}tjdd}|j|j|dS)zyDecode bytes representing source code and return the string. Universal newline support is used in the decoding. rONT)tokenizerABytesIOreadlinedetect_encodingIncrementalNewlineDecoderdecode) source_bytesrsource_bytes_readlineencodingnewline_decoderrrr decode_sources    r)rsubmodule_search_locationsc Cs|dkr get_filename)originT is_packagerO)rrrrrTr ModuleSpec _set_fileattr_get_supported_file_loadersr|r}r _POPULATErrr.append) rlocationrrspec loader_classsuffixesrdirnamerrr spec_from_file_location s>        rc@sPeZdZdZdZdZdZeddZeddZ edd d Z edd d Z d S)WindowsRegistryFinderz>Meta path finder for modules declared in the Windows registry.z;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFc Cs2ytjtj|Stk r,tjtj|SXdS)N)_winregOpenKeyHKEY_CURRENT_USERr1HKEY_LOCAL_MACHINE)clsrrrr _open_registry\sz$WindowsRegistryFinder._open_registrycCsp|jr|j}n|j}|j|dtjddd}y&|j|}tj|d}WdQRXWnt k rjdSX|S)Nz%d.%drK)r sys_versionr%) DEBUG_BUILDREGISTRY_KEY_DEBUG REGISTRY_KEYr;r version_inforr QueryValuer1)rr registry_keyrhkeyfilepathrrr _search_registrycs z&WindowsRegistryFinder._search_registryNcCsx|j|}|dkrdSy t|Wntk r6dSXx:tD]0\}}|jt|r@tj|||||d}|Sq@WdS)N)r)rr0r1rr|r}rspec_from_loader)rrr*targetrrrrrrr find_specrs  zWindowsRegistryFinder.find_speccCs"|j||}|dk r|jSdSdS)zlFind module named in the registry. This method is deprecated. Use exec_module() instead. N)rr)rrr*rrrr find_modules z!WindowsRegistryFinder.find_module)NN)N) rrrrrrr classmethodrrrrrrrr rPs   rc@s0eZdZdZddZddZddZdd Zd S) _LoaderBasicszSBase class of common code needed by both SourceLoader and SourcelessFileLoader.cCs@t|j|d}|jddd}|jdd}|dko>|dkS)zConcrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.r#rNrOrK__init__)r.rr)r')rrr~ filename_base tail_namerrr rsz_LoaderBasics.is_packagecCsdS)z*Use default semantics for module creation.Nr)rrrrr create_modulesz_LoaderBasics.create_modulecCs8|j|j}|dkr$tdj|jtjt||jdS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)get_coderrr;r_call_with_frames_removedexecr)rmodulerrrr exec_modules   z_LoaderBasics.exec_modulecCs tj||S)zThis module is deprecated.)r_load_module_shim)rrrrr load_modulesz_LoaderBasics.load_moduleN)rrrrrrrrrrrr rs rc@sJeZdZddZddZddZddZd d Zdd d dZddZ dS) SourceLoadercCstdS)zOptional method that returns the modification time (an int) for the specified path, where path is a str. Raises IOError when the path cannot be handled. N)IOError)rr*rrr path_mtimeszSourceLoader.path_mtimecCsd|j|iS)aOptional method returning a metadata dict for the specified path to by the path (str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source code. Implementing this method allows the loader to read bytecode files. Raises IOError when the path cannot be handled. r)r)rr*rrr path_statss zSourceLoader.path_statscCs |j||S)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. The source path is needed in order to correctly transfer permissions )set_data)rrz cache_pathrFrrr _cache_bytecodeszSourceLoader._cache_bytecodecCsdS)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. Nr)rr*rFrrr rszSourceLoader.set_datacCsR|j|}y|j|}Wn0tk rH}ztd|d|WYdd}~XnXt|S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data())rN)rget_datar1rr)rrr*rexcrrr get_sources zSourceLoader.get_sourcer#) _optimizecCstjt||dd|dS)zReturn the code object compiled from source. The 'data' argument can be any object type that compile() supports. rT) dont_inheritrY)rrcompile)rrFr*rrrr source_to_codes zSourceLoader.source_to_codec +Cs^|j|}d}y t|}Wntk r2d}YnXy|j|}Wntk rVYn~Xt|d}y|j|}Wntk rYnNXyt||||d}Wnt t fk rYn Xt j d||t ||||dS|j|}|j||} t j d|tj rZ|dk rZ|dk rZt| |t|}y|j|||t j d|Wntk rXYnX| S)zConcrete implementation of InspectLoader.get_code. Reading of bytecode requires path_stats to be implemented. To write bytecode, set_data must also be implemented. Nr)rrr*z {} matches {})rrxrzzcode object from {}z wrote {!r})rrhrWrrrrr1rrrrrrrr dont_write_bytecoderr&r) rrrzrrxstrF bytes_datar code_objectrrr rsN          zSourceLoader.get_codeNrv) rrrrrrrrrrrrrr rs   rcsPeZdZdZddZddZddZefdd Zed d Z d d Z Z S) FileLoaderzgBase file loader class which implements the loader protocol methods that require file system usage.cCs||_||_dS)zKCache the module name and the path to the file found by the finder.N)rr*)rrr*rrr r szFileLoader.__init__cCs|j|jko|j|jkS)N) __class__r)rotherrrr __eq__&s zFileLoader.__eq__cCst|jt|jAS)N)hashrr*)rrrr __hash__*szFileLoader.__hash__cstt|j|S)zdLoad a module from a file. This method is deprecated. Use exec_module() instead. )superr r)rr)r rr r-s zFileLoader.load_modulecCs|jS)z:Return the path to the source file as found by the finder.)r*)rrrrr r9szFileLoader.get_filenamec Cs tj|d }|jSQRXdS)z'Return the data from path as raw bytes.rN)rArBread)rr*rIrrr r>szFileLoader.get_data) rrrrrr rrrrr __classcell__rr)r r r s r c@s.eZdZdZddZddZdddd Zd S) SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cCst|}|j|jdS)z!Return the metadata for the path.)rr)r0st_mtimest_size)rr*rrrr rHszSourceFileLoader.path_statscCst|}|j|||dS)N)_mode)rr)rrzrxrFr3rrr rMsz SourceFileLoader._cache_bytecodei)rc Cst|\}}g}x(|r8t| r8t|\}}|j|qWxlt|D]`}t||}ytj|WqDtk rvwDYqDtk r}zt j d||dSd}~XqDXqDWyt |||t j d|Wn0tk r}zt j d||WYdd}~XnXdS)zWrite bytes data to a file.zcould not create {!r}: {!r}Nz created {!r}) r.r8rr(r"rmkdirFileExistsErrorr1rrrJ) rr*rFrparentr~r!rrrrr rRs*    zSourceFileLoader.set_dataN)rrrrrrrrrrr rDsrc@s eZdZdZddZddZdS)SourcelessFileLoaderz-Loader which handles sourceless file imports.cCs0|j|}|j|}t|||d}t|||dS)N)rr*)rrx)rrrr)rrr*rFrrrr rus  zSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nr)rrrrr r{szSourcelessFileLoader.get_sourceN)rrrrrrrrrr rqsrc@s\eZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ e ddZ dS)ExtensionFileLoaderz]Loader for extension modules. The constructor is designed to work with FileFinder. cCs||_||_dS)N)rr*)rrr*rrr rszExtensionFileLoader.__init__cCs|j|jko|j|jkS)N)r r)rr rrr r s zExtensionFileLoader.__eq__cCst|jt|jAS)N)r rr*)rrrr rszExtensionFileLoader.__hash__cCs$tjtj|}tjd|j|j|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})rrrcreate_dynamicrrr*)rrrrrr rs   z!ExtensionFileLoader.create_modulecCs$tjtj|tjd|j|jdS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)rrr exec_dynamicrrr*)rrrrr rszExtensionFileLoader.exec_modulecs$t|jdtfddtDS)z1Return True if the extension module is a package.r#c3s|]}d|kVqdS)rNr)rsuffix) file_namerr sz1ExtensionFileLoader.is_package..)r.r*anyEXTENSION_SUFFIXES)rrr)rr rs zExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nr)rrrrr rszExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nr)rrrrr rszExtensionFileLoader.get_sourcecCs|jS)z:Return the path to the source file as found by the finder.)r*)rrrrr rsz ExtensionFileLoader.get_filenameN)rrrrrr rrrrrrrrrrrr rsrc@s`eZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ dS)_NamespacePatha&Represents a namespace package's path. It uses the module name to find its parent module, and from there it looks up the parent's __path__. When this changes, the module's own path is recomputed, using path_finder. For top-level modules, the parent module's path is sys.path.cCs$||_||_t|j|_||_dS)N)_name_pathr}_get_parent_path_last_parent_path _path_finder)rrr* path_finderrrr rsz_NamespacePath.__init__cCs&|jjd\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rNr%r r*__path__)r r*)r$r')rrdotmerrr _find_parent_path_namessz&_NamespacePath._find_parent_path_namescCs|j\}}ttj||S)N)r-rr modules)rparent_module_namepath_attr_namerrr r&s z_NamespacePath._get_parent_pathcCsPt|j}||jkrJ|j|j|}|dk rD|jdkrD|jrD|j|_||_|jS)N)r}r&r'r(r$rrr%)r parent_pathrrrr _recalculates  z_NamespacePath._recalculatecCs t|jS)N)iterr2)rrrr __iter__sz_NamespacePath.__iter__cCs||j|<dS)N)r%)rindexr*rrr __setitem__sz_NamespacePath.__setitem__cCs t|jS)N)r&r2)rrrr __len__sz_NamespacePath.__len__cCs dj|jS)Nz_NamespacePath({!r}))r;r%)rrrr __repr__sz_NamespacePath.__repr__cCs ||jkS)N)r2)ritemrrr __contains__sz_NamespacePath.__contains__cCs|jj|dS)N)r%r)rr9rrr rsz_NamespacePath.appendN)rrrrrr-r&r2r4r6r7r8r:rrrrr r#s  r#c@sPeZdZddZeddZddZddZd d Zd d Z d dZ ddZ dS)_NamespaceLoadercCst||||_dS)N)r#r%)rrr*r)rrr rsz_NamespaceLoader.__init__cCs dj|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)r;r)rrrrr module_reprsz_NamespaceLoader.module_reprcCsdS)NTr)rrrrr rsz_NamespaceLoader.is_packagecCsdS)Nr%r)rrrrr rsz_NamespaceLoader.get_sourcecCstdddddS)Nr%zrT)r)r)rrrrr rsz_NamespaceLoader.get_codecCsdS)z*Use default semantics for module creation.Nr)rrrrr r sz_NamespaceLoader.create_modulecCsdS)Nr)rrrrr rsz_NamespaceLoader.exec_modulecCstjd|jtj||S)zbLoad a namespace module. This method is deprecated. Use exec_module() instead. z&namespace module loaded with path {!r})rrr%r)rrrrr rsz_NamespaceLoader.load_moduleN) rrrrrr<rrrrrrrrrr r;s r;c@sjeZdZdZeddZeddZeddZedd Zedd d Z edd dZ edddZ d S) PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs*x$tjjD]}t|dr |jq WdS)z}Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).invalidate_cachesN)r path_importer_cachevaluesrr>)rfinderrrr r>#s zPathFinder.invalidate_cachesc CsVtjdk rtj rtjdtx2tjD]$}y||Stk rHw&Yq&Xq&WdSdS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r path_hooksrPrQrr)rr*hookrrr _path_hooks+s   zPathFinder._path_hookscCsf|dkr*y tj}Wntk r(dSXytj|}Wn(tk r`|j|}|tj|<YnX|S)zGet the finder for the path entry from sys.path_importer_cache. If the path entry is not in the cache, find the appropriate finder and cache it. If no finder is available, store None. r%N)rr7FileNotFoundErrorr r?rrD)rr*rArrr _path_importer_cache8s  zPathFinder._path_importer_cachecCsRt|dr|j|\}}n|j|}g}|dk rrDrFrGrKrrrrrr r=s     r=c@sZeZdZdZddZddZeZddZdd Z dd d Z d dZ e ddZ ddZd S) FileFinderzFile-based finder. Interactions with the file system are cached for performance, being refreshed when the directory the finder is handling has been modified. csXg}x(|D] \}|jfdd|Dq W||_|p:d|_d|_t|_t|_dS)zInitialize with the path to search on and a variable number of 2-tuples containing the loader and the file suffixes the loader recognizes.c3s|]}|fVqdS)Nr)rr)rrr r sz&FileFinder.__init__..rNr#Nrv)r_loadersr* _path_mtimeset _path_cache_relaxed_path_cache)rr*loader_detailsloadersrr)rr rs zFileFinder.__init__cCs d|_dS)zInvalidate the directory mtime.r#Nrv)rO)rrrr r>szFileFinder.invalidate_cachescCs*|j|}|dkrdgfS|j|jp&gfS)zTry to find a loader for the specified module, or the namespace package portions. Returns (loader, list-of-portions). This method is deprecated. Use find_spec() instead. N)rrr)rrrrrr rs zFileFinder.find_loadercCs|||}t||||dS)N)rr)r)rrrr*smslrrrrr rKs zFileFinder._get_specNcCsbd}|jdd}yt|jp"tjj}Wntk rBd }YnX||jkr\|j||_t rr|j }|j }n |j }|}||krt |j|}xH|jD]6\} } d| } t || } t| r|j| || |g|SqWt|}xX|jD]N\} } t |j|| } tjd| dd|| |krt| r|j| || d|SqW|r^tjd |tj|d} |g| _| SdS) zoTry to find a spec for the specified module. Returns the matching spec, or None if not found. FrNrKr#rz trying {}) verbosityNzpossible namespace for {}rv)r'r0r*rr7rr1rO _fill_cacher rRrwrQr"rNr6rKr8rrrr)rrr is_namespace tail_modulercache cache_module base_pathrr init_filename full_pathrrrr rsF          zFileFinder.find_specc Cs|j}ytj|ptj}Wntttfk r:g}YnXtjj dsTt ||_ nNt }x@|D]8}|j d\}}}|rdj ||j}n|}|j|q`W||_ tjj trdd|D|_dS)zDFill the cache of potential modules and packages for this directory.rrNz{}.{}cSsh|] }|jqSr)rw)rfnrrr sz)FileFinder._fill_cache..N)r*rlistdirr7rEPermissionErrorNotADirectoryErrorr r r rPrQrlr;rwaddrrR) rr*contentslower_suffix_contentsr9rr+rnew_namerrr rWs"     zFileFinder._fill_cachecsfdd}|S)aA class method which returns a closure to use on sys.path_hook which will return an instance using the specified loaders and the path called on the closure. If the path called on the closure is not a directory, ImportError is raised. cs"t|std|d|fS)z-Path hook for importlib.machinery.FileFinder.zonly directories are supported)r*)r8r)r*)rrSrr path_hook_for_FileFinder*s z6FileFinder.path_hook..path_hook_for_FileFinderr)rrSrhr)rrSr path_hook s zFileFinder.path_hookcCs dj|jS)NzFileFinder({!r}))r;r*)rrrr r82szFileFinder.__repr__)N)rrrrrr>rrrrKrrWrrir8rrrr rMs  0 rMc Cs|jd}|jd}|sB|r$|j}n||kr8t||}n t||}|sTt|||d}y$||d<||d<||d<||d<Wntk rYnXdS)N __loader____spec__)r__file__ __cached__)getrrrr Exception)nsrpathname cpathnamerrrrr _fix_up_module8s"     rscCs*tttjf}ttf}ttf}|||gS)z_Returns a list of file-based module loaders. Each item is a tuple (loader, suffixes). )r_alternative_architecturesrextension_suffixesrrmrr_) extensionssourcebytecoderrr rOsrc Cs|atjatjatjt}x8dD]0}|tjkr:tj|}n tj|}t|||q Wddgfdddgff}x`|D]P\}}|d }|tjkrtj|}Pqpytj|}PWqptk rwpYqpXqpWtd t|d |t|d |t|d dj|ytjd} Wntk rd} YnXt|d| tjd} t|d| |dkrbtjd} t|d| t|dt t j t tj |dkrtjddt krdt_dS)zSetup the path-based importers for importlib by importing needed built-in modules and injecting them into the global namespace. Other components are extracted from the core bootstrap module. rArPbuiltinsrposix/nt\rOzimportlib requires posix or ntrrrr%_threadN_weakrefwinregrr z.pywz_d.pydT)rArPryr)rr rr.r_builtin_from_namerrr rr"rrtrurmrrr) _bootstrap_module self_module builtin_namebuiltin_module os_details builtin_osrr os_module thread_moduleweakref_module winreg_modulerrr _setupZsP                     rcCs2t|t}tjjtj|gtjjt dS)z)Install the path-based import components.N) rrr rBrrMri meta_pathrr=)rsupported_loadersrrr _installsrz-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.)z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.z-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.cCsFx@|D]8}x2tjD]&\}}||kr|j|j|||SqWqW|S)zAdd a suffix with an alternative architecture name to the list of suffixes so an extension built with the default (upstream) setting is loadable with our Pythons ) _ARCH_MAPitemsrrD)rroriginal alternativerrr rts   rt)r)rr)r9)N)NNN)NNN)rOrO)N)N)s     { -"   7 C@n)-5<*  D