U &Ì.eœã@sødZddladdlZddladdlZddlZtjdkZerLddlZ ddl Z nddl Z erbddgZ ndgZ e dZ ee ƒZd e ¡Z dd„e DƒZd Zd ZeeZd d „Zd d„Zdd„Zdd„ZerÎdd„Zndd„Zdd„Zdd„Zdd„Zdd„Zdd„Ze�rd d!„Znd"d!„Zd€d$d%„Z e!e j"ƒZ#d& $d'd(¡d)Z%e& 'e%d(¡Z(d*Z)d+Z*d,gZ+d-gZ,e,Z-Z.d�dd.œd/d0„Z/d1d2„Z0d3d4„Z1d5d6„Z2d7d8„Z3d9d:„Z4d;d<„Z5d=d>„Z6d?d@„Z7dAdB„Z8d‚dCdD„Z9dƒdEdF„Z:d„dHdI„Z;dJdK„Zd…de>dLœdMdN„Z?GdOdP„dPƒZ@GdQdR„dRƒZAGdSdT„dTeAƒZBGdUdV„dVƒZCGdWdX„dXeCeBƒZDGdYdZ„dZeCeAƒZEgZFGd[d\„d\eCeAƒZGGd]d^„d^ƒZHGd_d`„d`ƒZIGdadb„dbƒZJGdcdd„ddƒZKd†dedf„ZLdgdh„ZMdidj„ZNdkdl„ZOdmdndodpdqdrdsdtdudvdwdxdydzd{d|d}œZPd~d„ZQdS)‡a^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. éNZwin32ú\ú/ÚcCsh|]}d|›�’qS©ú:©©Ú.0Úsrrú5/usr/lib64/python3.8/importlib/_bootstrap_external.pyÚ /sr )Úwin)ÚcygwinÚdarwincs<tj t¡r0tj t¡rd‰nd‰‡fdd„}ndd„}|S)NÚ PYTHONCASEOKs PYTHONCASEOKcs ˆtjkS)ú5True if filenames must be checked case-insensitively.)Ú_osÚenvironr©Úkeyrr Ú _relax_case@sz%_make_relax_case.._relax_casecSsdS)rFrrrrr rDs)ÚsysÚplatformÚ startswithÚ_CASE_INSENSITIVE_PLATFORMSÚ#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rrrr Ú_make_relax_case9s  rcCst|ƒd@ dd¡S)z*Convert a 32-bit integer to little-endian.ìÿÿéÚlittle)ÚintÚto_bytes)Úxrrr Ú _pack_uint32Jsr#cCs t |d¡S)z/Convert 4 bytes in little-endian to an integer.r©r Ú from_bytes©Údatarrr Ú_unpack_uint32Osr(cCs t |d¡S)z/Convert 2 bytes in little-endian to an integer.rr$r&rrr Ú_unpack_uint16Tsr)cGsä|sdSt|ƒdkr|dSd}g}ttj|ƒD]z\}}| t¡sL| t¡rf| t¡pX|}t |g}q0| d¡r˜|  ¡|  ¡krŒ|}|g}qª|  |¡q0|pž|}|  |¡q0dd„|Dƒ}t|ƒdkrÖ|dsÖ|t S|t   |¡S)úReplacement for os.path.join().rérrcSsg|]}|r| t¡‘qSr©ÚrstripÚpath_separators©r Úprrr Ú rsú_path_join..) ÚlenÚmaprÚ_path_splitrootrÚpath_sep_tupleÚendswithr-r.Úpath_sepÚcasefoldÚappendÚjoin)Ú path_partsÚrootÚpathZnew_rootÚtailrrr Ú _path_join[s*     r@cGst dd„|Dƒ¡S)r*cSsg|]}|r| t¡‘qSrr,)r Úpartrrr r1{sÿr2)r8r;)r<rrr r@ys ÿcsBt‡fdd„tDƒƒ}|dkr&dˆfSˆd|…ˆ|dd…fS)z Replacement for os.path.split().c3s|]}ˆ |¡VqdS©N)Úrfindr/©r>rr Ú �sz_path_split..rrNr+)Úmaxr.)r>ÚirrDr Ú _path_splitsrHcCs t |¡S)z~Stat the path. Made a separate function to make it easier to override in experiments (e.g. cache stat results). )rÚstatrDrrr Ú _path_stat‡srJcCs2z t|ƒ}Wntk r"YdSX|jd@|kS)z1Test whether the path is the specified mode type.Fið)rJÚOSErrorÚst_mode)r>ÚmodeÚ stat_inforrr Ú_path_is_mode_type‘s  rOcCs t|dƒS)zReplacement for os.path.isfile.i€)rOrDrrr Ú _path_isfilešsrPcCs|s t ¡}t|dƒS)zReplacement for os.path.isdir.i@)rÚgetcwdrOrDrrr Ú _path_isdirŸsrRcCs>|sdSt |¡d dd¡}t|ƒdko<| d¡p<| d¡S)úReplacement for os.path.isabs.Frrrr+z\\)rr5Úreplacer3rr7)r>r=rrr Ú _path_isabs§srUcCs | t¡S)rS)rr.rDrrr rU¯sé¶c Cs¢d |t|ƒ¡}t |tjtjBtjB|d@¡}z2t |d¡�}|  |¡W5QRXt  ||¡Wn:t k rœzt  |¡Wnt k r”YnX‚YnXdS)z¢Best-effort function to write data to a path atomically. Be prepared to handle a FileExistsError if concurrent writing of the temporary file is attempted.ú{}.{}rVÚwbN) ÚformatÚidrÚopenÚO_EXCLÚO_CREATÚO_WRONLYÚ_ioÚFileIOÚwriterTrKÚunlink)r>r'rMÚpath_tmpÚfdÚfilerrr Ú _write_atomic´sÿrfiU érs Ú __pycache__zopt-z.pyz.pyc)Ú optimizationc CsX|dk r4t dt¡|dk r(d}t|ƒ‚|r0dnd}t |¡}t|ƒ\}}| d¡\}}}tj j } | dkrrt dƒ‚d  |r~|n||| g¡} |dkr¬tj jdkr¤d}ntj j}t|ƒ}|dkrà| ¡sÒtd  |¡ƒ‚d  | t|¡} | td} tjdk �rLt|ƒ�stt ¡|ƒ}|dd k�r8|dtk�r8|d d…}ttj| t¡| ƒSt|t| ƒS) aþGiven 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 Nonerr+Ú.ú$sys.implementation.cache_tag is Nonerz{!r} is not alphanumericz{}.{}{}rrg)Ú _warningsÚwarnÚDeprecationWarningÚ TypeErrorrÚfspathrHÚ rpartitionrÚimplementationÚ cache_tagÚNotImplementedErrorr;ÚflagsÚoptimizeÚstrÚisalnumÚ ValueErrorrYÚ_OPTÚBYTECODE_SUFFIXESÚpycache_prefixrUr@rQr.ÚlstripÚ_PYCACHE) r>Údebug_overrideriÚmessageÚheadr?ÚbaseÚsepÚrestÚtagÚalmost_filenameÚfilenamerrr Úcache_from_sourcebsHÿ       ýrˆc Cs.tjjdkrtdƒ‚t |¡}t|ƒ\}}d}tjdk rftj t ¡}|  |t ¡rf|t |ƒd…}d}|s�t|ƒ\}}|t kr�tt ›d|›�ƒ‚| d¡}|dkr²td|›�ƒ‚n\|d k�r| dd ¡d }|  t¡sätd t›�ƒ‚|t tƒd…}| ¡�std |›d�ƒ‚| d¡d} 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. NrkFTz not bottom-level directory in rj>rgézexpected only 2 or 3 dots in r‰rgéþÿÿÿz5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer)rrrrsrtrrprHr|r-r.rr8r3r~ryÚcountÚrsplitrzrxÚ partitionr@ÚSOURCE_SUFFIXES) r>r�Úpycache_filenameÚfound_in_pycache_prefixÚ stripped_pathÚpycacheÚ dot_countriÚ opt_levelÚ base_filenamerrr Úsource_from_cache©s4          r–c Cs~t|ƒdkrdS| d¡\}}}|r8| ¡dd…dkr<|Sz t|ƒ}Wn$ttfk rl|dd…}YnXt|ƒrz|S|S)z¼Convert a bytecode file path to a source path (if possible). This function exists purely for backwards-compatibility for PyImport_ExecCodeModuleWithFilenames() in the C API. rNrjéýÿÿÿéÿÿÿÿÚpy)r3rqÚlowerr–rtryrP)Ú bytecode_pathr„Ú_Ú extensionÚ source_pathrrr Ú_get_sourcefileÑs  rŸcCsJ| ttƒ¡r0z t|ƒWStk r,YqFXn| ttƒ¡rB|SdSdSrB)r7ÚtuplerŽrˆrtr{)r‡rrr Ú _get_cachedäs r¡cCs4zt|ƒj}Wntk r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.rVé€)rJrLrK)r>rMrrr Ú _calc_modeðs  r£csDd‡fdd„ }z tj}Wntk r4dd„}YnX||ˆƒ|S)züDecorator 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)Úselfr¥ÚargsÚkwargs©Úmethodrr Ú_check_name_wrappers ÿÿz(_check_name.._check_name_wrappercSs8dD] }t||ƒrt||t||ƒƒq|j |j¡dS)N)Ú __module__Ú__name__Ú __qualname__Ú__doc__)ÚhasattrÚsetattrÚgetattrÚ__dict__Úupdate)ÚnewÚoldrTrrr Ú_wraps z_check_name.._wrap)N)Ú _bootstrapr¸Ú NameError)r«r¬r¸rrªr Ú _check_nameüs  r»cCs<| |¡\}}|dkr8t|ƒr8d}t | |d¡t¡|S)z›Try 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__r)Ú find_loaderr3rlrmrYÚ ImportWarning)r§ÚfullnameÚloaderÚportionsÚmsgrrr Ú_find_module_shims rÂcCsž|dd…}|tkr) ÚmarshalÚloadsÚ isinstanceÚ _code_typer¹rÈÚ_impÚ_fix_co_filenamer¦rY)r'r¥r›ržÚcoderrr Ú_compile_bytecode~s     ÿrÛcCsFttƒ}| tdƒ¡| t|ƒ¡| t|ƒ¡| t |¡¡|S)z+Produce the data for a timestamp-based pyc.r©Ú bytearrayrÇÚextendr#rÔÚdumps)rÚÚmtimerÏr'rrr Ú_code_to_timestamp_pyc‹s ráTcCs@ttƒ}d|d>B}| t|ƒ¡| |¡| t |¡¡|S)z&Produce the data for a hash-based pyc.r+rÜ)rÚrÑÚcheckedr'rurrr Ú_code_to_hash_pyc•s   rãcCs>ddl}t |¡j}| |¡}t dd¡}| | |d¡¡S)zyDecode bytes representing source code and return the string. Universal newline support is used in the decoding. rNT)Útokenizer_ÚBytesIOÚreadlineÚdetect_encodingÚIncrementalNewlineDecoderÚdecode)Ú source_bytesräÚsource_bytes_readlineÚencodingÚnewline_decoderrrr Ú decode_source s    rî©r¿Úsubmodule_search_locationsc Cs|dkrÚ get_filename©ÚoriginTÚ is_packager)r±rñr¦rrpr¹Ú ModuleSpecÚ _set_fileattrÚ_get_supported_file_loadersr7r r¿Ú _POPULATErôrðrHr:) r¥Úlocationr¿rðÚspecÚ loader_classÚsuffixesrôÚdirnamerrr Úspec_from_file_location±s>        rþc@sPeZdZdZdZdZdZedd„ƒZedd„ƒZ 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}\DebugFcCs8zt tj|¡WStk r2t tj|¡YSXdSrB)Ú_winregÚOpenKeyÚHKEY_CURRENT_USERrKÚHKEY_LOCAL_MACHINE)Úclsrrrr Ú_open_registrysz$WindowsRegistryFinder._open_registryc Csr|jr|j}n|j}|j|dtjdd…d�}z&| |¡�}t |d¡}W5QRXWnt k rlYdSX|S)Nz%d.%drg)r¾Ú sys_versionr) Ú DEBUG_BUILDÚREGISTRY_KEY_DEBUGÚ REGISTRY_KEYrYrÚ version_inforrÚ QueryValuerK)rr¾Ú registry_keyrÚhkeyÚfilepathrrr Ú_search_registrysÿ z&WindowsRegistryFinder._search_registryNcCsz| |¡}|dkrdSz t|ƒWntk r8YdSXtƒD]4\}}| t|ƒ¡r@tj||||ƒ|d�}|Sq@dS)Nrò)rrJrKr÷r7r r¹Úspec_from_loader)rr¾r>Útargetrr¿rürúrrr Ú find_specs  þzWindowsRegistryFinder.find_speccCs"| ||¡}|dk r|jSdSdS)zlFind module named in the registry. This method is deprecated. Use exec_module() instead. N©rr¿©rr¾r>rúrrr Ú find_module's z!WindowsRegistryFinder.find_module)NN)N) r®r­r¯r°r rrÚ classmethodrrrrrrrr rÿõsÿÿ   rÿc@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) Ú _LoaderBasicszSBase class of common code needed by both SourceLoader and SourcelessFileLoader.cCs@t| |¡ƒd}| dd¡d}| d¡d}|dko>|dkS)z�Concrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.r+rjrrgÚ__init__)rHrñrŒrq)r§r¾r‡Ú filename_baseÚ tail_namerrr rô:sz_LoaderBasics.is_packagecCsdS©z*Use default semantics for module creation.Nr©r§rúrrr Ú create_moduleBsz_LoaderBasics.create_modulecCs8| |j¡}|dkr$td |j¡ƒ‚t t||j¡dS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)Úget_coder®r¦rYr¹Ú_call_with_frames_removedÚexecr´)r§ÚmodulerÚrrr Ú exec_moduleEs  ÿz_LoaderBasics.exec_modulecCs t ||¡S)zThis module is deprecated.)r¹Ú_load_module_shim©r§r¾rrr Ú load_moduleMsz_LoaderBasics.load_moduleN)r®r­r¯r°rôrr"r%rrrr r5s rc@sJeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d œd d„Zdd„Z dS)Ú SourceLoadercCst‚dS)z¥Optional method that returns the modification time (an int) for the specified path (a str). Raises OSError when the path cannot be handled. N)rK©r§r>rrr Ú path_mtimeTszSourceLoader.path_mtimecCsd| |¡iS)ažOptional method returning a metadata dict for the specified path (a 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(r'rrr Ú path_stats\s zSourceLoader.path_statscCs | ||¡S)zäOptional 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)r§ržÚ cache_pathr'rrr Ú_cache_bytecodejszSourceLoader._cache_bytecodecCsdS)z–Optional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. Nr)r§r>r'rrr r*tszSourceLoader.set_datac CsR| |¡}z| |¡}Wn0tk rH}ztd|d�|‚W5d}~XYnXt|ƒS)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data()r¤N)rñÚget_datarKr¦rî)r§r¾r>rêÚexcrrr Ú get_source{s ÿÿzSourceLoader.get_sourcer˜)Ú _optimizecCstjt||dd|d�S)z‚Return the code object compiled from source. The 'data' argument can be any object type that compile() supports. r T)Ú dont_inheritrv)r¹rÚcompile)r§r'r>r0rrr Úsource_to_code…s ÿzSourceLoader.source_to_codec Cs"| |¡}d}d}d}d}d}z t|ƒ}Wntk rDd}Y�n0Xz| |¡} Wntk rjY�n Xt| dƒ}z| |¡} Wntk ršYnÚX||dœ} z”t| || ƒ} t| ƒdd…} | d@dk}|�r$| d @dk}t j d k�r8|sþt j d k�r8| |¡}t   t |¡}t | ||| ƒnt| || d || ƒWnttfk �rTYn Xt d ||¡t| |||d�S|dk�rˆ| |¡}| ||¡}t d|¡tj�s|dk �r|dk �r|�rä|dk�rÖt   |¡}t|||ƒ} nt||t|ƒƒ} z| ||| ¡Wntk �rYnX|S)z¾Concrete implementation of InspectLoader.get_code. Reading of bytecode requires path_stats to be implemented. To write bytecode, set_data must also be implemented. NFTràrÓrÄr+rrgÚneverÚalwaysÚsizez {} matches {})r¥r›ržzcode object from {})rñrˆrtr)rKr r-rÌÚ memoryviewrØÚcheck_hash_based_pycsrÑÚ_RAW_MAGIC_NUMBERrÒrÐr¦rÉr¹rÈrÛr3rÚdont_write_bytecoderãrár3r,)r§r¾ržrÎrêrÑÚ hash_basedÚ check_sourcer›Ústr'rÊruÚ bytes_dataÚ code_objectrrr r�s˜    þ    ÿþ þÿûÿþ    ÿ  ÿzSourceLoader.get_codeN) r®r­r¯r(r)r,r*r/r3rrrrr r&Rs  r&cs|eZdZdZdd„Zdd„Zdd„Ze‡fdd „ƒZed d „ƒZ d d „Z edd„ƒZ dd„Z dd„Z dd„Zdd„Z‡ZS)Ú 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.NrÓ)r§r¾r>rrr rçszFileLoader.__init__cCs|j|jko|j|jkSrB©Ú __class__r´©r§Úotherrrr Ú__eq__ís  ÿzFileLoader.__eq__cCst|jƒt|jƒASrB©Úhashr¥r>©r§rrr Ú__hash__ñszFileLoader.__hash__cstt|ƒ |¡S)zdLoad a module from a file. This method is deprecated. Use exec_module() instead. )Úsuperr@r%r$©rBrr r%ôs zFileLoader.load_modulecCs|jS©z:Return the path to the source file as found by the finder.rDr$rrr rñszFileLoader.get_filenamec Csft|ttfƒr:t t|ƒ¡�}| ¡W5QR£SQRXn(t |d¡�}| ¡W5QR£SQRXdS)z'Return the data from path as raw bytes.ÚrN)rÖr&ÚExtensionFileLoaderr_Ú open_coderwÚreadr`)r§r>rerrr r-s zFileLoader.get_datacCs| |¡r|SdSrB)rô©r§r!rrr Úget_resource_readers zFileLoader.get_resource_readercCs tt|jƒd|ƒ}t |d¡S)NrrM)r@rHr>r_r`©r§Úresourcer>rrr Ú open_resourceszFileLoader.open_resourcecCs&| |¡st‚tt|jƒd|ƒ}|S©Nr)Ú is_resourceÚFileNotFoundErrorr@rHr>rSrrr Ú resource_paths zFileLoader.resource_pathcCs(t|kr dStt|jƒd|ƒ}t|ƒS)NFr)r8r@rHr>rP©r§r¥r>rrr rW szFileLoader.is_resourcecCstt t|jƒd¡ƒSrV)ÚiterrÚlistdirrHr>rHrrr Úcontents&szFileLoader.contents)r®r­r¯r°rrErIr»r%rñr-rRrUrYrWr]Ú __classcell__rrrKr r@âs    r@c@s.eZdZdZdd„Zdd„Zddœdd „Zd S) ÚSourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cCst|ƒ}|j|jdœS)z!Return the metadata for the path.)ràr6)rJÚst_mtimeÚst_size)r§r>r=rrr r).szSourceFileLoader.path_statscCst|ƒ}|j|||d�S)N©Ú_mode)r£r*)r§ržr›r'rMrrr r,3sz SourceFileLoader._cache_bytecoderVrbc Csüt|ƒ\}}g}|r4t|ƒs4t|ƒ\}}| |¡qt|ƒD]l}t||ƒ}zt |¡Wq<tk rpYqr'rcÚparentr‡r<rAr.rrr r*8s0      ÿ ÿzSourceFileLoader.set_dataN)r®r­r¯r°r)r,r*rrrr r_*sr_c@s eZdZdZdd„Zdd„ZdS)ÚSourcelessFileLoaderz-Loader which handles sourceless file imports.cCsD| |¡}| |¡}||dœ}t|||ƒtt|ƒdd…||d�S)NrÓrÄ)r¥r›)rñr-rÌrÛr7)r§r¾r>r'rÊrrr r[s  þ ýzSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nrr$rrr r/kszSourcelessFileLoader.get_sourceN)r®r­r¯r°rr/rrrr rhWsrhc@s\eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z e dd„ƒZ dS)rNz]Loader for extension modules. The constructor is designed to work with FileFinder. cCs@||_t|ƒs6ztt ¡|ƒ}Wntk r4YnX||_dSrB)r¥rUr@rrQrKr>rZrrr r|szExtensionFileLoader.__init__cCs|j|jko|j|jkSrBrArCrrr rE…s  ÿzExtensionFileLoader.__eq__cCst|jƒt|jƒASrBrFrHrrr rI‰szExtensionFileLoader.__hash__cCs$t tj|¡}t d|j|j¡|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})r¹rrØÚcreate_dynamicrÈr¥r>)r§rúr!rrr rŒsÿÿz!ExtensionFileLoader.create_modulecCs$t tj|¡t d|j|j¡dS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)r¹rrØÚ exec_dynamicrÈr¥r>rQrrr r"”s ÿzExtensionFileLoader.exec_modulecs$t|jƒd‰t‡fdd„tDƒƒS)z1Return True if the extension module is a package.r+c3s|]}ˆd|kVqdS)rNr©r Úsuffix©Ú file_namerr rE�sÿz1ExtensionFileLoader.is_package..)rHr>ÚanyÚEXTENSION_SUFFIXESr$rrmr rôšs ÿzExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nrr$rrr r szExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nrr$rrr r/¤szExtensionFileLoader.get_sourcecCs|jSrLrDr$rrr rñ¨sz ExtensionFileLoader.get_filenameN)r®r­r¯r°rrErIrr"rôrr/r»rñrrrr rNts rNc@sheZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dd„Z dd„Z dd„ZdS)Ú_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| ¡ƒ|_||_dSrB)Ú_nameÚ_pathr Ú_get_parent_pathÚ_last_parent_pathÚ _path_finder©r§r¥r>Ú path_finderrrr rµsz_NamespacePath.__init__cCs&|j d¡\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rjr)rr>Ú__path__)rrrq)r§rgÚdotÚmerrr Ú_find_parent_path_names»sz&_NamespacePath._find_parent_path_namescCs| ¡\}}ttj||ƒSrB)r|r³rÚmodules)r§Úparent_module_nameÚpath_attr_namerrr rtÅs z_NamespacePath._get_parent_pathcCsPt| ¡ƒ}||jkrJ| |j|¡}|dk rD|jdkrD|jrD|j|_||_|jSrB)r rtrurvrrr¿rðrs)r§Ú parent_pathrúrrr Ú _recalculateÉs  z_NamespacePath._recalculatecCs t| ¡ƒSrB)r[r�rHrrr Ú__iter__Ösz_NamespacePath.__iter__cCs | ¡|SrB©r�)r§Úindexrrr Ú __getitem__Ùsz_NamespacePath.__getitem__cCs||j|<dSrB)rs)r§r„r>rrr Ú __setitem__Üsz_NamespacePath.__setitem__cCs t| ¡ƒSrB)r3r�rHrrr Ú__len__ßsz_NamespacePath.__len__cCs d |j¡S)Nz_NamespacePath({!r}))rYrsrHrrr Ú__repr__âsz_NamespacePath.__repr__cCs || ¡kSrBrƒ©r§Úitemrrr Ú __contains__åsz_NamespacePath.__contains__cCs|j |¡dSrB)rsr:r‰rrr r:èsz_NamespacePath.appendN)r®r­r¯r°rr|rtr�r‚r…r†r‡rˆr‹r:rrrr rq®s  rqc@sPeZdZdd„Zedd„ƒZdd„Zdd„Zd d „Zd d „Z d d„Z dd„Z dS)Ú_NamespaceLoadercCst|||ƒ|_dSrB)rqrsrwrrr rîsz_NamespaceLoader.__init__cCs d |j¡S)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. z)rYr®)rr!rrr Ú module_reprñsz_NamespaceLoader.module_reprcCsdS)NTrr$rrr rôúsz_NamespaceLoader.is_packagecCsdS)Nrrr$rrr r/ýsz_NamespaceLoader.get_sourcecCstddddd�S)Nrzr T)r1)r2r$rrr rsz_NamespaceLoader.get_codecCsdSrrrrrr rsz_NamespaceLoader.create_modulecCsdSrBrrQrrr r"sz_NamespaceLoader.exec_modulecCst d|j¡t ||¡S)zbLoad a namespace module. This method is deprecated. Use exec_module() instead. z&namespace module loaded with path {!r})r¹rÈrsr#r$rrr r% sÿz_NamespaceLoader.load_moduleN) r®r­r¯rrr�rôr/rrr"r%rrrr rŒís rŒc@sveZdZdZedd„ƒZedd„ƒZedd„ƒZedd „ƒZedd d „ƒZ edd d„ƒZ eddd„ƒZ edd„ƒZ d S)Ú PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs@ttj ¡ƒD],\}}|dkr(tj|=qt|dƒr| ¡qdS)z}Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).NÚinvalidate_caches)ÚlistrÚpath_importer_cacheÚitemsr±r�)rr¥Úfinderrrr r�s   zPathFinder.invalidate_cachesc CsTtjdk rtjst dt¡tjD],}z||ƒWStk rLYq"Yq"Xq"dS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)rÚ path_hooksrlrmr½r¦)rr>Úhookrrr Ú _path_hooks%s   zPathFinder._path_hookscCsh|dkr,z t ¡}Wntk r*YdSXztj|}Wn(tk rb| |¡}|tj|<YnX|S)zÒGet 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. rN)rrQrXrr‘ÚKeyErrorr–)rr>r“rrr Ú_path_importer_cache2s  zPathFinder._path_importer_cachecCsRt|dƒr| |¡\}}n| |¡}g}|dk rrÚnamespace_pathÚentryr“rúrÀrrr Ú _get_specWs(      zPathFinder._get_speccCsd|dkrtj}| |||¡}|dkr(dS|jdkr\|j}|rVd|_t|||jƒ|_|SdSn|SdS)z�Try to find a spec for 'fullname' on sys.path or 'path'. The search is based on sys.path_hooks and sys.path_importer_cache. N)rr>r�r¿rðrórq)rr¾r>rrúr›rrr rws zPathFinder.find_speccCs| ||¡}|dkrdS|jS)zªfind the module on sys.path or 'path' based on sys.path_hooks and sys.path_importer_cache. This method is deprecated. Use find_spec() instead. Nrrrrr r�s zPathFinder.find_modulecOsddlm}|j||ŽS)a  Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching ``context.name`` (or all names if ``None`` indicated) along the paths in the list of directories ``context.path``. r)ÚMetadataPathFinder)Úimportlib.metadataržÚfind_distributions)rr¨r©ržrrr r œs zPathFinder.find_distributions)N)NN)N) r®r­r¯r°rr�r–r˜r™r�rrr rrrr rŽs"       rŽc@sZeZdZdZdd„Zdd„ZeZdd„Zdd „Z dd d „Z d d„Z e dd„ƒZ dd„Zd S)Ú FileFinderz¬File-based finder. Interactions with the file system are cached for performance, being refreshed when the directory the finder is handling has been modified. cspg}|D] \‰}| ‡fdd„|Dƒ¡q||_|p6d|_t|jƒsVtt ¡|jƒ|_d|_tƒ|_ tƒ|_ dS)zšInitialize with the path to search on and a variable number of 2-tuples containing the loader and the file suffixes the loader recognizes.c3s|]}|ˆfVqdSrBrrk©r¿rr rE¹sz&FileFinder.__init__..rjr˜N) rÞÚ_loadersr>rUr@rrQÚ _path_mtimeÚsetÚ _path_cacheÚ_relaxed_path_cache)r§r>Úloader_detailsÚloadersrürr¢r r³s   zFileFinder.__init__cCs d|_dS)zInvalidate the directory mtime.r˜N)r¤rHrrr r�ÃszFileFinder.invalidate_cachescCs*| |¡}|dkrdgfS|j|jp&gfS)zÅTry 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)rr¿rð)r§r¾rúrrr r¼És zFileFinder.find_loadercCs|||ƒ}t||||d�S)Nrï)rþ)r§rûr¾r>Úsmslrr¿rrr r�Õs ÿzFileFinder._get_specNc Cs‚d}| d¡d}zt|jp"t ¡ƒj}Wntk rBd}YnX||jkr\| ¡||_t ƒrr|j }|  ¡}n |j }|}||krÚt |j|ƒ}|jD]:\} } d| } t || ƒ} t| ƒr–| | || |g|¡Sq–t|ƒ}|jD]r\} } zt |j|| ƒ} Wntk �rYdSXtjd| dd�|| |kràt| ƒrà| | || d|¡Sqà|�r~t d |¡t |d¡} |g| _| SdS) zoTry to find a spec for the specified module. Returns the matching spec, or None if not found. Frjrgr˜rNz trying {})Ú verbosityzpossible namespace for {})rqrJr>rrQr`rKr¤Ú _fill_cacherr§ršr¦r@r£rPr�rRryr¹rÈrõrð)r§r¾rÚ is_namespaceÚ tail_moduleràÚcacheÚ cache_moduleÚ base_pathrlrûÚ init_filenameÚ full_pathrúrrr rÚsP        ÿ   zFileFinder.find_specc Cs¾|j}zt |pt ¡¡}Wntttfk r:g}YnXtj  d¡sTt |ƒ|_ nJt ƒ}|D]8}|  d¡\}}}|rˆd  || ¡¡}n|}| |¡q^||_ tj  t¡rºdd„|Dƒ|_dS)zDFill the cache of potential modules and packages for this directory.r rjrWcSsh|] }| ¡’qSr)rš)r Úfnrrr r *sz)FileFinder._fill_cache..N)r>rr\rQrXÚPermissionErrorÚNotADirectoryErrorrrrr¥r¦r�rYršÚaddrr§) r§r>r]Úlower_suffix_contentsrŠr¥rzrlÚnew_namerrr r¬ s"     zFileFinder._fill_cachecs‡‡fdd„}|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�‚ˆ|fˆžŽS)z-Path hook for importlib.machinery.FileFinder.zonly directories are supportedrD)rRr¦rD©rr¨rr Úpath_hook_for_FileFinder6s z6FileFinder.path_hook..path_hook_for_FileFinderr)rr¨r»rrºr Ú path_hook,s zFileFinder.path_hookcCs d |j¡S)NzFileFinder({!r}))rYr>rHrrr rˆ>szFileFinder.__repr__)N)r®r­r¯r°rr�rÂrr¼r�rr¬rr¼rˆrrrr r¡ªs  3 r¡cCs’| d¡}| d¡}|sB|r$|j}n||kr8t||ƒ}n t||ƒ}|sTt|||d�}z$||d<||d<||d<||d<Wntk rŒYnXdS)NÚ __loader__Ú__spec__r¢Ú__file__Ú __cached__)Úgetr¿rhr_rþÚ Exception)Únsr¥ÚpathnameÚ cpathnamer¿rúrrr Ú_fix_up_moduleDs"     rÆcCs*ttt ¡ƒf}ttf}ttf}|||gS)z_Returns a list of file-based module loaders. Each item is a tuple (loader, suffixes). )rNÚ_alternative_architecturesrØÚextension_suffixesr_rŽrhr{)Ú extensionsÚsourceÚbytecoderrr r÷[sr÷c Cs |atjatjatjt}dD]0}|tjkr8t |¡}n tj|}t|||ƒqddgfdddgff}|D]X\}}|d}|tjkr”tj|}qÌqjzt |¡}WqÌWqjtk rÀYqjYqjXqjtdƒ‚t|d|ƒt|d |ƒt|d d  |¡ƒt|d d d„|Dƒƒt d¡} t|d| ƒt d¡} t|d| ƒ|dk�rXt d¡} t|d| ƒt|dt ƒƒt   t t  ¡ƒ¡|dk�rœt d¡dt k�rœdt_dS)zÍSetup 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. )r_rlÚbuiltinsrÔÚposixrÚntrrzimportlib requires posix or ntrr8r.rÚ_pathseps_with_coloncSsh|]}d|›�’qSrrrrrr r �sz_setup..Ú_threadÚ_weakrefÚwinregrrz.pywz_d.pydTN)r¹rrØr}r®Ú_builtin_from_namer²r¦r;rrprÞrÇrÈrŽr:rÿr) Ú_bootstrap_moduleÚ self_moduleÚ builtin_nameÚbuiltin_moduleÚ os_detailsÚ builtin_osr.r8Ú os_moduleÚ thread_moduleÚweakref_moduleÚ winreg_modulerrr Ú_setupfsL                      rÞcCs2t|ƒtƒ}tj tj|Žg¡tj t ¡dS)z)Install the path-based import components.N) rÞr÷rr”rÞr¡r¼Ú meta_pathr:rŽ)rÔÚsupported_loadersrrr Ú_install§sráú-arm-linux-gnueabihf.ú-armeb-linux-gnueabihf.ú-mips64-linux-gnuabi64.ú-mips64el-linux-gnuabi64.ú-powerpc-linux-gnu.ú-powerpc-linux-gnuspe.ú-powerpc64-linux-gnu.ú-powerpc64le-linux-gnu.ú-arm-linux-gnueabi.ú-armeb-linux-gnueabi.ú-mips64-linux-gnu.ú-mips64el-linux-gnu.ú-ppc-linux-gnu.ú-ppc-linux-gnuspe.ú-ppc64-linux-gnu.ú-ppc64le-linux-gnu.)rêrërìrírîrïrðrñrârãrärårærçrèrécCsF|D]<}t ¡D].\}}||kr| | ||¡¡|Sqq|S)z®Add 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_MAPr’r:rT)rürlÚoriginalÚ alternativerrr rÇÄs rÇ)rV)N)NNN)rr)T)N)N)Rr°rØr_rrlrÔrÚ _MS_WINDOWSrÎrrÒrÍr.r8r r6r;rÏrÚ%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrr#r(r)r@rHrJrOrPrRrUrfÚtypeÚ__code__r×r!rÇr r%r9r~rzrŽr{ÚDEBUG_BYTECODE_SUFFIXESÚOPTIMIZED_BYTECODE_SUFFIXESrˆr–rŸr¡r£r»rÂrÌrÐrÒrÛrárãrîÚobjectrørþrÿrr&r@r_rhrprNrqrŒrŽr¡rÆr÷rÞráròrÇrrrr ÚsÌ    ÿ        G(  ! ÿ D@H-:?*  A ï