Ë �e2ï¹·÷éãó—dZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm Z dd lm Z dd lm Z dd lm Z dd lmZd dlZd dlZd dlZd„Zd„Zdd„Zdd„ZGd„d«ZGd„dej.«ZGd„de«Zy)z-Utility code for constructing importers, etc.é)ÚLoader)Úmodule_from_spec)Ú _resolve_name)Úspec_from_loader)Ú _find_spec)Ú MAGIC_NUMBER)Ú_RAW_MAGIC_NUMBER)Úcache_from_source)Ú decode_source)Úsource_from_cache)Úspec_from_file_locationéNcó6—tjt|«S)zBReturn the hash of *source_bytes* as used in hash-based pyc files.)Ú_impÚ source_hashr )Ú source_bytess ú%/usr/lib/python3.12/importlib/util.pyrrs€ä × Ñ Ô-¨|Ó <Ð<ócó¦—|jd«s|S|stdt|«›d�«‚d}|D]}|dk7rn|dz }Œt||d||«S)z2Resolve a relative module name to an absolute one.Ú.zno package specified for z% (required for relative module names)rrN)Ú startswithÚ ImportErrorÚreprr)ÚnameÚpackageÚlevelÚ characters rÚ resolve_namersw€à �?‰?˜3Ô Øˆ Ù ÜÐ5´d¸4³j°\ðBAðAóBð Bà €EÛˆ Ø ˜Ò Ù Ø �‰ ‰ðô ˜˜e˜f˜ w°Ó 6Ð6rcóà—|tjvr t||«Stj|}|€y |j}|€t |›d�«‚|S#t $rt |›d�«d‚wxYw)a‡Return the spec for the specified module. First, sys.modules is checked to see if the module was already imported. If so, then sys.modules[name].__spec__ is returned. If that happens to be set to None, then ValueError is raised. If the module is not in sys.modules, then sys.meta_path is searched for a suitable spec with the value of 'path' given to the finders. None is returned if no spec could be found. Dotted names do not have their parent packages implicitly imported. You will most likely need to explicitly import all parent packages in the proper order for a submodule to get the correct spec. Nú.__spec__ is Noneú.__spec__ is not set)ÚsysÚmodulesrÚ__spec__Ú ValueErrorÚAttributeError)rÚpathÚmoduleÚspecs rÚ_find_spec_from_pathr*'sˆ€ð ”3—;‘;Ñܘ$ Ó%Ð%ä—‘˜TÑ"ˆØ ˆ>Øð Ø—?‘?ˆDðˆ|Ü  D 6Ð):Ð!;Ó<Ð<؈Køô ò FÜ ˜vÐ%9Ð:Ó;ÀÐ Eð Fús ¶ AÁA-cóЗ|jd«r t||«n|}|tjvr@|j d«d}|rt |dg¬«} |j }nd}t||«Stj|}|€y |j}|€t|›d �«‚|S#t$r}td|›d|›�|¬«|‚d}~wwxYw#t$rt|›d �«d‚wxYw) a¯Return the spec for the specified module. First, sys.modules is checked to see if the module was already imported. If so, then sys.modules[name].__spec__ is returned. If that happens to be set to None, then ValueError is raised. If the module is not in sys.modules, then sys.meta_path is searched for a suitable spec with the value of 'path' given to the finders. None is returned if no spec could be found. If the name is for submodule (contains a dot), the parent module is automatically imported. The name and package arguments work the same as importlib.import_module(). In other words, relative module names (with leading dots) work. rrÚ__path__)Úfromlistz __path__ attribute not found on z while trying to find )rNr r!) rrr"r#Ú rpartitionÚ __import__r,r&ÚModuleNotFoundErrorrr$r%) rrÚfullnameÚ parent_nameÚparentÚ parent_pathÚer(r)s rÚ find_specr6Fs€ð"/3¯o©o¸cÔ.BŒ|˜D 'Ô*È€HØ”s—{‘{Ñ"Ø×)Ñ)¨#Ó.¨qÑ1ˆ Ù Ü  °z°lÔCˆFð PØ$Ÿo™o‘ ð ˆKܘ( KÓ0Ð0ä—‘˜XÑ&ˆØ ˆ>Øð Ø—?‘?ˆDðˆ|Ü  D 6Ð):Ð!;Ó<Ð<؈Køô%"ò PÜ)Ø6°{°oðF,Ø,4¨<ð9Ø?GôIàNOðPûð Pûôò FÜ ˜vÐ%9Ð:Ó;ÀÐ Eð Fús$Á B' C Â' C Â0CÃC à C%có2—eZdZdZd„Zd„Zd„Zed„«Zy)Ú+_incompatible_extension_module_restrictionsagA context manager that can temporarily skip the compatibility check. NOTE: This function is meant to accommodate an unusual case; one which is likely to eventually go away. There's is a pretty good chance this is not what you were looking for. WARNING: Using this function to disable the check can lead to unexpected behavior and even crashes. It should only be used during extension module development. If "disable_check" is True then the compatibility check will not happen while the context manager is active. Otherwise the check *will* happen. Normally, extensions that do not support multiple interpreters may not be imported in a subinterpreter. That implies modules that do not implement multi-phase init or that explicitly of out. Likewise for modules import in a subinterpeter with its own GIL when the extension does not support a per-interpreter GIL. This implies the module does not have a Py_mod_multiple_interpreters slot set to Py_MOD_PER_INTERPRETER_GIL_SUPPORTED. In both cases, this context manager may be used to temporarily disable the check for compatible extension modules. You can get the same effect as this function by implementing the basic interface of multi-phase init (PEP 489) and lying about support for multiple interpreters (or per-interpreter GIL). có$—t|«|_y©N)ÚboolÚ disable_check)Úselfr<s rÚ__init__z4_incompatible_extension_module_restrictions.__init__—s€Ü! -Ó0ˆÕrcóN—tj|j«|_|Sr:)rÚ'_override_multi_interp_extensions_checkÚoverrideÚold©r=s rÚ __enter__z5_incompatible_extension_module_restrictions.__enter__šs€Ü×?Ñ?ÀÇ Á ÓNˆŒØˆ rcóJ—|j}|`tj|«yr:)rBrr@)r=ÚargsrBs rÚ__exit__z4_incompatible_extension_module_restrictions.__exit__žs€Ø�h‰hˆØ ˆHÜ ×4Ñ4°SÕ9rcó"—|jrdSdS)Néÿÿÿÿr)r<rCs rrAz4_incompatible_extension_module_restrictions.override£s€à×'Ò'ˆrÐ.¨QÐ.rN) Ú__name__Ú __module__Ú __qualname__Ú__doc__r>rDrGÚpropertyrA©rrr8r8ws*„ñò>1òò:ð ñ/óñ/rr8có—eZdZdZd„Zd„Zy)Ú _LazyModulezKA subclass of the module type which triggers loading upon attribute access.có—tj|d«}|j}|d5tj|d«tu�r#|drtj||«cddd«Sd|d<tj|d«}|j}|d}|}i}|j «D]2\} } | |vr| || <Œt || «t || «k7sŒ.| || <Œ4|jj|«|tjvr7t |«t tj|«k7rtd|›d �«‚|j|«tj|_ddd«t!||«S#1swYŒxYw) z8Trigger the load of the module and return the attribute.r$ÚlockÚ __class__Ú is_loadingNTÚ__dict__zmodule object for z. substituted in sys.modules during a lazy load)ÚobjectÚ__getattribute__Ú loader_staterQrÚitemsÚidÚloaderÚ exec_moduler"r#r%ÚupdateÚtypesÚ ModuleTyperTÚgetattr) r=Úattrr$rYrVÚ original_nameÚ attrs_thenÚ attrs_nowÚ attrs_updatedÚkeyÚvalues rrXz_LazyModule.__getattribute__¬sƒ€ä×*Ñ*¨4°Ó<ˆØ×,Ñ,ˆ Ø ˜&Ó !ô×&Ñ& t¨[Ó9¼[ÒHð    Ò-Ü!×2Ñ2°4¸Ó>÷"Ñ !ð.2� ˜\Ñ*ä!×2Ñ2°4¸ÓD�ð !)§ ¡ � ð*¨*Ñ5� Ø$� Ø "� Ø"+§/¡/Ö"3‘J�C˜ð *Ñ,Ø-2˜  cÒ*ܘI c™NÓ+¬r°*¸S±/Ó/BÓBØ-2˜  cÒ*ð #4ð—‘×+Ñ+¨DÔ1ð!¤C§K¡KÑ/ܘ$“x¤2¤c§k¡k°-Ñ&@Ó#AÒAÜ(Ð+=¸mÐ=NðO1ð*1ó2ð2ð —‘  Ô.ä!&×!1Ñ!1�”÷W"ôZ�t˜TÓ"Ð"÷["Ð !ús¨8E=Á*A-E=ÃBE=Å=Fcó>—|j|«t||«y)z/Trigger the load and then perform the deletion.N)rXÚdelattr)r=rbs rÚ __delattr__z_LazyModule.__delattr__ßs€ð ×јdÔ#Ü��dÕrN)rJrKrLrMrXrkrOrrrQrQ¨s„áUò1#ófrrQcóB—eZdZdZed„«Zed„«Zd„Zd„Z d„Z y)Ú LazyLoaderzKA loader that creates a module which defers loading until attribute access.có2—t|d«s td«‚y)Nr]z loader must define exec_module())ÚhasattrÚ TypeError)r\s rÚ__check_eager_loaderzLazyLoader.__check_eager_loaderës€ä�v˜}Ô-ÜÐ>Ó?Ð ?ð.rcó4‡‡—‰j‰«ˆˆfd„S)z>Construct a callable which returns the eager loader made lazy.có •—‰‰|i|¤Ž«Sr:rO)rFÚkwargsÚclsr\s €€rÚz$LazyLoader.factory..ôsø€¡s©6°4Ð+B¸6Ñ+BÔ'Cr)Ú_LazyLoader__check_eager_loader)rur\s``rÚfactoryzLazyLoader.factoryðsù€ð × Ñ  Ô(ÜCÐCrcó4—|j|«||_yr:)rwr\)r=r\s rr>zLazyLoader.__init__ös€Ø ×!Ñ! &Ô)؈� rcó8—|jj|«Sr:)r\Ú create_module)r=r)s rr{zLazyLoader.create_moduleús€Ø�{‰{×(Ñ(¨Ó.Ð.rcó(—ddl}|j|j_|j|_i}|jj «|d<|j |d<|j«|d<d|d<||j_t|_y)zMake the module load lazily.rNrVrTrSFrU) Ú threadingr\r$Ú __loader__rVÚcopyrTÚRLockrYrQ)r=r(r}rYs rr]zLazyLoader.exec_moduleýs€€ó Ø!%§¡ˆ�‰ÔØ ŸK™KˆÔð ˆ Ø#)§?¡?×#7Ñ#7Ó#9ˆ �ZÑ Ø$*×$4Ñ$4ˆ �[Ñ!Ø(Ÿ™Ó0ˆ �VÑØ%*ˆ �\Ñ"Ø'3ˆ�‰Ô$Ü&ˆÕrN) rJrKrLrMÚ staticmethodrwÚ classmethodrxr>r{r]rOrrrmrmçs>„áUàñ@óð@ðñDóðDò ò/ó'rrmr:)rMÚ_abcrÚ _bootstraprrrrÚ_bootstrap_externalrr r r r r rr"r_rrr*r6r8r`rQrmrOrrÚr†sqðÙ3ÝÝ(Ý%Ý(Ý"Ý-Ý2Ý2Ý.Ý2Ý8ã Û Û ò=ò 7óó>*÷b./ñ./ôb<�%×"Ñ"ô<ô~''�õ''r