ELF>t@@_frozen_importlib_frozen_importlib_externalzipimport__hello____phello____phello__.spamu3Bwc@sdZeddS)Tz Hello world!N)Z initializedprintrrzs c@sPdZddlZddlmZmZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddgZ ejZejddZGdddeZiZee ZdZd Zd ZGd ddejZed d d feddd fddfZddZddZddZddZdZ da!ddZ"ddZ#dd Z$d!d"Z%ee%j&Z'd#d$Z(d%d&Z)d'd(Z*d)d*Z+d+d,Z,d-d.Z-dS)/aPzipimport provides support for importing Python modules from Zip archives. This module exports three objects: - zipimporter: a class; its constructor takes a path to a Zip archive. - ZipImportError: exception raised by zipimporter objects. It's a subclass of ImportError, so it can be caught as ImportError, too. - _zip_directory_cache: a dict, mapping archive paths to zip directory info dicts, as used in zipimporter._files. It is usually not needed to use the zipimport module explicitly; it is used by the builtin import mechanism for sys.path items that are paths to Zip archives. N)_unpack_uint16_unpack_uint32ZipImportError zipimporterc@s eZdZdS)rN)__name__ __module__ __qualname__r r r"ssPKic@s~eZdZdZddZdddZdddZdd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS)razipimporter(archivepath) -> zipimporter object Create a new zipimporter instance. 'archivepath' must be a path to a zipfile, or to a specific path inside a zipfile. For example, it can be '/tmp/myimport.zip', or '/tmp/myimport.zip/mydirectory', if mydirectory is a valid directory inside the archive. 'ZipImportError is raised if 'archivepath' doesn't point to a valid Zip archive. The 'archive' attribute of zipimporter objects contains the name of the zipfile targeted. c Cs$t|tsddl}||}|std|dtr|tt}g} zt |}Wn#t t fyKt |\}}||krBtd|d|}| |Ynw|jd@dkrYtd|dq[q!zt|}Wntyrt|}|t|<Ynw||_||_tj|ddd|_|jr|jt7_dSdS) Nrzarchive path is emptypathTznot a Zip fileii) isinstancestrosZfsdecoder alt_path_sepreplacepath_sep_bootstrap_externalZ _path_statOSError ValueErrorZ _path_splitappendZst_mode_zip_directory_cacheKeyError_read_directory_filesarchive _path_joinprefix)selfr rrZstZdirnameZbasenamefilesr r r __init__@sD         zzipimporter.__init__NcCsZtdtt||}|dur|gfSt||}t||r)d|jt|gfSdgfS)a/find_loader(fullname, path=None) -> self, str or None. Search for a module specified by 'fullname'. 'fullname' must be the fully qualified (dotted) module name. It returns the zipimporter instance itself if the module was found, a string containing the full path name if it's possibly a portion of a namespace package, or None otherwise. The optional 'path' argument is ignored -- it's there for compatibility with the importer protocol. Deprecated since Python 3.10. Use find_spec() instead. zfzipimporter.find_loader() is deprecated and slated for removal in Python 3.12; use find_spec() insteadN) _warningswarnDeprecationWarning_get_module_info_get_module_path_is_dirrr)r fullnamer mimodpathr r r find_loaderns    zzipimporter.find_loadercCstdt|||dS)afind_module(fullname, path=None) -> self or None. Search for a module specified by 'fullname'. 'fullname' must be the fully qualified (dotted) module name. It returns the zipimporter instance itself if the module was found, or None if it wasn't. The optional 'path' argument is ignored -- it's there for compatibility with the importer protocol. Deprecated since Python 3.10. Use find_spec() instead. zfzipimporter.find_module() is deprecated and slated for removal in Python 3.12; use find_spec() insteadr)r#r$r%r,)r r)r r r r find_modules zzipimporter.find_modulecCslt||}|durtj|||dSt||}t||r4|jt|}tj|ddd}|j ||SdS)zkCreate a ModuleSpec for the specified module. Returns None if the module cannot be found. N) is_packageT)nameZloaderr.) r& _bootstrapZspec_from_loaderr'r(rrZ ModuleSpecZsubmodule_search_locationsr)r r)ZtargetZ module_infor+r Zspecr r r find_specs    zzipimporter.find_speccCst||\}}}|S)zget_code(fullname) -> code object. Return the code object for the specified module. Raise ZipImportError if the module couldn't be imported. _get_module_coder r)code ispackager+r r r get_codeszzipimporter.get_codecCsptr|tt}|}||jtr|t|jtd}z|j|}Wn ty1tdd|wt |j|S)zget_data(pathname) -> string with file data. Return the data associated with 'pathname'. Raise OSError if the file wasn't found. Nr) rrr startswithrlenrrr _get_data)r pathnameZkey toc_entryr r r get_datas    zzipimporter.get_datacCst||\}}}|S)zget_filename(fullname) -> filename string. Return the filename for the specified module or raise ZipImportError if it couldn't be imported. r2r4r r r get_filenameszzipimporter.get_filenamecCs~t||}|durtd||dt||}|r t|d}n|d}z|j|}Wn ty6YdSwt|j| S)zget_source(fullname) -> source string. Return the source code for the specified module. Raise ZipImportError if the module couldn't be found, return None if the archive does contain the module, but has no source for it. Ncan't find module r/ __init__.py.py) r&rr'rrrrr;rdecode)r r)r*r fullpathr=r r r get_sources    zzipimporter.get_sourcecCs(t||}|durtd||d|S)zis_package(fullname) -> bool. Return True if the module specified by fullname is a package. Raise ZipImportError if the module couldn't be found. Nr@rA)r&r)r r)r*r r r r.s zzipimporter.is_packagec Csd}t|tt||\}}}tj|}|dust|ts(t|}|tj|<||_ z*|r>t ||}t |j |}|g|_t|dsFt|_t |j||t||jWntj|=ztj|}Wntyttd|dwtd|||S)a@load_module(fullname) -> module. Load the module specified by 'fullname'. 'fullname' must be the fully qualified (dotted) module name. It returns the imported module, or raises ZipImportError if it could not be imported. Deprecated since Python 3.10. Use exec_module() instead. zrzipimport.zipimporter.load_module() is deprecated and slated for removal in Python 3.12; use exec_module() insteadN __builtins__zLoaded module z not found in sys.moduleszimport {} # loaded from Zip {})r#r$r%r3sysmodulesgetr _module_type __loader__r'rrrZ__path__hasattrrGZ_fix_up_module__dict__execr ImportErrorr0_verbose_message) r r)msgr5r6r+Zmodr rEr r r load_modules6      zzipimporter.load_modulecCs@z ||s WdSWn tyYdSwddlm}|||S)zReturn the ResourceReader for a package in a zip file. If 'fullname' is a package within the zip file, return the 'ResourceReader' object for the package. Otherwise return None. Nr) ZipReader)r.rZimportlib.readersrT)r r)rTr r r get_resource_reader;s    zzipimporter.get_resource_readercCsHzt|j|_|jt|j<WdSty#t|jdi|_YdSw)z)Reload the file data of the archive path.N)rrrrrpopr r r r invalidate_cachesJs   zzipimporter.invalidate_cachescCsd|jt|jdS)Nz)rrrrWr r r __repr__Tszzipimporter.__repr__N)rrr__doc__r"r,r-r1r7r>r?rFr.rSrUrXrYr r r r r.s . %    + z __init__.pycTrBF)z.pycTF)rCFFcCs|j|ddS)N.)r rpartition)r r)r r r r'fsr'cCs|t}||jvSrZ)rr)r r Zdirpathr r r r(js r(cCs8t||}tD]\}}}||}||jvr|SqdSrZ)r'_zip_searchorderr)r r)r suffix isbytecoder6rEr r r r&ss  r&c Cszt|}Wntytd||dw|Az|t d|}|t}Wnty>td||dwt|tkrNtd||d|ddt krz |dd|}Wntyrtd||dwt |t td}z |||}Wntytd||dw| t }|dkrtd||d|||t}t|tkrtd||d|t||}t |d d }t |d d } ||krtd ||d|| krtd ||d||8}|| } | dkr td||di} d} z||Wnty%td||dw |d}t|dkr7td|dddkrBqUt|dkrMtdt|dd} t|dd }t|d d}t|dd }t |d d }t |d d}t |dd}t|dd}t|dd}t|dd}t |dd}|||}|| krtd||d|| 7}z||}Wntytd||dwt||krtd||dzt|||||krtd||dWntytd||dw| d@r|}nz|d}Wnty4|dt}Ynw|d t}t||}||||||||f}|| |<| d!7} q'Wdn 1s`wYtd"| || S)#Nzcan't open Zip file: r r]can't read Zip file: rznot a Zip file: zcorrupt Zip file: zbad central directory size: zbad central directory offset: z&bad central directory size or offset: T.EOF read where not expectedsPK  "*zbad local header offset: iasciiZlatin1/rz!zipimport: found {} names in {!r})_io open_coderrseekEND_CENTRAL_DIR_SIZEZtellreadr:STRING_END_ARCHIVEmaxMAX_COMMENT_LENrfindrEOFErrorrrDUnicodeDecodeError translate cp437_tablerrrrr0rQ)rfpZheader_positionbuffer file_sizeZmax_comment_startdataZpos header_sizeZ header_offsetZ arc_offsetr!countflagscompresstimedatecrc data_size name_size extra_sizeZ comment_size file_offsetr/r tr r r rs                       mru  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ cCsjtr tdtddazzddlm}Wnty&tdtdwWdandawtd|S)Nzzipimport: zlib UNAVAILABLE)can't decompress data; zlib not availableTr decompressFzzipimport: zlib available)_importing_zlibr0rQrZzlibr Exceptionrr r r _get_decompress_func0s     rc Csx|\}}}}}}}} |dkrtdt|} z| |Wnty/td||dw| d} t| dkr?td| dddkrPtd ||dt| d d } t| d d} d| | }||7}z| |Wntytd||dw| |}t||krtd Wdn1swY|dkr|Szt }Wn t ytd w||dS)Nrznegative data sizerbr rnrhrcsPKzbad local file header: rmzzipimport: can't read datari) rrtrurvrrxr:r}rrr)rr=ZdatapathrrrrrrrrrrrrZraw_datarr r r r;EsH           r;cCst||dkS)Nr)abs)Zt1Zt2r r r _eq_mtimessrcCs||d}t|||}|d@dk}|r?|d@dk}tjdkr>|s&tjdkr>t||} | dur>ttj| } t|| ||n(t||\} } | rgt t |dd| r]t |dd | krgt d |dSt |d d} t| ts}td |d | S) N)r/r rrr]ZneverZalwaysrirdrezbytecode is stale for zcompiled module z is not a code object)rZ _classify_pyc_impZcheck_hash_based_pycs_get_pyc_source source_hashZ_RAW_MAGIC_NUMBERZ_validate_hash_pyc_get_mtime_and_size_of_sourcerrr0rQmarshalZloadsr _code_type TypeError)r r<rEr)rZ exc_detailsrZ hash_basedZ check_sourceZ source_bytesrZ source_mtimeZ source_sizer5r r r _unmarshal_code{sH     rcCs|dd}|dd}|S)Ns   )r)sourcer r r _normalize_line_endingss  rcCst|}t||dddS)NrOT)Z dont_inherit)rcompile)r<rr r r _compile_sourcesrc CsDt|d?d|d?d@|d@|d?|d?d@|d@dd d d f S) N i ?r]r)rZmktime)drr r r _parse_dostimes    rc Csnz)|dddvs J|dd}|j|}|d}|d}|d}t|||fWStttfy6YdSw)Nrcor)rr)rrr IndexErrorr)r r r=rrZuncompressed_sizer r r rs  rcCsP|dddvs J|dd}z|j|}Wn ty!YdSwt|j|S)Nrr)rrr;r)r r r=r r r rs   rc Cst||}d}tD]f\}}}||}tjd|jt|ddz|j|}Wn ty-Yq w|d} t|j|} d} |r[z t || ||| } Wq`t yZ} z| }WYd} ~ q`d} ~ wwt | | } | dureq |d} | || fS|r~d|} t | |d|t d||d)Nz trying {}{}{}r])Z verbosityrzmodule load failed: rAr@) r'r_r0rQrrrrr;rrPrr)r r)r Z import_errorr`rar6rEr=r+rr5ZexcrRr r r r3s:     r3).r[Z_frozen_importlib_externalrrrZ_frozen_importlibr0rrtrrHrr#Z__all__rZpath_separatorsrrPrrtyperKrwryr{Z _LoaderBasicsrr_r'r(r&rrrrr;rr__code__rrrrrrr3r r r r sZ 2   ~. (  c@sdZdaddlZddlZddlZddlZddlZejdkZer(ddl Z ddl Z nddl Z er3ddgZ ndgZ edde DsAJe dZee Zde Z d d e DZd Zd ZeeZd dZeZddZddZddZerwddZnddZddZddZddZddZ d d!Z!erd"d#Z"nd$d#Z"dpd&d'Z#e$e#j%Z&d('d)d*d+Z(e)*e(d*Z+d,Z,d-Z-d.gZ.ere./d/e0Z1d0gZ2e2Z3Z4dqdd1d2d3Z5d4d5Z6d6d7Z7d8d9Z8d:d;Z9dd?Z;d@dAZdrdFdGZ?dsdHdIZ@dtdKdLZAdMdNZBeCZDdqdeDdOdPdQZEGdRdSdSZFGdTdUdUZGGdVdWdWeGZHGdXdYdYZIGdZd[d[eIeHZJGd\d]d]eIeGZKGd^d_d_eIeGZLGd`dadaZMGdbdcdcZNGdddedeZOGdfdgdgZPdqdhdiZQdjdkZRdldmZSdndoZTdS)ua^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\/ccs|] }t|dkVqdS)N)len).0sepr& .sr cCsh|]}d|qS):r)rsrrr 2sr )win)ZcygwinZdarwincs>tjtrtjtrdndfdd}|Sdd}|S)NZ PYTHONCASEOKs PYTHONCASEOKcstjj o tjvS)z^True if filenames must be checked case-insensitively and ignore environment flags are not set.)sysflagsignore_environment_osZenvironrkeyrr _relax_caseCz%_make_relax_case.._relax_casecSdS)z5True if filenames must be checked case-insensitively.FrrrrrrG)rplatform startswith_CASE_INSENSITIVE_PLATFORMS#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rrrr_make_relax_case<s   rcCst|d@ddS)z*Convert a 32-bit integer to little-endian.little)intto_bytes)xrrr _pack_uint32Orr$cCt|dksJt|dS)z/Convert 4 bytes in little-endian to an integer.rr rr! from_bytesdatarrr_unpack_uint32T r*cCr%)z/Convert 2 bytes in little-endian to an integer.r r&r(rrr_unpack_uint16Yr+r-cGs|sdSt|dkr|dSd}g}ttj|D]=\}}|ts&|tr3|tp,|}t |g}q|drL| | krF|}|g}q| |q|pO|}| |qdd|D}t|dkrk|dsk|t S|t |S)Replacement for os.path.join().r rrr cSg|] }|r|tqSrrstrippath_separatorsrprrr ws_path_join..) rmapr_path_splitrootrpath_sep_tupleendswithr1r2path_sepcasefoldappendjoin) path_partsrootpathZnew_roottailrrr _path_join`s*     rCcGstdd|DS)r.cSr/rr0)rpartrrrr5sr6)r;r>)r?rrrrC~s csBtfddtD}|dkrdfSd||ddfS)z Replacement for os.path.split().c3s|]}|VqdSN)rfindr3rArrr sz_path_split..rr Nr)maxr2)rAirrGr _path_splitsrJcCs t|S)z~Stat the path. Made a separate function to make it easier to override in experiments (e.g. cache stat results). )rZstatrGrrr _path_stats rKcCs0zt|}Wn tyYdSw|jd@|kS)z1Test whether the path is the specified mode type.Fi)rKOSErrorst_mode)rAmodeZ stat_inforrr_path_is_mode_types   rOcCs t|dS)zReplacement for os.path.isfile.i)rOrGrrr _path_isfile rPcCs|st}t|dS)zReplacement for os.path.isdir.i@)rgetcwdrOrGrrr _path_isdirs rScCs>|sdSt|ddd}t|dko|dp|dS)Replacement for os.path.isabs.Frrrrz\\)rr8replacerrr:)rAr@rrr _path_isabss rVcCs |tS)rT)rr2rGrrrrVrQc Csd|t|}t|tjtjBtjB|d@}z$t|d }| |Wdn1s/wYt ||WdSt yTzt |Wt ySYww)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.{}.{}rWZwbN) formatidrZopenZO_EXCLZO_CREATZO_WRONLY_ioFileIOwriterUrLZunlink)rAr)rNZpath_tmpZfdfilerrr _write_atomics$    r_io r,r s Z __pycache__zopt-z.pyz.pywz.pyc) optimizationc CsP|durtdt|durd}t||rdnd}t|}t|\}}|d\}}}tj j } | dur9t dd |r?|n||| g} |durVtj jdkrRd}ntj j}t|}|dkrp|sitd |d | t|} | td} tjdurt|stt|}|dd kr|dtvr|d d}ttj|t| St|t| S) 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.$sys.implementation.cache_tag is Nonerz{!r} is not alphanumericz{}.{}{}r r,) _warningswarnDeprecationWarning TypeErrorrfspathrJ rpartitionrimplementation cache_tagNotImplementedErrorr>roptimizestrisalnum ValueErrorrY_OPTBYTECODE_SUFFIXESpycache_prefixrVrCrRr2lstrip_PYCACHE) rAZdebug_overrider`messageheadrBZbaserrestZtagZalmost_filenamefilenamerrrcache_from_source|sH         ryc Cs(tjjdur tdt|}t|\}}d}tjdur3tjt }| |t r3|t |d}d}|sHt|\}}|t krHtt d||d}|dvrXtd||d kr|dd d }| tsptd t|t td}|std |d|dd} t|| tdS)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. NrbFTz not bottom-level directory in ra>r,zexpected only 2 or 3 dots in rzr,z5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer)rrirjrkrrgrJrrr1r2rr;rrtrocountrsplitrprn partitionrCSOURCE_SUFFIXES) rArvZpycache_filenameZfound_in_pycache_prefixZ stripped_pathZpycacheZ dot_countr`Z opt_levelZ base_filenamerrrsource_from_caches<        rc Cs|t|dkrdS|d\}}}|r|dddkr|Szt|}Wnttfy5|dd}Ynwt|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. rNraZpy)rrhlowerrrkrorP) bytecode_pathrw_Z extension source_pathrrr_get_sourcefiles  rcCsD|ttrzt|WStyYdSw|ttr |SdSrE)r:tuplerryrkrq)rxrrr _get_cacheds  rcCs2zt|j}Wn tyd}Ynw|dO}|S)z3Calculate the mode permissions for a bytecode file.rW)rKrMrL)rArNrrr _calc_mode s rcs4dfdd }tdurtj}ndd}|||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. NcsH|dur|j}n|j|krtd|j|f|d||g|Ri|S)Nzloader for %s cannot handle %sname)r ImportError)selfrargskwargsmethodrr_check_name_wrappers z(_check_name.._check_name_wrappercSs8dD]}t||rt||t||q|j|jdS)N) __module____name__ __qualname____doc__)hasattrsetattrgetattr__dict__update)ZnewZoldrUrrr_wrap+s  z_check_name.._wraprE) _bootstrapr)rrrrrr _check_names   rcCsHtdt||\}}|dur"t|r"d}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(). zZfind_module() is deprecated and slated for removal in Python 3.12; use find_spec() insteadNz,Not importing directory {}: missing __init__r)rcrdre find_loaderrrY ImportWarning)rfullnameloaderportionsmsgrrr_find_module_shim5srcCs|dd}|tkr d|d|}td|t|fi|t|dkr5d|}td|t|t|dd}|d @rQd |d |}t|fi||S) aTPerform basic validity checking of a pyc header and return the flags field, which determines how the pyc should be further validated against the source. *data* is the contents of the pyc file. (Only the first 16 bytes are required, though.) *name* is the name of the module being imported. It is used for logging. *exc_details* is a dictionary passed to ImportError if it raised for improved debugging. ImportError is raised when the magic number is incorrect or when the flags field is invalid. EOFError is raised when the data is found to be truncated. Nrzbad magic number in z: {}z(reached EOF while reading pyc header of zinvalid flags z in ) MAGIC_NUMBERr_verbose_messagerrEOFErrorr*)r)r exc_detailsZmagicrurrrr _classify_pycIs     rcCs|t|dd|d@krd|}td|t|fi||dur:t|dd|d@krB}|t|t|dksJ|||t||S)z&Produce the data for a hash-based pyc.rr)rrrr$rrr)rrZcheckedr)rrrr_code_to_hash_pycs  rcCs>ddl}t|j}||}tdd}|||dS)zyDecode bytes representing source code and return the string. Universal newline support is used in the decoding. rNT)tokenizer[ZBytesIOZreadlineZdetect_encodingZIncrementalNewlineDecoderdecode) source_bytesrZsource_bytes_readlineencodingZnewline_decoderrrr decode_sources    rrsubmodule_search_locationsc Cs6|durd}t|drz||}Wq9tyYq9wnt|}t|s9z tt|}Wn ty8Ynwt j |||d}d|_ |durct D]\}}| t|r`|||}||_qcqKdS|turt|drz||}Wn ty|Yqw|rg|_n||_|jgkr|rt|d}|j||S)a=Return a module spec based on a file location. To indicate that the module is a package, set submodule_search_locations to a list of directory paths. An empty list is sufficient, though its not otherwise useful to the import system. The loader must take a spec as its only __init__() arg. Nz get_filenameoriginT is_packager)rrrrrgrVrCrRrLr ModuleSpecZ _set_fileattr_get_supported_file_loadersr:rr _POPULATErrrJr=) rZlocationrrspec loader_classsuffixesrZdirnamerrrspec_from_file_locationsT            rc@sXeZdZdZdZdZeodevZe ddZ e ddZ e dd d Z e dd d Zd 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}\Debugz_d.pydcCs2zttj|WStyttj|YSwrE)winregZOpenKeyZHKEY_CURRENT_USERrLZHKEY_LOCAL_MACHINErrrr_open_registry&s  z$WindowsRegistryFinder._open_registrycCs|jr|j}n|j}|j|dtjddd}z ||}t|d}WdW|S1s1wYW|St yBYdSw)Nz%d.%dr,)rZ sys_versionr ) DEBUG_BUILDREGISTRY_KEY_DEBUG REGISTRY_KEYrYr version_inforrZ QueryValuerL)clsrZ registry_keyrZhkeyfilepathrrr_search_registry-s    z&WindowsRegistryFinder._search_registryNcCsx||}|dur dSzt|Wn tyYdSwtD]\}}|t|r9tj|||||d}|SqdS)Nr)rrKrLrr:rrspec_from_loader)rrrAtargetrrrrrrr find_spec<s"   zWindowsRegistryFinder.find_speccCs*tdt|||}|dur|jSdS)zjFind module named in the registry. This method is deprecated. Use find_spec() instead. zpWindowsRegistryFinder.find_module() is deprecated and slated for removal in Python 3.12; use find_spec() insteadNrcrdrerrrrrArrrr find_moduleLs z!WindowsRegistryFinder.find_moduleNNrE)rrrrrr _MS_WINDOWSEXTENSION_SUFFIXESr staticmethodr classmethodrrrrrrrrs    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'.rrarr,__init__)rJrr}rh)rrrxZ filename_baseZ tail_namerrrrbsz_LoaderBasics.is_packagecCrz*Use default semantics for module creation.Nrrrrrr create_modulejz_LoaderBasics.create_modulecCs8||j}|durtd|jtt||jdS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)get_coderrrYr_call_with_frames_removedexecr)rmodulerrrr exec_modulems z_LoaderBasics.exec_modulecCs t||S)zThis method is deprecated.)r_load_module_shimrrrrr load_moduleus z_LoaderBasics.load_moduleN)rrrrrrrrrrrrr]s  rc@sJeZdZddZddZddZddZd d Zd d d dZddZ dS) SourceLoadercCst)zOptional method that returns the modification time (an int) for the specified path (a str). Raises OSError when the path cannot be handled. )rLrrArrr path_mtime}szSourceLoader.path_mtimecCsd||iS)aOptional 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)rrrrr 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_pathr)rrr_cache_bytecodes zSourceLoader._cache_bytecodecCr)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. Nr)rrAr)rrrrrzSourceLoader.set_datac CsF||}z ||}Wt|Sty"}ztd|d|d}~ww)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data()rN)rget_datarLrr)rrrArexcrrr 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_inheritrl)rrcompile)rr)rArrrrsource_to_codes zSourceLoader.source_to_codec Cs||}d}d}d}d}d}zt|}Wn ty d}Ynwz||} Wn ty1Ynwt| d}z||} Wn tyHYnhw||d} zGt| || } t| dd} | d@dk}|r| d @dk}t j d kr|swt j d kr||}t t |}t | ||| n t| || d || Wn ttfyYnwtd ||t| |||dS|dur||}|||}td|tjs|dur|dur|r|durt |}t|||} nt||t|} z |||| W|StyY|Sw|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. NFTrrrrrr,ZneverZalwayssizez {} matches {})rrrzcode object from {})rryrkrrLr!rr memoryviewrZcheck_hash_based_pycsr_RAW_MAGIC_NUMBERrrrrrrrrrdont_write_bytecoderrrr)rrrrrrZ hash_basedZ check_sourcerstr)rrZ bytes_dataZ code_objectrrrrs                zSourceLoader.get_codeN) rrrrrrrrrrrrrrr{s  rcs\eZdZdZddZddZddZefdd Zed d Z d d Z eddZ 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.Nr)rrrArrrrs zFileLoader.__init__cC|j|jko |j|jkSrE __class__rrZotherrrr__eq__  zFileLoader.__eq__cCt|jt|jASrEhashrrArrrr__hash__zFileLoader.__hash__cstt||S)zdLoad a module from a file. This method is deprecated. Use exec_module() instead. )superr rrrrrrs zFileLoader.load_modulecC|jSz:Return the path to the source file as found by the finder.rGrrrrr)zFileLoader.get_filenamecCst|ttfr$tt| }|WdS1swYdSt|d }|WdS1s9wYdS)z'Return the data from path as raw bytes.Nr)rrExtensionFileLoaderr[Z open_codermZreadr\)rrAr^rrrr.s$$zFileLoader.get_datacCsddlm}||S)Nr) FileReader)importlib.readersr)rrrrrrget_resource_reader7s zFileLoader.get_resource_reader) rrrrrrrrrrrr!Z __classcell__rrrrr  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)rKst_mtimeZst_size)rrAr rrrrAszSourceFileLoader.path_statscCst|}|j|||dS)N_mode)rr)rrrr)rNrrrrFsz SourceFileLoader._cache_bytecoderWr$c Cst|\}}g}|rt|st|\}}|||rt|rt|D]1}t||}zt|Wq#ty:Yq#tyT}zt d||WYd}~dSd}~wwzt |||t d|WdSty~}zt d||WYd}~dSd}~ww)zWrite bytes data to a file.zcould not create {!r}: {!r}Nz created {!r}) rJrSr=reversedrCrZmkdirFileExistsErrorrLrrr_) rrAr)r%parentrxr?rDrrrrrKs8        zSourceFileLoader.set_dataN)rrrrrrrrrrrr"=s r"c@s eZdZdZddZddZdS)SourcelessFileLoaderz-Loader which handles sourceless file imports.cCsD||}||}||d}t|||tt|dd||dS)Nrr)rr)rrrrr)rrrAr)rrrrrns   zSourcelessFileLoader.get_codecCr)z'Return None as there is no source code.Nrrrrrr~rzSourcelessFileLoader.get_sourceN)rrrrrrrrrrr)js r)c@s\eZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ e ddZ dS)rz]Loader for extension modules. The constructor is designed to work with FileFinder. cCs||_||_dSrEr)rrrArrrrs zExtensionFileLoader.__init__cCr rEr rrrrrrzExtensionFileLoader.__eq__cCrrErrrrrrrzExtensionFileLoader.__hash__cCs$ttj|}td|j|j|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})rrrZcreate_dynamicrrrA)rrrrrrrsz!ExtensionFileLoader.create_modulecCs$ttj|td|j|jdS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)rrrZ exec_dynamicrrrArrrrrrszExtensionFileLoader.exec_modulecs$t|jdtfddtDS)z1Return True if the extension module is a package.rc3s|] }d|kVqdS)rNrrsuffixZ file_namerrr sz1ExtensionFileLoader.is_package..)rJrAanyrrrr-rrs zExtensionFileLoader.is_packagecCr)z?Return None as an extension module cannot create a code object.NrrrrrrrzExtensionFileLoader.get_codecCr)z5Return None as extension modules have no source code.NrrrrrrrzExtensionFileLoader.get_sourcecCrrrGrrrrrrz ExtensionFileLoader.get_filenameN)rrrrrrrrrrrrrrrrrrrsrc@sheZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZdS)_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||_||_dSrE)_name_pathr_get_parent_path_last_parent_path _path_finderrrrAZ path_finderrrrrs z_NamespacePath.__init__cCs&|jd\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rar )rrAZ__path__)r0rh)rr(dotZmerrr_find_parent_path_namessz&_NamespacePath._find_parent_path_namescCs|\}}ttj||SrE)r7rrmodules)rZparent_module_nameZpath_attr_namerrrr2s z_NamespacePath._get_parent_pathcCsPt|}||jkr%||j|}|dur"|jdur"|jr"|j|_||_|jSrE)rr2r3r4r0rrr1)rZ parent_pathrrrr _recalculates  z_NamespacePath._recalculatecC t|SrE)iterr9rrrr__iter__ z_NamespacePath.__iter__cCs ||SrEr9)rindexrrr __getitem__r=z_NamespacePath.__getitem__cCs||j|<dSrE)r1)rr?rArrr __setitem__sz_NamespacePath.__setitem__cCr:rE)rr9rrrr__len__r=z_NamespacePath.__len__cC d|jS)Nz_NamespacePath({!r}))rYr1rrrr__repr__r=z_NamespacePath.__repr__cCs ||vSrEr>ritemrrr __contains__r=z_NamespacePath.__contains__cCs|j|dSrE)r1r=rErrrr=z_NamespacePath.appendN)rrrrrr7r2r9r<r@rArBrDrGr=rrrrr/s   r/c@sXeZdZddZeddZddZddZd d Zd d Z d dZ ddZ ddZ dS)_NamespaceLoadercCst||||_dSrE)r/r1r5rrrrsz_NamespaceLoader.__init__cCstdtd|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. zR_NamespaceLoader.module_repr() is deprecated and slated for removal in Python 3.12z)rcrdrerYr)rrrr module_reprs z_NamespaceLoader.module_reprcCr)NTrrrrrrz_NamespaceLoader.is_packagecCr)Nr rrrrrr rKz_NamespaceLoader.get_sourcecCstdddddS)Nr zrT)r)rrrrrr rHz_NamespaceLoader.get_codecCrrrrrrrrrz_NamespaceLoader.create_modulecCsdSrErr*rrrrrKz_NamespaceLoader.exec_modulecCstd|jt||S)zbLoad a namespace module. This method is deprecated. Use exec_module() instead. z&namespace module loaded with path {!r})rrr1rrrrrrs z_NamespaceLoader.load_modulecCsddlm}||jS)Nr)NamespaceReader)r rLr1)rrrLrrrr!!s  z$_NamespaceLoader.get_resource_readerN) rrrrrrJrrrrrrr!rrrrrIs   rIc@sveZdZdZeddZeddZeddZedd Z edd d Z edd dZ edddZ eddZ d S) PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs@ttjD]\}}|durtj|=qt|dr|qdS)z}Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).Ninvalidate_caches)listrpath_importer_cacheitemsrrN)rfinderrrrrN,s  zPathFinder.invalidate_cachesc CsLtjdurtjstdttjD]}z||WSty#YqwdS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r path_hooksrcrdrr)rAZhookrrr _path_hooks6s   zPathFinder._path_hookscCsd|dkrzt}Wn tyYdSwztj|}W|Sty1||}|tj|<Y|Sw)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)rrRFileNotFoundErrorrrPKeyErrorrT)rrArRrrr_path_importer_cacheCs     zPathFinder._path_importer_cachecCst|drt|d}t|t||\}}nt|d}t|t||}g}|dur:t||St |d}||_ |S)Nrz5.find_spec() not found; falling back to find_loader()z5.find_spec() not found; falling back to find_module()) rrZ _object_namercrdrrrrrr)rrrRrrrrrrr_legacy_get_specYs      zPathFinder._legacy_get_specNc Csg}|D]C}t|ttfsq||}|durGt|dr#|||}n|||}|dur.q|jdur7|S|j}|durBt d| |qt |d}||_|S)z?Find the loader or namespace_path for this module/package name.Nrzspec missing loader) rrmbytesrWrrrXrrrrrr) rrrArnamespace_pathZentryrRrrrrr _get_specns*      zPathFinder._get_speccCs^|durtj}||||}|durdS|jdur-|j}|r+d|_t|||j|_|SdS|S)zTry 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)rrAr[rrrr/)rrrArrrZrrrrs zPathFinder.find_speccCs*tdt|||}|durdS|jS)zfind 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. zePathFinder.find_module() is deprecated and slated for removal in Python 3.12; use find_spec() insteadNrrrrrrs zPathFinder.find_modulecOsddlm}|j|i|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)Zimportlib.metadatar\find_distributions)rrr\rrrr]s zPathFinder.find_distributionsrEr)rrrrrrNrTrrWrXr[rrr]rrrrrM(s$       rMc@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. cspg}|D]\}|fdd|Dq||_|pd|_t|js+tt|j|_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|]}|fVqdSrErr+rrrr sz&FileFinder.__init__..rarN) r_loadersrArVrCrrR _path_mtimeset _path_cache_relaxed_path_cache)rrAloader_detailsZloadersrrr_rrs    zFileFinder.__init__cCs d|_dS)zInvalidate the directory mtime.rN)rarrrrrNrQzFileFinder.invalidate_cachescCs6tdt||}|durdgfS|j|jpgfS)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. zeFileFinder.find_loader() is deprecated and slated for removal in Python 3.12; use find_spec() insteadN)rcrdrerrr)rrrrrrrs zFileFinder.find_loadercCs|||}t||||dS)Nr)r)rrrrAZsmslrrrrrr[s zFileFinder._get_specNc Cszd}|dd}z t|jptj}Wn ty d}Ynw||jkr-|||_t r8|j }| }n|j }|}||vrlt |j|}|jD]\} } d| } t || } t| rg|| || |g|SqJt|}|jD]7\} } z t |j|| } Wn tyYdSwtjd| dd|| |vrt| r|| || d|Sqo|rtd |t|d} |g| _| SdS) zoTry to find a spec for the specified module. Returns the matching spec, or None if not found. Frar,rrNz trying {})Z verbosityzpossible namespace for {})rhrKrArrRr#rLra _fill_cacherrdrrcrCr`rPr[rSrorrrr)rrrZ is_namespaceZ tail_modulerZcacheZ cache_moduleZ base_pathr,rZ init_filenameZ full_pathrrrrrsV          zFileFinder.find_specc Cs|j}z t|p t}Wntttfyg}Ynwtj ds)t ||_ n%t }|D]}| d\}}}|rCd ||}n|}||q.||_ tj tr^dd|D|_dSdS)zDFill the cache of potential modules and packages for this directory.rrarXcSsh|]}|qSr)r)rZfnrrrr Gsz)FileFinder._fill_cache..N)rArZlistdirrRrUPermissionErrorNotADirectoryErrorrrrrbrcr~rYraddrrd) rrAZcontentsZlower_suffix_contentsrFrr6r,Znew_namerrrrf*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|s td|d|gRS)z-Path hook for importlib.machinery.FileFinder.zonly directories are supportedrG)rSrrGrrerrpath_hook_for_FileFinderSs z6FileFinder.path_hook..path_hook_for_FileFinderr)rrerkrrjr path_hookIs zFileFinder.path_hookcCrC)NzFileFinder({!r}))rYrArrrrrD[r=zFileFinder.__repr__rE)rrrrrrNrrrr[rrfrrlrDrrrrr^s 3  r^cCs|d}|d}|s!|r|j}n||krt||}nt||}|s*t|||d}z||d<||d<||d<||d<WdStyGYdSw)N __loader____spec__r_Z__file__Z __cached__)getrr)r"r Exception)ZnsrZpathnameZ cpathnamerrrrr_fix_up_moduleas$     rqcCs&ttf}ttf}ttf}|||gS)z_Returns a list of file-based module loaders. Each item is a tuple (loader, suffixes). )rrextension_suffixesr"rr)rq)Z extensionsZsourceZbytecoderrrrxs  rcCs|adSrE)r)_bootstrap_modulerrr_set_bootstrap_modulesrtcCs2t|t}tjtj|gtjt dS)z)Install the path-based import components.N) rtrrrSrr^rl meta_pathr=rM)rsZsupported_loadersrrr_installsrv)rWrE)NNN)rr)T)Urrrr[rrcrrrZntrrZposixr2allr;rr9r>Z_pathseps_with_colonrZ%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrrr$r*r-rCrJrKrOrPrSrVr_type__code__rr"rr!r'rrtrprr=rrrrqZDEBUG_BYTECODE_SUFFIXESZOPTIMIZED_BYTECODE_SUFFIXESryrrrrrrrrrrrrrobjectrrrrrr r"r)rr/rIrMr^rqrrtrvrrrrs            G(  !    IC2-5?1  c@sdZddZdZdZdZdaddZddZiZiZ Gdd d e Z Gd d d Z Gd d d Z GdddZddZddZddZddddZddZddZddZd d!ZGd"d#d#Zddd$d%d&Zd`d'd(Zd)d*d+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Z Gd9d:d:Z!Gd;d<d<Z"Gd=d>d>Z#d?d@Z$dAdBZ%dadCdDZ&dEdFZ'dGZ(e(dHZ)dIdJZ*e+Z,dKdLZ-dbdNdOZ.d)dPdQdRZ/dSdTZ0dcdVdWZ1dXdYZ2dZd[Z3d\d]Z4d^d_Z5dS)daSCore implementation of 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. cCs&z|jWStyt|jYSwN) __qualname__AttributeErrortype)objr _object_names  rNcCs8dD]}t||rt||t||q|j|jdS)z/Simple substitute for functools.update_wrapper.) __module____name__r__doc__N)hasattrsetattrgetattr__dict__update)ZnewZoldreplacerrr_wrap(s  rcCs tt|Sr)rsysnamerrr _new_module0s rc@s eZdZdS)_DeadlockErrorN)r rrrrrrr=src@s8eZdZdZddZddZddZdd Zd d Zd S) _ModuleLockzA recursive lock implementation which is able to detect deadlocks (e.g. thread 1 trying to take locks A then B, and thread 2 trying to take locks B then A). cCs0t|_t|_||_d|_d|_d|_dSN)_threadZ allocate_locklockwakeuprownercountwaitersselfrrrr__init__Gs   z_ModuleLock.__init__cCsVt}|j}t} t|}|durdS|j}||krdS||vr%dS||q )NTF)r get_identrset _blocking_ongetadd)r!ZmetidZseenrrrr has_deadlockOs  z_ModuleLock.has_deadlockcCst}|t|<zW |j@|jdks|j|kr/||_|jd7_ WdWt|=dS|r9td||j drF|j d7_ Wdn1sPwY|j |j q t|=w)z Acquire the module lock. If a potential deadlock is detected, a _DeadlockError is raised. Otherwise, the lock is always acquired and True is returned. TrNzdeadlock detected by %rF) rr#r%rrrr)rracquirerreleaser!r(rrrr+ds*    z_ModuleLock.acquirecCst}|jG|j|krtd|jdksJ|jd8_|jdkr>d|_|jrF|jd8_|jWddSWddSWddS1sQwYdS)Ncannot release un-acquired lockrr*) rr#rr RuntimeErrorrrrr,r-rrrr,}s    "z_ModuleLock.releasecCd|jt|S)Nz_ModuleLock({!r}) at {}formatridr!rrr__repr__z_ModuleLock.__repr__N) r rrr r"r)r+r,r5rrrrrAs rc@s0eZdZdZddZddZddZdd Zd S) _DummyModuleLockzVA simple _ModuleLock equivalent for Python builds without multi-threading support.cCs||_d|_dSr)rrr rrrr" z_DummyModuleLock.__init__cCs|jd7_dS)Nr*T)rr4rrrr+sz_DummyModuleLock.acquirecCs$|jdkr td|jd8_dS)Nrr.r*)rr/r4rrrr,s z_DummyModuleLock.releasecCr0)Nz_DummyModuleLock({!r}) at {}r1r4rrrr5r6z_DummyModuleLock.__repr__N)r rrr r"r+r,r5rrrrr7s  r7c@s$eZdZddZddZddZdS)_ModuleLockManagercCs||_d|_dSr)_name_lockr rrrr"r8z_ModuleLockManager.__init__cCst|j|_|jdSr)_get_module_lockr:r;r+r4rrr __enter__s z_ModuleLockManager.__enter__cOs|jdSr)r;r,)r!argsZkwargsrrr__exit__sz_ModuleLockManager.__exit__N)r rrr"r=r?rrrrr9s r9cCstz@zt|}Wn tyd}Ynw|dur>tdur%t|}nt|}|fdd}t||t|<Wt |SWt |St w)zGet or create the module lock for a given module name. Acquire/release internally the global import lock to protect _module_locks.NcSsDtzt||urt|=WtdSWtdStwr)_imp acquire_lock _module_locksr& release_lock)refrrrrcbs z_get_module_lock..cb) r@rArBKeyErrorrr7r_weakrefrDrC)rrrErrrr<s&     r<cCs6t|}z|Wn tyYdSw|dS)zAcquires then releases the module lock for a given module name. This is used to ensure a module is completely initialized, in the event it is being imported by another thread. N)r<r+rr,)rrrrr_lock_unlock_modules   rHcOs||i|S)a.remove_importlib_frames in import.c will always remove sequences of importlib frames that end with a call to this function Use it instead of a normal call in places where including the importlib frames introduces unwanted noise into the traceback (e.g. when executing module code) r)fr>Zkwdsrrr_call_with_frames_removedsrJr*) verbositycGs:tjj|kr|dsd|}t|j|tjddSdS)z=Print the message to stderr if -v/PYTHONVERBOSE is turned on.)#zimport z# )ZfileN)rflagsverbose startswithprintr2stderr)messagerKr>rrr_verbose_messages  rScfdd}t||S)z1Decorator to verify the named module is built-in.cs&|tjvrtd||d||S)N{!r} is not a built-in moduler)rbuiltin_module_names ImportErrorr2r!fullnamefxnrr_requires_builtin_wrapper   z4_requires_builtin.._requires_builtin_wrapperr)r[r\rrZr_requires_builtin  r_crT)z/Decorator to verify the named module is frozen.cs&t|std||d||SNz{!r} is not a frozen moduler)r@ is_frozenrWr2rXrZrr_requires_frozen_wrapper r]z2_requires_frozen.._requires_frozen_wrapperr^)r[rcrrZr_requires_frozenr`rdcCsJd}t|tt||}|tjvr!tj|}t||tj|St|S)zLoad the specified module into sys.modules and return it. This method is deprecated. Use loader.exec_module() instead. zgthe load_module() method is deprecated and slated for removal in Python 3.12; use exec_module() instead) _warningswarnDeprecationWarningspec_from_loaderrmodules_exec_load)r!rYmsgspecmodulerrr_load_module_shims      rocCst|dd}t|dd}rt|St|dr'z||WSty&Ynwz|j}Wn ty7d}Ynwz|j}WntyW|durOd|YSd||YSwd||S) z,The implementation of ModuleType.__repr__(). __loader__N__spec__ module_repr? ) r _module_repr_from_specr rr Exceptionr r__file__r2)rnloaderrmrfilenamerrr _module_repr&s,         r|c@sreZdZdZddddddZddZdd Zed d Zej d d Zed dZ eddZ e j ddZ dS) ModuleSpecaThe specification for a module, used for loading. A module's spec is the source for information about the module. For data associated with the module, including source, use the spec's loader. `name` is the absolute name of the module. `loader` is the loader to use when loading the module. `parent` is the name of the package the module is in. The parent is derived from the name. `is_package` determines if the module is considered a package or not. On modules this is reflected by the `__path__` attribute. `origin` is the specific location used by the loader from which to load the module, if that information is available. When filename is set, origin will match. `has_location` indicates that a spec's "origin" reflects a location. When this is True, `__file__` attribute of the module is set. `cached` is the location of the cached bytecode file, if any. It corresponds to the `__cached__` attribute. `submodule_search_locations` is the sequence of path entries to search when importing submodules. If set, is_package should be True--and False otherwise. Packages are simply modules that (may) have submodules. If a spec has a non-None value in `submodule_search_locations`, the import system will consider modules loaded from the spec as packages. Only finders (see importlib.abc.MetaPathFinder and importlib.abc.PathEntryFinder) should modify ModuleSpec instances. N)origin loader_state is_packagecCs6||_||_||_||_|rgnd|_d|_d|_dS)NF)rrzr~rsubmodule_search_locations _set_fileattr_cached)r!rrzr~rrrrrr"es zModuleSpec.__init__cCsfd|jd|jg}|jdur|d|j|jdur(|d|jd|jjd|S)Nz name={!r}z loader={!r}z origin={!r}zsubmodule_search_locations={}z{}({})z, ) r2rrzr~appendr __class__r join)r!r>rrrr5qs    zModuleSpec.__repr__cCsf|j}z$|j|jko&|j|jko&|j|jko&||jko&|j|jko&|j|jkWSty2tYSwr)rrrzr~cached has_locationrNotImplemented)r!ZotherZsmslrrr__eq__{s       zModuleSpec.__eq__cCs:|jdur|jdur|jrtdurtt|j|_|jSr)rr~r_bootstrap_externalNotImplementedErrorZ _get_cachedr4rrrrs zModuleSpec.cachedcCs ||_dSr)r)r!rrrrrs cCs |jdur |jddS|jS)z The name of the module's parent.N.r)rr rpartitionr4rrrparents zModuleSpec.parentcCs|jSr)rr4rrrrszModuleSpec.has_locationcCst||_dSr)boolr)r!valuerrrrs) r rrr r"r5rpropertyrsetterrrrrrrr}@s"$       r}r~rcCst|dr%tdur ttj}|dur|||dS|rgnd}||||dS|durCt|drAz||}WqCty@d}YqCwd}t||||dS)z5Return a module spec based on various loader methods.Z get_filenameN)rz)rzrrFr)r rrspec_from_file_locationrrWr})rrzr~rrZsearchrrrrhs&     rhcCs&z|j}Wn tyYnw|dur|S|j}|dur+z|j}Wn ty*Ynwz|j}Wn ty;d}Ynw|durW|durUz|j}WqWtyTd}YqWw|}z|j}Wn tygd}Ynwzt|j}Wn tyzd}Ynwt |||d}|durdnd|_ ||_ ||_ |S)Nr~FT) rqrr rpry_ORIGIN __cached__list__path__r}rrr)rnrzr~rmrZlocationrrrrr_spec_from_modulesT           rFoverridecCs|s t|dddurz|j|_Wn tyYnw|s$t|dddurW|j}|durH|jdurHtdur6ttj}| |}|j|_ ||_d|_ z||_ Wn tyVYnw|sat|dddurqz|j |_Wn typYnwz||_Wn tyYnw|st|dddur|jdurz|j|_Wn tyYnw|jr|st|dddurz|j|_ Wn tyYnw|st|dddur|jdurz|j|_W|StyY|Sw|S)Nr rp __package__rryr)r rr rrzrrr_NamespaceLoader__new__Z_pathryrprrrqrrr~rr)rmrnrrzrrrr_init_module_attrssr                   rcCsRd}t|jdr|j|}n t|jdrtd|dur"t|j}t|||S)z+Create a module based on the provided spec.N create_module exec_modulezBloaders that define exec_module() must also define create_module())r rzrrWrrrrmrnrrrmodule_from_spec4s    rcCsd|jdurdn|j}|jdur |jdurd|Sd||jS|jr*d||jSd|j|jS)z&Return the repr to use for the module.Nrsrtrurv)rr~rzr2r)rmrrrrrwEs   rwc Cs|j}t|{tj||urd|}t||dzP|jdur5|jdur-td|jdt ||ddn(t ||ddt |jdsWt |jd}t |t|j|n|j|Wtj|j}|tj|j<ntj|j}|tj|j<wWd|S1swY|S) zFExecute the spec's specified module in an existing module's namespace.zmodule {!r} not in sys.modulesrNmissing loaderTrr7.exec_module() not found; falling back to load_module())rr9rrir&r2rWrzrrr rrerf ImportWarning load_modulerpop)rmrnrrlrrrrjVs2         rjcCsz |j|jWn|jtjvr tj|j}|tj|j<tj|j}|tj|j<t|dddurFz|j|_Wn tyEYnwt|dddurlz|j |_ t |dsa|j dd|_ Wn tykYnwt|dddurz||_ W|StyY|Sw|S)Nrprrrrrq)rzrrrrirr rprr rr rrqrrrr_load_backward_compatibletsB        rc Cs|jdurt|jdst|jd}t|tt|St|}d|_zP|t j |j <z|jdur>|j dur=t d|j dn|j|Wnzt j |j =WtyYYwt j |j }|t j |j <td|j |jWd|_|Sd|_w)NrrTrrzimport {!r} # {!r}F)rzr rrerfrrrZ _initializingrrirrrWrrFrrS)rmrlrnrrr_load_unlockeds<          rcCs6t|j t|WdS1swYdS)zReturn a new module object, loaded by the spec's loader. The module is not added to its parent. If a module is already in sys.modules, that existing module gets clobbered. N)r9rrrmrrrrks $rkc@seZdZdZdZeddZedddZeddd Z ed d Z ed d Z ee ddZ ee ddZee ddZeeZdS)BuiltinImporterzMeta path import for built-in modules. All methods are either class or static methods to avoid the need to instantiate the class. zbuilt-incCs"tdtd|jdtjdS)sReturn repr for the module. The method is deprecated. The import machinery does the job itself. zQBuiltinImporter.module_repr() is deprecated and slated for removal in Python 3.12z)rerfrgr rrrnrrrrrszBuiltinImporter.module_reprNcCs*|durdSt|rt|||jdSdSNr)r@Z is_builtinrhrclsrYpathtargetrrr find_specs  zBuiltinImporter.find_speccCs*tdt|||}|dur|jSdS)zFind the built-in module. If 'path' is ever specified then the search is considered a failure. This method is deprecated. Use find_spec() instead. zjBuiltinImporter.find_module() is deprecated and slated for removal in Python 3.12; use find_spec() insteadN)rerfrgrrz)rrYrrmrrr find_modules   zBuiltinImporter.find_modulecCs.|jtjvrtd|j|jdttj|S)zCreate a built-in modulerUr)rrrVrWr2rJr@Zcreate_builtinrrrrrs   zBuiltinImporter.create_modulecCsttj|dS)zExec a built-in moduleN)rJr@Z exec_builtinrrrrr szBuiltinImporter.exec_modulecCdS)z9Return None as built-in modules do not have code objects.NrrrYrrrget_codezBuiltinImporter.get_codecCr)z8Return None as built-in modules do not have source code.Nrrrrr get_sourcerzBuiltinImporter.get_sourcecCr)z4Return False as built-in modules are never packages.FrrrrrrrzBuiltinImporter.is_packageNNr)r rrr r staticmethodrr classmethodrrrrr_rrrrorrrrrrs.         rc@seZdZdZdZeddZedddZeddd Z ed d Z ed d Z eddZ ee ddZee ddZee ddZdS)FrozenImporterzMeta path import for frozen modules. All methods are either class or static methods to avoid the need to instantiate the class. ZfrozencCstdtd|jtjS)rzPFrozenImporter.module_repr() is deprecated and slated for removal in Python 3.12r)rerfrgr2r rr)mrrrrr/szFrozenImporter.module_reprNcCst|r t|||jdSdSr)r@rbrhrrrrrr:s zFrozenImporter.find_speccCstdtt|r |SdS)z]Find a frozen module. This method is deprecated. Use find_spec() instead. ziFrozenImporter.find_module() is deprecated and slated for removal in Python 3.12; use find_spec() insteadN)rerfrgr@rb)rrYrrrrrAszFrozenImporter.find_modulecCr)z*Use default semantics for module creation.NrrrrrrMszFrozenImporter.create_modulecCs@|jj}t|std||dttj|}t||j dSra) rqrr@rbrWr2rJget_frozen_objectexecr)rnrcoderrrrQs   zFrozenImporter.exec_modulecCs t||S)z_Load a frozen module. This method is deprecated. Use exec_module() instead. )rorrrrrZs zFrozenImporter.load_modulecC t|S)z-Return the code object for the frozen module.)r@rrrrrrd zFrozenImporter.get_codecCr)z6Return None as frozen modules do not have source code.NrrrrrrjrzFrozenImporter.get_sourcecCr)z.Return True if the frozen module is a package.)r@Zis_frozen_packagerrrrrprzFrozenImporter.is_packagerr)r rrr rrrrrrrrrrrdrrrrrrrr$s0         rc@s eZdZdZddZddZdS)_ImportLockContextz$Context manager for the import lock.cC tdS)zAcquire the import lock.N)r@rAr4rrrr=} z_ImportLockContext.__enter__cCr)zYWdqYnw||||}Wdn1sQwY|dur|s|tjvrtj|}z|j } Wn t yx|YSw| dur|S| S|SqdS)zFind a module's spec.Nz5sys.meta_path is None, Python is likely shutting downzsys.meta_path is empty) r meta_pathrWrerfrrirrrrrq) rrrrZ is_reloadrrrmrnrqrrr _find_specsD           rcCsnt|tstdt||dkrtd|dkr)t|ts#td|s)td|s3|dkr5tddSdS)zVerify arguments are "sane".zmodule name must be str, not {}rzlevel must be >= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module nameN) isinstancestr TypeErrorr2r ValueErrorrWrrrrrr _sanity_checks   rzNo module named z{!r}c Csd}|dd}|r@|tjvrt|||tjvrtj|Stj|}z|j}Wnty?td||}t||ddwt ||}|durRtt||dt |}|rtj|}|dd}z t |||W|Styd|d|}t |tY|Sw|S)Nrrz; {!r} is not a packagerzCannot set an attribute on z for child module )rrrirJrr_ERR_MSGr2ModuleNotFoundErrorrrr rerfr) rimport_rrZ parent_modulerlrmrnZchildrrr_find_and_load_unlockeds<          rcCst|tj|t}|turt||WdSWdn1s&wY|dur:d|}t||dt||S)zFind and load the module.Nz(import of {} halted; None in sys.modulesr) r9rrir&_NEEDS_LOADINGrr2rrH)rrrnrRrrr_find_and_loads  rrcCs*t||||dkrt|||}t|tS)a2Import and return the module based on its name, the package the call is being made from, and the level adjustment. This function represents the greatest common denominator of functionality between import_module and __import__. This includes setting __package__ if the loader did not. r)rrr _gcd_importrrrrrs   r recursivec Cs|D]h}t|ts |r|jd}nd}td|dt|j|dkr5|s4t|dr4t||j|ddqt||sjd |j|}zt ||Wqt yi}z|j |krdt j |td urdWYd }~qd }~wwq|S) zFigure out what __import__ should return. The import_ parameter is a callable which takes the name of module to import. It is required to decouple the function from assuming importlib's import implementation is desired. z.__all__z ``from list''zItem in z must be str, not *__all__TrrN)rrr rrr _handle_fromlistrr2rJrrrrir&r)rnfromlistrrxZwhereZ from_nameZexcrrrrs8        rcCs|d}|d}|dur)|dur'||jkr'tjd|d|jdtdd|S|dur0|jStjd tdd|d }d |vrG|d d }|S)zCalculate what __package__ should be. __package__ is not guaranteed to be defined or could be set to None to represent that its proper value is unknown. rrqNz __package__ != __spec__.parent (z != ))Z stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__r rrr)r&rrerfrr)globalsrrmrrr_calc___package__Bs*  rrc Cs|dkr t|}n|dur|ni}t|}t|||}|sJ|dkr*t|ddS|s.|St|t|dd}tj|jdt|j|St|drUt||tS|S)aImport a module. The 'globals' argument is used to infer where the import is occurring from to handle relative imports. The 'locals' argument is ignored. The 'fromlist' argument specifies what should exist as attributes on the module being imported (e.g. ``from module import ``). The 'level' argument represents the package location to import from in a relative import (e.g. ``from ..pkg import mod`` would have a 'level' of 2). rNrr) rr partitionrrrir r r) rrlocalsrrrnZglobals_rZcut_offrrr __import__]s    rcCs&t|}|durtd|t|S)Nzno built-in module named )rrrWr)rrmrrr_builtin_from_names  rc Cs|a|att}tjD]$\}}t||r1|tjvrt}n t|r&t }nq t ||}t ||q tjt }dD]}|tjvrEt |} ntj|} t||| q9dS)zSetup importlib by importing needed built-in modules and injecting them into the global namespace. As sys is needed for sys.modules access and _imp is needed to load built-in modules, those two modules must be explicitly passed in. )rrerGN)r@rrriitemsrrVrrbrrrr rr ) sys_module _imp_moduleZ module_typerrnrzrmZ self_moduleZ builtin_nameZbuiltin_modulerrr_setups(          rcCs&t||tjttjtdS)z0Install importers for builtin and frozen modulesN)rrrrrr)rrrrr_installs  rcCs ddl}|a|tjtdS)z9Install importers that require external filesystem accessrN)_frozen_importlib_externalrrrrir )rrrr_install_external_importerssrrrr)NNrr)6r rrrerGrrrrBr%r/rrr7r9r<rHrJrSr_rdror|r}rhrrrrwrjrrrkrrrrrrrZ_ERR_MSG_PREFIXrrobjectrrrrrrrrrrrrrrsh M%   e -H$-PU  /  % %#  , int[b "#g$% M3 +$3u 3 3:2B): 3cSc |  ' $ > &II4: ;!9!I? !I :!; 9 I8 !I/!I/ %  $ >   : ; 9  4: ; 9 I?< 4: ; 9 I4G: ; 9 SK long long intshort unsigned int_Py_M__importlib_bootstraplong unsigned intnamelong long unsigned intunsigned charcharGNU C99 11.2.0 -mtune=generic -march=x86-64 -g -O3 -std=c99 -fwrapv -fno-semantic-interposition -fvisibility=hidden -fprofile-generate -fPIC -fprofile-update=prefer-atomic -fasynchronous-unwind-tables_frozenPyImport_FrozenModulesdoublelong int_PyImport_FrozenModules_Py_M__zipimport_Py_M__hellocodesigned charsizefloatshort int_Py_M__importlib_bootstrap_externalunsigned intPython/frozen.c/opt/logicmoo_workspace/packs_sys/logicmoo_opencog/Python-3.10.2/opt/logicmoo_workspace/packs_sys/logicmoo_opencog/Python-3.10.2Python./Include/cpythonfrozen.cimport.himportlib.himportlib_external.himportlib_zipimport.hfrozen_hello.hfrozen.cGCC: (Debian 11.2.0-16) 11.2.0    " u= Ba 3Br frozen.c_PyImport_FrozenModules_Py_M__importlib_bootstrap_Py_M__importlib_bootstrap_external_Py_M__zipimport_Py_M__hello   0-8 H7P`AhxL  }   ! <( / j; B I W l^ xo v S}  e F N   N !  ! @ K i t u  " Q& * 4 9 > C H M R .symtab.strtab.shstrtab.text.data.bss.rela.data.rel.local.rodata.str1.1.rela.data.rel.ro.local.rodata.rela.debug_info.debug_abbrev.rela.debug_aranges.rela.debug_line.debug_str.debug_line_str.comment.note.GNU-stack@!@'@1@,@nA2H\U P@n he ufp@o Nh i @r +iW@s0i0k 0l llh  ns