=Ogb $dZdaddlZddlZddlZddlZddlZejdkZer ddl Z ddl Z nddl Z erddgZ ndgZ e dZee Zde Z de DZdZd ZeezZd ZeZd Zd Zd ZerdZndZdZdZdZdZdZ erdZ!ndZ!dNdZ"e#e"j$Z%d&dddzZ'e()e'dZ*dZ+dZ,dgZ-ere-.d ej/Z0d!gZ1e1xZ2Z3dOdd"d#Z4d$Z5d%Z6d&Z7d'Z8d(Z9d)Z:d*Z;d+ZdQd.Z?dRd0Z@d1ZAeBZCdOdeCd2d3ZDGd4d5ZEGd6d7ZFGd8d9eFZGGd:d;ZHGd<d=eHeGZIGd>d?eHeFZJGd@dAeHeFZKGdBdCZLGdDdEZMeMZNGdFdGZOGdHdIZPdOdJZQdKZRdLZSdMZTdS)Sa^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. Nwin32\/ch|]}d|S):).0ss D/opt/alt/python311/lib64/python3.11/importlib/_bootstrap_external.py r 2s999AA999)win)cygwindarwinctjtr/tjtrdndfd}nd}|S)N PYTHONCASEOKs PYTHONCASEOKcDtjj o tjvS)z^True if filenames must be checked case-insensitively and ignore environment flags are not set.)sysflagsignore_environment_osenvironkeysr _relax_casez%_make_relax_case.._relax_caseCsy33Js{8J JrcdS)z5True if filenames must be checked case-insensitively.Fr r rr rz%_make_relax_case.._relax_caseGs5r)rplatform startswith_CASE_INSENSITIVE_PLATFORMS#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rrs @r _make_relax_caser"<s| |:;;  < " "#F G G " CC!C K K K K K K    rcNt|dzddS)z*Convert a 32-bit integer to little-endian.little)intto_bytes)xs r _pack_uint32r*Os# FFZ  ) )!X 6 66rc8t|dS)z/Convert 4 bytes in little-endian to an integer.r&r' from_bytesdatas r _unpack_uint32r0T >>$ ) ))rc8t|dS)z/Convert 2 bytes in little-endian to an integer.r&r,r.s r _unpack_uint16r3Yr1rc|sdSt|dkr|dSd}g}ttj|D]\}}|t s|t r(|tp|}t|zg}a|drF| | kr|}|g}| ||p|}| |d|D}t|dkr|ds |tzS|t |zS)Replacement for os.path.join().rrrcFg|]}||tSr rstrippath_separators)r ps r z_path_join..ws)===a1=))===r) lenmapr_path_splitrootrpath_sep_tupleendswithr9r:path_sepcasefoldappendjoin) path_partsrootpathnew_roottails r _path_joinrK`sg 2 z??a  a= !#"5zBB " "NHd"">22 "h6G6G6W6W "77?4 4(""3'' "==??h&7&7&9&999$D 6DDKK%%%%'4 D!!!!==4=== t99>>$q'>(? "hmmD))))rcJtd|DS)r5cFg|]}||tSr r8)r parts r r<z_path_join..s8>>>"&>dkk/::>>>r)rBrE)rFs r rKrK~s4}}>>*4>>>?? ?rctfdtD}|dkrdfSd||dzdfS)z Replacement for os.path.split().c3BK|]}|VdSN)rfind)r r;rHs r z_path_split..s- 3 3aDJJqMM 3 3 3 3 3 3rrrNr6)maxr:)rHis` r _path_splitrVsV 3 3 3 3? 3 3 333A1uu4x 8T!a%&&\ !!rc*tj|S)z~Stat the path. Made a separate function to make it easier to override in experiments (e.g. cache stat results). )rstatrHs r _path_statrZs 8D>>rcb t|}n#t$rYdSwxYw|jdz|kS)z1Test whether the path is the specified mode type.Fi)rZOSErrorst_mode)rHmode stat_infos r _path_is_mode_typer`sKt$$ uu   (T 11s   c"t|dS)zReplacement for os.path.isfile.i)r`rYs r _path_isfilerbs dH - --rcL|stj}t|dS)zReplacement for os.path.isdir.i@)rgetcwdr`rYs r _path_isdirres% z|| dH - --rc|sdStj|ddd}t|dko)|dp|dS)Replacement for os.path.isabs.Frrrr6z\\)rr?replacer=rrA)rHrGs r _path_isabsrisf 5"4((+33C>>4yy1}Q$//&"9"9"PT]]4=P=PQrc6|tS)rg)rr:rYs r riris///rcd|t|}tj|tjtjztjz|dz} tj|d5}| |dddn #1swxYwYtj ||dS#t$r( tj |n#t$rYnwxYwwxYw)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.{}.{}rkwbN) formatidropenO_EXCLO_CREATO_WRONLY_ioFileIOwriterhr\unlink)rHr/r^path_tmpfdfiles r _write_atomicr|s6 ~~dBtHH--H (*s{*S\94%< I IB ZD ! ! T JJt                   Hd#####   Jx     D  sT"B;7B B;BB; B!B;; C-CC- C(%C-'C((C-i r&s __pycache__zopt-z.pyz.pywz.pyc) optimizationc|3tjdt|d}t||rdnd}t j|}t |\}}|d\}}}tj j } | tdd |r|n||| g} |)tj jdkrd}ntj j}t|}|dkrR|s"t#d |d | t&|} | t(dz} tjt-|s!t/t j|}|dd kr|dt2vr |d d}t/tj|t2| St/|t6| 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 Nonerr6.$sys.implementation.cache_tag is Nonerz{!r} is not alphanumericz{}.{}{}rr}) _warningswarnDeprecationWarning TypeErrorrfspathrV rpartitionrimplementation cache_tagNotImplementedErrorrEroptimizestrisalnum ValueErrorro_OPTBYTECODE_SUFFIXESpycache_prefixrirKrdr:lstrip_PYCACHE) rHdebug_overridermessageheadrJbasesepresttagalmost_filenamefilenames r cache_from_sourcers$!01C E E E  #JGG$$ $+2rr :d  DT""JD$ooc**OD#t  &C {!"HIIIgg 6$cBCCO 9  " "LL9-L|$$Lr##%% N7>>|LLMM M#**?D,OO!21!55H %4   2cjllD11D 7c>>d1g_<<8D   KK ( (    dHh / //rctjjtdt j|}t |\}}d}tjZtjt}| |tzr|t|d}d}|s6t |\}}|tkrttd||d}|dvrtd||d kr|dd d }| t"std t"|tt"d}|std |d|dd} t)|| t*dzS)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. NrFTz not bottom-level directory in r>r}zexpected only 2 or 3 dots in rr}z5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer)rrrrrrrVrr9r:rrBr=rrcountrsplitrr partitionrKSOURCE_SUFFIXES) rHrpycache_filenamefound_in_pycache_prefix stripped_pathpycache dot_countr opt_level base_filenames r source_from_cachers #+!"HIII :d  D(..D # %*11/BB ??=83 4 4 +M**++,D&* # "*#D)) g h  )) $))** * &&s++IM9IMMNNN a'..sA66r: &&t,, /.%)..// / T,   "" 32<22233 3$..s33A6M dMOA,>> ? ??rc0t|dkrdS|d\}}}|r |dddkr|S t|}n!#tt f$r |dd}YnwxYwt |r|n|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. rNrpy)r=rlowerrrrrb) bytecode_pathr_ extension source_paths r _get_sourcefiler$s =Qt&11#66D!Y 9??$$RU+t33)' 66  ,)))#CRC( )&{33 F;;FsA$$BBc|ttr! t|S#t$rYdSwxYw|tt r|SdSrQ)rAtuplerrrr)rs r _get_cachedr7s~//00 $X.. ."    DD    5!233 4 4ts8 AAc` t|j}n#t$rd}YnwxYw|dz}|S)z3Calculate the mode permissions for a bytecode file.rk)rZr]r\)rHr^s r _calc_moderCsM$'  EMD Ks  &&cZdfd }t tj}nd}|||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. Nc||j}n'|j|krtd|jd||||g|Ri|S)Nz loader for z cannot handle name)r ImportError)selfrargskwargsmethods r _check_name_wrapperz(_check_name.._check_name_wrapperWsn <9DD Y$  +!%DD28<>>> >vdD242226222rc dD]1}t||rt||t||2|j|jdS)N) __module____name__ __qualname____doc__)hasattrsetattrgetattr__dict__update)newoldrhs r _wrapz_check_name.._wrapdsaP A A3((AC'#w*?*?@@@ L   - - - - -rrQ) _bootstrapr)rrrs` r _check_namerOs]333333  . . .  E v&&& rctjdt||\}}|Dt |r5d}tj||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)rrr find_loaderr=ro ImportWarning)rfullnameloaderportionsmsgs r _find_module_shimrnsvNP%''' ''11FH ~#h--~<szz(1+.. >>> Mrcv|dd}|tkr0d|d|}td|t|fi|t |dkr/d|}td|t |t |dd}|d zrd |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. Nr%zbad magic number in z: {}z(reached EOF while reading pyc header of zinvalid flags z in ) MAGIC_NUMBERr_verbose_messagerr=EOFErrorr0)r/r exc_detailsmagicrrs r _classify_pycrs !HE <<<5<<##D'222'11[111 4yy2~~ETEE##D'222w 4!9 % %E u}2858888'11[111 Lrct|dd|dzkr-d|}td|t|fi||.t|dd|dzkrtd|fi|dSdS)aValidate a pyc against the source last-modified time. *data* is the contents of the pyc file. (Only the first 16 bytes are required.) *source_mtime* is the last modified timestamp of the source file. *source_size* is None or the size of the source file in bytes. *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. An ImportError is raised if the bytecode is stale. r r$zbytecode is stale for rNr)r0rrr)r/ source_mtime source_sizerrrs r _validate_timestamp_pycrs&d1R4j!!lZ&?@@3433##D'222'11[111tBrE{## j(@AA;4;;KK{KKK AArcB|dd|krtd|fi|dS)aValidate a hash-based pyc by checking the real source hash against the one in the pyc header. *data* is the contents of the pyc file. (Only the first 16 bytes are required.) *source_hash* is the importlib.util.source_hash() of the source file. *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. An ImportError is raised if the bytecode is stale. rrz.hash in bytecode doesn't match hash of source N)r)r/ source_hashrrs r _validate_hash_pycrsI" AbDz[   Fd F F     ! rctj|}t|tr4td||t j|||Std |||)z#Compile bytecode as found in a pyc.zcode object from {!r}NzNon-code object in {!r}rrH) marshalloads isinstance _code_typerr_imp_fix_co_filenamerro)r/rrrcodes r _compile_bytecoders =  D$ ##9##$;]KKK  "  !$ 4 4 4 3::=II#-999 9rcHtt}|td|t||t||t j||S)z+Produce the data for a timestamp-based pyc.r bytearrayrextendr*rdumps)rmtimerr/s r _code_to_timestamp_pycrs| \ " "DKK Q   KK U##$$$KK [))***KK d##$$$ KrTctt}d|dzz}|t||||t j||S)z&Produce the data for a hash-based pyc.r6r)rrcheckedr/rs r _code_to_hash_pycrsj \ " "D 'Q, EKK U##$$$KK KK d##$$$ Krcddl}tj|j}||}tjdd}|||dS)zyDecode bytes representing source code and return the string. Universal newline support is used in the decoding. rNT)tokenizeruBytesIOreadlinedetect_encodingIncrementalNewlineDecoderdecode) source_bytesrsource_bytes_readlineencodingnewline_decoders r decode_sourcersl OOOK 55>''(=>>H3D$??O  ! !,"5"5hqk"B"B C CCrrsubmodule_search_locationsc*|:d}t|dr' ||}ng#t$rYn[wxYwnVtj|}t |s3 t tj|}n#t$rYnwxYwt |||}d|_ |MtD]<\}}| t|r|||}||_n=dS|t urAt|dr0 ||}|rg|_n#t$rYn wxYwn||_|jgkr1|r/t'|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)rrrrrrirKrdr\r ModuleSpec _set_fileattr_get_supported_file_loadersrArr _POPULATErrrVrD) rlocationrrspec loader_classsuffixesrdirnames r spec_from_file_locationr" s  6> * *  !..t44      :h''8$$  %cjllH==      vh ? ?DD~&A&C&C   "L(  x11 %dH55$   4"Y.. 6< ( ( 9 9#..t44 968D3      9+E' &",,  <!(++A.G  + 2 27 ; ; ; Ks0, 99!!B BB D?? E  E ceZdZdZdZdZeodevZe dZ e dZ e d dZ e d d ZdS) 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.pydc tjtj|S#t$r"tjtj|cYSwxYwrQ)winregOpenKeyHKEY_CURRENT_USERr\HKEY_LOCAL_MACHINErs r _open_registryz$WindowsRegistryFinder._open_registry_sW B>&":C@@ @ B B B>&";SAA A A A Bs!)A  A c4|jr|j}n|j}||dtjddz} ||5}tj|d}dddn #1swxYwYn#t$rYdSwxYw|S)Nz%d.%dr})r sys_versionr) DEBUG_BUILDREGISTRY_KEY_DEBUG REGISTRY_KEYror version_infor*r& QueryValuer\)clsr registry_keyrhkeyfilepaths r _search_registryz&WindowsRegistryFinder._search_registryfs ? ,1LL+L!!8.58H!8L.L"NN ##C(( 7D!,T266 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7   44 s6BA;/ B;A??BA?B BBNc>||}|dS t|n#t$rYdSwxYwtD]R\}}|t |r+t |||||}|cSSdS)Nr)r6rZr\rrArrspec_from_loader)r2rrHtargetr5rr rs r find_speczWindowsRegistryFinder.find_specus''11  4  x    44  ; = =   FH  x11 !228396(H3M3M:B3DD    s + 99cxtjdt|||}||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() insteadNrrrr:rr2rrHrs r find_modulez!WindowsRegistryFinder.find_modulesI T) + + +}}Xt,,  ; 4rNNrQ)rrrrr/r. _MS_WINDOWSEXTENSION_SUFFIXESr- staticmethodr* classmethodr6r:r>r rr r$r$SsHH  'A8/A#AKBB\B   [    [    [   rr$c*eZdZdZdZdZdZdZdS) _LoaderBasicszSBase class of common code needed by both SourceLoader and SourcelessFileLoader.ct||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'.r6rrr}__init__)rVrrr)rrr filename_base tail_names r rz_LoaderBasics.is_packagesit00::;;A> Q//2 '',,Q/  *FyJ/FFrcdSz*Use default semantics for module creation.Nr rrs r create_modulez_LoaderBasics.create_modulerc||j}|'td|jtt ||jdS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)get_coderrror_call_with_frames_removedexecr)rmodulers r exec_modulez_LoaderBasics.exec_modulesc}}V_-- <--3VFO-D-DFF F,,T4IIIIIrc8t||S)zThis method is deprecated.)r_load_module_shimrrs r load_modulez_LoaderBasics.load_modules++D(;;;rN)rrrrrrMrTrXr rr rErEs`GGG999JJJ<<<<eZdZdZdZdZdZdZdddZd Z d S) SourceLoaderct)zOptional method that returns the modification time (an int) for the specified path (a str). Raises OSError when the path cannot be handled. )r\rrHs r path_mtimezSourceLoader.path_mtimes  rc0d||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)r]r\s r path_statszSourceLoader.path_statss..//rc.|||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)rr cache_pathr/s r _cache_bytecodezSourceLoader._cache_bytecodes}}Z...rcdS)zOptional method which writes data (bytes) to a file path (a str). Implementing this method allows for the writing of bytecode files. Nr )rrHr/s r razSourceLoader.set_datarNrc||} ||}n$#t$r}td||d}~wwxYwt |S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data()rN)rget_datar\rr)rrrHr excs r get_sourcezSourceLoader.get_sources|  ** 6==..LL 6 6 6G#+---25 6 6\***s- AA  Ar) _optimizecLtt||dd|S)zReturn the code object compiled from source. The 'data' argument can be any object type that compile() supports. rRT) dont_inheritr)rrQcompile)rr/rHris r source_to_codezSourceLoader.source_to_codes1 33GT459I4OO Orc||}d}d}d}d}d} t|} ||} t| d} ||} ||d} t | || } t | dd} | dzdk}|rm| d zdk}tjd krS|stjd krA||}tj t|}t| ||| nt| || d || td ||t| |||S#t t"f$rYn6wxYw#t$$rYn&wxYw#t$$rYnwxYw#t&$rd}YnwxYw|||}|||}td|t*jsu|s|q|r(|tj |}t/|||} nt1||t3|} |||| n#t&$rYnwxYw|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. NFTrrrr6rr}neveralwayssizez {} matches {})rrrzcode object from {})rrr_r'rfr memoryviewrcheck_hash_based_pycsr_RAW_MAGIC_NUMBERrrrrrrrr\rrmrdont_write_bytecoderrr=rc)rrrrr r hash_based check_sourcerstr/rr bytes_data code_objects r rPzSourceLoader.get_codesM''11      3 J-k::M. J__[11 #2g;// (J==77D !) -##KJ -dHk J J%/%5%5bcc%: %*S[A%5 %+04<1+$5$0/"/" !34h3>!@!@!@4 $ , "6 ( + #33O]4?AAA0(?L=H J J JJ (2?D      # ! ! ! MMM !d  ==55L)), DD ##$9;GGG' M,E( A&"&"2<"@"@K(k<PP-k<.1,.?.?AA $$[-FFFF&    sYFFE67B9EE32E36 FF FF F%$F% I!! I.-I.N) rrrr]r_rcrarhrmrPr rr rZrZs 0 0 0///   +++79OOOOORRRRRrrZcveZdZdZdZdZdZefdZedZ dZ edZ xZ S) FileLoaderzgBase file loader class which implements the loader protocol methods that require file system usage.c"||_||_dS)zKCache the module name and the path to the file found by the finder.Nr)rrrHs r rGzFileLoader.__init__Is  rcB|j|jko|j|jkSrQ __class__rrothers r __eq__zFileLoader.__eq__O$%/10 / 1rcTt|jt|jz SrQhashrrHrs r __hash__zFileLoader.__hash__SDIdi00rcTtt||S)zdLoad a module from a file. This method is deprecated. Use exec_module() instead. )superr|rX)rrrs r rXzFileLoader.load_moduleVs#Z&&228<<? @ @ #s4yy)) #Tyy{{ # # # # # # # # # # # # # # # # # #D#&& #$yy{{ # # # # # # # # # # # # # # # # # #s#AA#&A#B""B&)B&c$ddlm}||S)Nr) FileReader)importlib.readersr)rrSrs r get_resource_readerzFileLoader.get_resource_readerps$000000z$r) rrrrrGrrrrXrrfr __classcell__)rs@r r|r|Ds"" 111111 = = = =[ =[###  [     rr|c*eZdZdZdZdZdddZdS)SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.c>t|}|j|jdS)z!Return the metadata for the path.)rrq)rZst_mtimest_size)rrHrxs r r_zSourceFileLoader.path_statszs!   bj999rcPt|}||||S)N_mode)rra)rrrr/r^s r rcz SourceFileLoader._cache_bytecodes'+&&}}]D}===rrkrcpt|\}}g}|rGt|s8t|\}}|||rt|8t|D]g}t ||} t j|(#t$rY4t$r(}t d||Yd}~dSd}~wwxYw t|||t d|dS#t$r'}t d||Yd}~dSd}~wwxYw)zWrite bytes data to a file.zcould not create {!r}: {!r}Nz created {!r}) rVrerDreversedrKrmkdirFileExistsErrorr\rrr|) rrHr/rparentrrFrNrgs r razSourceFileLoader.set_datas&t,,  $[00 $&v..LFD   d # # # $[00 $Z((  D--F  &!!!!"      ++,I,2C999    - $e , , ,  ' ' = = = = = - - -  ' '(Et(+ - - - - - - - - - -s6B C! C*C  C,D D5D00D5N)rrrrr_rcrar rr rrvsVHH::: >>> -2-------rrceZdZdZdZdZdS)SourcelessFileLoaderz-Loader which handles sourceless file imports.c||}||}||d}t|||tt |dd||S)Nrr)rr)rrfrrrr)rrrHr/rs r rPzSourcelessFileLoader.get_codes  **}}T""   dHk222 t  RSS !    rcdS)z'Return None as there is no source code.Nr rWs r rhzSourcelessFileLoader.get_sourcetrN)rrrrrPrhr rr rrs877   rrcXeZdZdZdZdZdZdZdZdZ dZ d Z e d Z d S) rz]Loader for extension modules. The constructor is designed to work with FileFinder. c"||_||_dSrQr)rrrHs r rGzExtensionFileLoader.__init__s  rcB|j|jko|j|jkSrQrrs r rzExtensionFileLoader.__eq__rrcTt|jt|jz SrQrrs r rzExtensionFileLoader.__hash__rrcttj|}td|j|j|S)z(Create an uninitialized extension modulez&extension module {!r} loaded from {!r})rrQrcreate_dynamicrrrH)rrrSs r rMz!ExtensionFileLoader.create_modulesH55  ''##$LDI / / / rcttj|td|j|jdS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)rrQr exec_dynamicrrrHrrSs r rTzExtensionFileLoader.exec_modulesI,,T->GGG##$NDI / / / / /rcxt|jdtfdtDS)z1Return True if the extension module is a package.r6c3*K|] }d|zkVdS)rGNr )r suffix file_names r rSz1ExtensionFileLoader.is_package..sA55 V 33555555r)rVrHanyrA)rrrs @r rzExtensionFileLoader.is_packagesO **1- 5555!355555 5rcdS)z?Return None as an extension module cannot create a code object.Nr rWs r rPzExtensionFileLoader.get_coderrcdS)z5Return None as extension modules have no source code.Nr rWs r rhzExtensionFileLoader.get_sourcerrc|jSrrYrWs r rz ExtensionFileLoader.get_filenamerrN)rrrrrGrrrMrTrrPrhrrr rr rrs 111111/// 555 [rrcXeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd 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.rc||_||_t||_|j|_||_dSrQ)_name_pathr_get_parent_path_last_parent_path_epoch _last_epoch _path_finderrrrH path_finders r rGz_NamespacePath.__init__sD  !&t'<'<'>'>!?!?;'rcV|jd\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rr)rrH__path__)rr)rrdotmes r _find_parent_path_namesz&_NamespacePath._find_parent_path_namess8*//44R "99 =z!!rcp|\}}ttj||SrQ)rrrmodules)rparent_module_namepath_attr_names r rz_NamespacePath._get_parent_path s1-1-I-I-K-K*Ns{#56GGGrct|}||jks|j|jkrJ||j|}||j|jr |j|_ ||_|j|_|j SrQ) rrrrrrrrrr)r parent_pathrs r _recalculatez_NamespacePath._recalculatesD113344 $0 0 0DK4CS4S4S$$TZ==DDK$72A!%!@DJ%0D "#{D zrcDt|SrQ)iterrrs r __iter__z_NamespacePath.__iter__sD%%''(((rc6||SrQr)rindexs r __getitem__z_NamespacePath.__getitem__"s  ""5))rc||j|<dSrQ)r)rrrHs r __setitem__z_NamespacePath.__setitem__%s  5rcDt|SrQ)r=rrs r __len__z_NamespacePath.__len__(s4$$&&'''rc6d|jS)Nz_NamespacePath({!r}))rorrs r __repr__z_NamespacePath.__repr__+s%,,TZ888rc.||vSrQrritems r __contains__z_NamespacePath.__contains__.st((****rc:|j|dSrQ)rrDrs r rDz_NamespacePath.append1s $rN)rrrrrrGrrrrrrrrrrDr rr rrsF((("""HHH   )))***!!!(((999+++     rrcTeZdZdZedZdZdZdZdZ dZ dZ d Z d S) NamespaceLoaderc2t||||_dSrQ)rrrs r rGzNamespaceLoader.__init__9s#D$ << rcjtjdtd|jS)zsReturn repr for the module. The method is deprecated. The import machinery does the job itself. zQNamespaceLoader.module_repr() is deprecated and slated for removal in Python 3.12z)rrrror)rSs r module_reprzNamespaceLoader.module_repr<s9 ;rRT)rk)rlrWs r rPzNamespaceLoader.get_codeMsr:vDAAAArcdSrKr rLs r rMzNamespaceLoader.create_modulePrNrcdSrQr rs r rTzNamespaceLoader.exec_moduleSs rcxtd|jt||S)zbLoad a namespace module. This method is deprecated. Use exec_module() instead. z&namespace module loaded with path {!r})rrrrVrWs r rXzNamespaceLoader.load_moduleVs< ##$L$(J 0 0 0++D(;;;rc.ddlm}||jS)Nr)NamespaceReader)rrr)rrSrs r rz#NamespaceLoader.get_resource_readerbs&555555tz***rN) rrrrGrBrrrhrPrMrTrXrr rr rr8s===CC\CBBB999    < < <+++++rrceZdZdZedZedZedZedZ ed dZ ed dZ ed d Z ed Z dS) PathFinderz>Meta path finder for sys.path and package __path__ attributes.cLttjD]H\}}|t |stj|=$t |dr|Itxjdz c_ddl m }|dS)z}Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).Ninvalidate_cachesr6rMetadataPathFinder) listrpath_importer_cacheitemsrirrrrimportlib.metadatar)rfinderrs r rzPathFinder.invalidate_cachesqs!!8!>!>!@!@AA + +LD&~[%6%6~+D11!455 +((*** "999999,,.....rctj&tjstjdttjD]} ||cS#t $rYwxYwdS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r path_hooksrrrr)rHhooks r _path_hookszPathFinder._path_hookssw > %cn % N4m D D DN  D tDzz!!!    4s A AAc|dkr& tj}n#t$rYdSwxYw tj|}n4#t $r'||}|tj|<YnwxYw|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. rN)rrdFileNotFoundErrorrrKeyErrorr)r2rHrs r _path_importer_cachezPathFinder._path_importer_caches 2:: z||$   tt  3,T2FF 3 3 3__T**F,2C #D ) ) ) 3 s **A.A21A2ct|drPt|d}tj|t ||\}}nNt|d}tj|t ||}g}|t||St |d}||_ |S)Nrz5.find_spec() not found; falling back to find_loader()z5.find_spec() not found; falling back to find_module()) rr _object_namerrrrr>r8rr)r2rrrrrrs r _legacy_get_speczPathFinder._legacy_get_specs 6= ) )  --f55444C N3 . . .%11(;; FHH --f55444C N3 . . .''11FH  ..x@@ @$$Xt44*2' rNcg}|D]}t|ts||}|xt|dr|||}n|||}|o|j|cS|j}|td| |t |d}||_|S)z?Find the loader or namespace_path for this module/package name.Nr:zspec missing loader) rrrrr:r rrrrrr) r2rrHr9namespace_pathentryrrrs r _get_speczPathFinder._get_specs   EeS)) --e44F!6;//B!++Hf==DD//&AAD<;*KKK:#%&;<<< %%h///((488D.[^[h2i2i/ tKrcxtjdt|||}|dS|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() insteadNr<r=s r r>zPathFinder.find_modulesH T) + + +}}Xt,, <4{rc(ddlm}|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``. rr)rrfind_distributions)rrrs r rzPathFinder.find_distributionss/ :999994!4dEfEEErrQr?)rrrrrBrrrCrr r r:r>rr rr rrmsHH//\/"  \ [*[([>[.   [  F F\ F F FrrcXeZdZdZdZdZeZdZdZ d dZ dZ e d Z d ZdS) FileFinderzFile-based finder. Interactions with the file system are cached for performance, being refreshed when the directory the finder is handling has been modified. cg}|D]&\}|fd|D'||_|r|dkrtj|_n=t |s't tj||_n||_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.c3 K|]}|fV dSrQr )r rrs r rSz&FileFinder.__init__.. s(CCFF+CCCCCCrrrN) r_loadersrrdrHrirK _path_mtimeset _path_cache_relaxed_path_cache)rrHloader_detailsloadersr rs @r rGzFileFinder.__init__s . D D FH NNCCCC(CCC C C C C  ts{{ DIIT"" "3:<<66DIIDI55#&55   rcd|_dS)zInvalidate the directory mtime.rN)rrs r rzFileFinder.invalidate_caches-srctjdt||}|dgfS|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)rrrr:rr)rrrs r rzFileFinder.find_loader3sW T) + + +~~h'' <8O{D;ArAArc@|||}t||||S)Nr)r")rrrrHsmslr9rs r r zFileFinder._get_specBs7h--&xfBFHHH HrNcd}|dd} t|jptjj}n#t $rd}YnwxYw||jkr|||_tr|j }| }n |j }|}||vrqt|j|}|jD]E\} } d| z} t|| } t| r|| || |g|cSFt#|}|jD]\} } t|j|| z} n#t$$rYdSwxYwt&d| d|| z|vr*t| r|| || d|cS|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. Frr}rrGNz trying {}) verbosityzpossible namespace for {})rrZrHrrdrr\r _fill_cacherrrrrKrrbr rerrrrr)rrr9 is_namespace tail_modulercache cache_module base_pathrr init_filename full_pathrs r r:zFileFinder.find_specGs_  ))#..q1  ty8CJLL99BEE   EEE  D$ $ $      $D  == ',E&,,..LL$E&L 5 "49k::I(,  6 6$ *V 3 &y-@@  **b>>,)i[Z`aaaaab +955 $(M 8 8 FL &ty+2FGG    ttt   ' ' Y! ' L L Lf$-- **8>>,)*.88888    ' '(CY O O O((488D/8kD +Kts#,A AA9E E! E!cd|j} tj|ptj}n#tt t f$rg}YnwxYwtj dst||_ nut}|D]]}| d\}}}|r)d ||}n|}||^||_ tj t rd|D|_dSdS)zDFill the cache of potential modules and packages for this directory.rrrmc6h|]}|Sr )r)r fns r r z)FileFinder._fill_cache..s 'F'F'Fr 'F'F'FrN)rHrlistdirrdrPermissionErrorNotADirectoryErrorrrrrrrroraddr r) rrHcontentslower_suffix_contentsrrrrnew_names r r#zFileFinder._fill_cachezsAy {4#73:<<88HH!?4FG   HHH  |&&u-- 5"8}}D  %(EE !  4 4$(NN3$7$7!c6$&~~dFLLNNCCHH#H%))(33334D  < " "#> ? ? G'F'FX'F'F'FD $ $ $ G Gs'1A  A cfd}|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. cVt|std||gRS)z-Path hook for importlib.machinery.FileFinder.zonly directories are supportedrY)rer)rHr2rs r path_hook_for_FileFinderz6FileFinder.path_hook..path_hook_for_FileFinders@t$$ O!"BNNNN3t-n--- -rr )r2rr7s`` r path_hookzFileFinder.path_hooks* . . . . . . ('rc6d|jS)NzFileFinder({!r}))rorHrs r rzFileFinder.__repr__s!((333rrQ)rrrrrGrrr>rr r:r#rCr8rr rr rrs)))&$K B B BHHH 1111fGGG>(([("44444rrc4|d}|d}|s1|r|j}n'||krt||}nt||}|st |||} ||d<||d<||d<||d<dS#t $rYdSwxYw)N __loader____spec__)r__file__ __cached__)getrrrr" Exception)nsrpathname cpathnamerrs r _fix_up_modulerDs VVL ! !F 66*  D 6  6[FF  " ")$99FF%dH55F F&tXfEEE :!<!:$<      s3B BBcxttjf}ttf}t t f}|||gS)z_Returns a list of file-based module loaders. Each item is a tuple (loader, suffixes). )rrextension_suffixesrrrr) extensionssourcebytecodes r rrs9 %d&=&?&??J  .F#%66H  ))rc |adSrQ)r)_bootstrap_modules r _set_bootstrap_modulerLs "JJJrct|t}tjt j|gtjtdS)z)Install the path-based import components.N) rLrrrrrr8 meta_pathrDr)rKsupported_loaderss r _installrPs[+,,,355N:/1BCDEEEM$$$$$r)rkrQ)NNN)rr)T)Urrrrurrrrr@ntrr&posixr:rBrr@rE_pathseps_with_colonr!%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYr r"rr*r0r3rKrVrZr`rbrerir|type__code__rr(rr'r-rtrrrrDrFrArDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESrrrrrrrrrrrrrrobjectrr"r$rErZr|rrrrr_NamespaceLoaderrrrDrrLrPr rr r[s(,  |w& MMMMSkOOeO 1 ''''/**99999'-#(:% E"E!F   777 *** *** "?****<??? """222... ... 0RRRR000 ,T-( ) ) jq(++g5 NN<::  '#6""",T,..H8II5D0D0D0D0D0D0N%@%@%@PGGG&      >(BLLL8   0 9 9 9 9 D D D FHH D47@DDDDDR@@@@@@@@F<<<<<<<<