B Hh"p-%@sdZdZdZeeZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ daddZ ee jZddddZeedZdZdZdgZdgZeZZdbd d!d"d#Zd$d%Zd&d'Zd(d)Zd*d+Z d,d-Z!d.d/Z"d0d1Z#d2d3Z$d4d5Z%dcd6d7Z&ddd9d:Z'dedd?Z)e*Z+dfd e+d@dAdBZ,GdCdDdDZ-GdEdFdFZ.GdGdHdHe.Z/GdIdJdJZ0GdKdLdLe0e/Z1GdMdNdNe0e.Z2gZ3GdOdPdPe0e.Z4GdQdRdRZ5GdSdTdTZ6GdUdVdVZ7GdWdXdXZ8dgdYdZZ9d[d\Z:d]d^Z;d_d`Z._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@ddS)z*Convert a 32-bit integer to little-endian.llittle)intto_bytes)xrrr _w_long.srcCs t|dS)z/Convert 4 bytes in little-endian to an integer.r)r from_bytes) int_bytesrrr _r_long3srcGstdd|DS)zReplacement for os.path.join().cSsg|]}|r|tqSr)rstrippath_separators).0partrrr :sz_path_join..)path_sepjoin) path_partsrrr _path_join8s r"cCs`ttdkr$|t\}}}||fSx2t|D]&}|tkr.|j|dd\}}||fSq.Wd|fS)z Replacement for os.path.split().)maxsplit)lenr rpartitionrreversedrsplit)pathfront_tailrrrr _path_split>s  r.cCs t|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_statJsr0cCs0y 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_typeTs  r5cCs t|dS)zReplacement for os.path.isfile.i)r5)r*rrr _path_isfile]sr6cCs|s t}t|dS)zReplacement for os.path.isdir.i@)rgetcwdr5)r*rrr _path_isdirbsr8c Csd|t|}t|tjtjBtjB|d@}y2t|d}| |WdQRXt ||Wn:t k ryt |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_atomicisrJiB rs __pycache__zopt-z.pyz.pycN) optimizationc Cs|dk r4tdt|dk r(d}t||r0dnd}t|}t|\}}|d\}}}tj j } | dkrrt dd |r~|n||| g} |dkrtj jdkrd}ntj j}t|}|dkr|std |d | 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    rhcCstjjdkrtdt|}t|\}}t|\}}|tkrNtd t|| d}|dkrptd |nV|dkr| ddd }| t std t |tt d}|std ||dd }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}rN>rKz!expected only 2 or 3 dots in {!r}rirKz9optimization portion of filename does not start with {!r}z4optimization level {!r} is not an alphanumeric valuerO)r rUrVrWrrTr.r^r\r;countr)r r]r&r[ partitionr"SOURCE_SUFFIXES)r*rbpycache_filenamepycache dot_countrM opt_level base_filenamerrr source_from_cache<s.        rsc Cs~t|dkrdS|d\}}}|r8|dddkr<|Sy t|}Wn$ttfk rl|dd}YnXt|rz|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. rONrNpy)r&r'lowerrsrWr\r6) bytecode_pathrer, extension source_pathrrr _get_sourcefile^s  r{cCsH|ttr.yt|Stk r*YqDXn|ttr@|SdSdS)N)endswithtuplermrhrWr_)filenamerrr _get_cachedqsrcCs4yt|j}Wntk r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.i)r0r2r1)r*r3rrr _calc_mode}s  rcsDdfdd }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|j|jdS)N) __module____name__ __qualname____doc__)hasattrsetattrgetattr__dict__update)newoldrDrrr _wraps  z_check_name.._wrap)N) _bootstrapr NameError)rrrr)rr _check_names  rcCs<||\}}|dkr8t|r8d}t||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 rcCs|dd}|tkrB}|t||||t||S)z&Produce the data for a hash-based pyc.r#)rrrrrr)rrcheckedrFrXrrr _code_to_hash_pyc"s   rcCs>ddl}t|j}||}tdd}|||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_source-s    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}\DebugFcCs2yttj|Stk r,ttj|SXdS)N)_winregOpenKeyHKEY_CURRENT_USERr1HKEY_LOCAL_MACHINE)clsrrrr _open_registrysz$WindowsRegistryFinder._open_registryc Csp|jr|j}n|j}|j|dtjddd}y&||}t|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_registrys z&WindowsRegistryFinder._search_registryNcCsx||}|dkrdSy t|Wntk r6dSXx:tD]0\}}|t|r@tj|||||d}|Sq@WdS)N)r)rr0r1rr|r}rspec_from_loader)rrr*targetrrrrrrr find_specs  zWindowsRegistryFinder.find_speccCs"|||}|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 rs   rc@s0eZdZdZddZddZddZdd Zd S) _LoaderBasicszSBase class of common code needed by both SourceLoader and SourcelessFileLoader.cCs@t||d}|ddd}|dd}|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}|dkr$td|jtt||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 t||S)zThis module is deprecated.)r_load_module_shim)rrrrr load_modulesz_LoaderBasics.load_moduleN)rrrrrrrrrrrr rs rc@sJeZdZddZddZddZddZd d Zd d d dZddZ dS) SourceLoadercCstdS)zOptional method that returns the modification time (an int) for the specified path, where path is a str. Raises OSError when the path cannot be handled. N)r1)rr*rrr path_mtimeszSourceLoader.path_mtimecCsd||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 OSError when the path cannot be handled. r)r)rr*rrr path_statss zSourceLoader.path_statscCs |||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_datac CsR||}y||}Wn0tk rH}ztd|d|Wdd}~XYnXt|S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data())rN)rget_datar1rr)rrr*rexcrrr get_sources zSourceLoader.get_sourceru) _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.||}d}d}d}d}d}y t|}Wntk rDd}Yn0Xy||} Wntk rjYn Xt| d}y||} Wntk rYnX||d} yt| || } t| dd} | d@dk}|r$| d @dk}t j d kr8|st j d kr8||}t t |}t | ||| nt| || d || Wnttfk rTYn Xtd ||t| |||dS|dkr||}|||}td|tjs*|dk r*|dk r*|r|dkrt |}t|||} nt||t|} y|||| td|Wntk r(YnX|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. NFTr)rr*rr#rOrKneveralwayssizez {} matches {})rrxrzzcode object from {}z wrote {!r})rrhrWrr1rrr memoryviewrcheck_hash_based_pycsr_RAW_MAGIC_NUMBERrrrrrrrrr dont_write_bytecoderrr&r)rrrzrrr hash_based check_sourcerxstrFrrX bytes_data code_objectrrr rs                   zSourceLoader.get_codeN) rrrrrrrrrrrrrr rs   rcs|eZdZdZddZddZddZefdd Zed d Z d d Z eddZ ddZ ddZ ddZddZZS) 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 rtszFileLoader.__init__cCs|j|jko|j|jkS)N) __class__r)rotherrrr __eq__zs zFileLoader.__eq__cCst|jt|jAS)N)hashrr*)rrrr __hash__~szFileLoader.__hash__cstt||S)zdLoad a module from a file. This method is deprecated. Use exec_module() instead. )superrr)rr)rrr rs zFileLoader.load_modulecCs|jS)z:Return the path to the source file as found by the finder.)r*)rrrrr rszFileLoader.get_filenamec Cs t|d }|SQRXdS)z'Return the data from path as raw bytes.rN)rArBread)rr*rIrrr rszFileLoader.get_datacCs||r|SdS)N)r)rrrrr get_resource_readers zFileLoader.get_resource_readercCs tt|jd|}t|dS)NrOr)r"r.r*rArB)rresourcer*rrr open_resourceszFileLoader.open_resourcecCs&||sttt|jd|}|S)NrO) is_resourceFileNotFoundErrorr"r.r*)rrr*rrr resource_paths zFileLoader.resource_pathcCs(t|kr dStt|jd|}t|S)NFrO)rr"r.r*r6)rrr*rrr rszFileLoader.is_resourcecCsttt|jdS)NrO)iterrlistdirr.r*)rrrr contentsszFileLoader.contents)rrrrrrrrrrrrrr rr# __classcell__rr)rr ros  rc@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 rszSourceFileLoader.path_statscCst|}|j|||dS)N)_mode)rr)rrzrxrFr3rrr rsz SourceFileLoader._cache_bytecodei)r(c Cst|\}}g}x&|r6t|s6t|\}}||qWxnt|D]b}t||}yt|WqBtk rtwBYqBtk r}zt d||dSd}~XYqBXqBWyt |||t d|Wn0tk r}zt d||Wdd}~XYnXdS)zWrite bytes data to a file.zcould not create {!r}: {!r}Nz created {!r}) r.r8rr(r"rmkdirFileExistsErrorr1rrrJ) rr*rFr(parentr~r!rrrrr rs*    zSourceFileLoader.set_dataN)rrrrrrrrrrr r%sr%c@s eZdZdZddZddZdS)SourcelessFileLoaderz-Loader which handles sourceless file imports.cCsD||}||}||d}t|||tt|dd||dS)N)rr*r)rrx)rrrrr )rrr*rFrrrr rs   zSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nr)rrrrr rszSourcelessFileLoader.get_sourceN)rrrrrrrrrr r,sr,c@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)rr)rrrrr r s zExtensionFileLoader.__eq__cCst|jt|jAS)N)rrr*)rrrr r szExtensionFileLoader.__hash__cCs$ttj|}td|j|j|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})rrrcreate_dynamicrrr*)rrrrrr rs   z!ExtensionFileLoader.create_modulecCs$ttj|td|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)r1r rs zExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nr)rrrrr r$szExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nr)rrrrr r(szExtensionFileLoader.get_sourcecCs|jS)z:Return the path to the source file as found by the finder.)r*)rrrrr r,sz ExtensionFileLoader.get_filenameN)rrrrrrrrrrrrrrrrrr r-sr-c@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||_||_dS)N)_name_pathr}_get_parent_path_last_parent_path _path_finder)rrr* path_finderrrr r9sz_NamespacePath.__init__cCs&|jd\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rNr%)r r*__path__)r6r')rr+dotmerrr _find_parent_path_names?sz&_NamespacePath._find_parent_path_namescCs|\}}ttj||S)N)r?rr modules)rparent_module_namepath_attr_namerrr r8Is z_NamespacePath._get_parent_pathcCsPt|}||jkrJ||j|}|dk rD|jdkrD|jrD|j|_||_|jS)N)r}r8r9r:r6rrr7)r parent_pathrrrr _recalculateMs  z_NamespacePath._recalculatecCs t|S)N)r!rD)rrrr __iter__Zsz_NamespacePath.__iter__cCs||j|<dS)N)r7)rindexr*rrr __setitem__]sz_NamespacePath.__setitem__cCs t|S)N)r&rD)rrrr __len__`sz_NamespacePath.__len__cCs d|jS)Nz_NamespacePath({!r}))r;r7)rrrr __repr__csz_NamespacePath.__repr__cCs ||kS)N)rD)ritemrrr __contains__fsz_NamespacePath.__contains__cCs|j|dS)N)r7r)rrJrrr risz_NamespacePath.appendN)rrrrrr?r8rDrErGrHrIrKrrrrr r52s  r5c@sPeZdZddZeddZddZddZd d Zd d Z d dZ ddZ dS)_NamespaceLoadercCst||||_dS)N)r5r7)rrr*r;rrr rosz_NamespaceLoader.__init__cCs d|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)r;r)rrrrr module_reprrsz_NamespaceLoader.module_reprcCsdS)NTr)rrrrr r{sz_NamespaceLoader.is_packagecCsdS)Nr%r)rrrrr r~sz_NamespaceLoader.get_sourcecCstdddddS)Nr%zrT)r)r)rrrrr rsz_NamespaceLoader.get_codecCsdS)z*Use default semantics for module creation.Nr)rrrrr rsz_NamespaceLoader.create_modulecCsdS)Nr)rrrrr rsz_NamespaceLoader.exec_modulecCstd|jt||S)zbLoad a namespace module. This method is deprecated. Use exec_module() instead. z&namespace module loaded with path {!r})rrr7r)rrrrr rsz_NamespaceLoader.load_moduleN) rrrrrrMrrrrrrrrrr rLns rLc@sjeZdZdZeddZeddZeddZedd Zedd d Z edd dZ edddZ d S) PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCsDx>ttjD],\}}|dkr*tj|=qt|dr|qWdS)z}Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).Ninvalidate_caches)listr path_importer_cacheitemsrrO)rrfinderrrr rOs   zPathFinder.invalidate_cachesc CsTtjdk rtjstdtx2tjD]$}y||Stk rFw$Yq$Xq$WdSdS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r path_hooksrPrQrr)rr*hookrrr _path_hookss   zPathFinder._path_hookscCsf|dkr*y t}Wntk r(dSXytj|}Wn(tk r`||}|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)rr7rr rQKeyErrorrV)rr*rSrrr _path_importer_caches  zPathFinder._path_importer_cachecCsRt|dr||\}}n||}g}|dk r.rNruN)r_loadersr* _path_mtimeset _path_cache_relaxed_path_cache)rr*loader_detailsloadersrr)rr r's zFileFinder.__init__cCs d|_dS)zInvalidate the directory mtime.ruN)r`)rrrr rO5szFileFinder.invalidate_cachescCs*||}|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 r;s zFileFinder.find_loadercCs|||}t||||dS)N)rr)r)rrrr*smslrrrrr r]Gs zFileFinder._get_specNcCsbd}|dd}yt|jp"tj}Wntk rBd}YnX||jkr\|||_t rr|j }| }n |j }|}||krt |j|}xH|jD]6\} } d| } t || } t| r|| || |g|SqWt|}xX|jD]N\} } t |j|| } tjd| dd|| |krt| r|| || d|SqW|r^td |t|d} |g| _| SdS) zoTry to find a spec for the specified module. Returns the matching spec, or None if not found. FrNrKrurz trying {}) verbosityNzpossible namespace for {})r'r0r*rr7r&r1r` _fill_cacher rcrwrbr"r_r6r]r8rrrr)rrr is_namespace tail_modulercache cache_module base_pathr0r init_filename full_pathrrrr rLsF          zFileFinder.find_specc Cs|j}yt|pt}Wntttfk r:g}YnXtj dsTt ||_ nNt }x@|D]8}| d\}}}|rd ||}n|}||q`W||_ tj trdd|D|_dS)zDFill the cache of potential modules and packages for this directory.rrNz{}.{}cSsh|] }|qSr)rw)rfnrrr sz)FileFinder._fill_cache..N)r*rr"r7rPermissionErrorNotADirectoryErrorr r r rarbrlr;rwaddrrc) rr*r#lower_suffix_contentsrJrr=r0new_namerrr rh|s"     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*)rrdrr path_hook_for_FileFinders z6FileFinder.path_hook..path_hook_for_FileFinderr)rrdrwr)rrdr path_hooks zFileFinder.path_hookcCs d|jS)NzFileFinder({!r}))r;r*)rrrr rIszFileFinder.__repr__)N)rrrrrrOrrrr]rrhrrxrIrrrr r^s  0 r^cCs|d}|d}|sB|r$|j}n||kr8t||}n t||}|sTt|||d}y$||d<||d<||d<||d<Wntk rYnXdS)N __loader____spec__)r__file__ __cached__)getrr,r%r Exception)nsrpathname cpathnamerrrrr _fix_up_modules"     rcCs&ttf}ttf}ttf}|||gS)z_Returns a list of file-based module loaders. Each item is a tuple (loader, suffixes). )r-rextension_suffixesr%rmr,r_) extensionssourcebytecoderrr rs rc Cs|atjatjatjt}x8dD]0}|tjkr:t|}n tj|}t|||q Wddgfdddgff}x`|D]P\}}|d}|tjkrtj|}Pqpyt|}PWqptk rwpYqpXqpWtdt|d|t|d |t|d d |td } t|d | td } t|d | |dkrBtd} t|d| t|dt t t |dkrt ddt 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%_thread_weakrefwinregrr z.pywz_d.pydTN)rr rr@r_builtin_from_namerrr rr4rrrmrrr) _bootstrap_module self_module builtin_namebuiltin_module os_details builtin_osrr os_module thread_moduleweakref_module winreg_modulerrr _setupsJ                     rcCs2t|t}tjtj|gtjt dS)z)Install the path-based import components.N) rrr rTrr^rx meta_pathrrN)rsupported_loadersrrr _installsr)r9)N)NNN)rOrO)T)N)N)=rr%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrrrr"r.r0r5r6r8rJtype__code__rrrrrr r^r]rmr_DEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESrhrsr{rrrrrrrrrrrobjectrrrrrrr%r,r4r-r5rLrNr^rrrrrrrr sv      -"  ! C@D-5<*  @