Rh7dZdaddlZddlZddlZddlZddlZejdk(Zer ddl Z ddl Z nddl Z erddgZ ndgZ ede DsJe dZee Zdj%e Z e Dchc]}d| c}Zd Zd ZeezZd ZeZd Zd ZdZerdZndZdZdZdZdZ dZ!erdZ"ndZ"dZ#dNdZ$e%e$jLZ'djQdddzZ)e*jWe)dZ,dZ-dZ.d gZ/ere/jad!ejbZ2d"gZ3e3xZ4Z5dOdd#d$Z6d%Z7d&Z8d'Z9d(Z:d)Z;d*ZdPd-Z?dQd.Z@dRd/ZAd0ZBeCZDdOdeDd1d2ZEd3ZFGd4d5ZGGd6d7ZHGd8d9eHZIGd:d;ZJGd<d=eJeIZKGd>d?eJeHZLGd@dAeJeHZMGdBdCZNGdDdEZOeOZPGdFdGZQGdHdIZRdOdJZSdKZTdLZUdMZVycc}w)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\/c#8K|]}t|dk(yw)N)len).0seps 4/usr/lib/python3.12/importlib/_bootstrap_external.py r .s 4S3s8q= 4s:)win)cygwindarwinctjjtr/tjjtrdndfd}|Sd}|S)N PYTHONCASEOKs PYTHONCASEOKcbtjj xrtjvS)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_caseCs$yy333Js{{8J Jcy)z5True if filenames must be checked case-insensitively.Frrr rz%_make_relax_case.._relax_caseGsr)rplatform startswith_CASE_INSENSITIVE_PLATFORMS#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rrs @r _make_relax_caser$<sN ||:; << " "#F G C!C K   rc>t|dzjddS)z*Convert a 32-bit integer to little-endian.little)intto_bytes)xs r _pack_uint32r,Os FZ  ) )!X 66rcNt|dk(sJtj|dS)z/Convert 4 bytes in little-endian to an integer.r'r(rr) from_bytesdatas r _unpack_uint32r2T# t9>> >>$ ))rcNt|dk(sJtj|dS)z/Convert 2 bytes in little-endian to an integer.r(r.r0s r _unpack_uint16r6Yr3rc|syt|dk(r|dSd}g}ttj|D]\}}|j t s|j t r$|jtxs|}t|zg}T|j dr9|j|jk7r|}|g}|j||xs|}|j||Dcgc]}|s|jt}}t|dk(r|ds |tzS|tj|zScc}w)Replacement for os.path.join().r rrr) rmapr_path_splitrootr!path_sep_tupleendswithrstrippath_separatorspath_sepcasefoldappendjoin) path_partsrootpathnew_roottailps r _path_joinrI`s+ z?a a= !#"5"5zB "NHd"">2h6G6G6W7?4 4(""3'==?h&7&7&99$D 6DKK%'4 D! "48=a1)== t9>$q'(? "hmmD))) >s 0E8Ec|tj|Dcgc]}|r|jtc}Scc}w)r8)r?rBr=r>)rCparts r rIrI~s9}}*4>"&#kk/:>? ?>s9c`tfdtD}|dkrdfSd||dzdfS)z Replacement for os.path.split().c3@K|]}j|ywN)rfind)r rHrEs r r z_path_split..s 3aDJJqM 3srr Nr)maxr>)rEis` r _path_splitrRs> 3? 33A1u4x 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). )rstatrEs r _path_statrVs 88D>rc\ t|}|jdz|k(S#t$rYywxYw)z1Test whether the path is the specified mode type.Fi)rVOSErrorst_mode)rEmode stat_infos r _path_is_mode_typer\s=t$     (T 11 s  ++ct|dS)zReplacement for os.path.isfile.i)r\rUs r _path_isfiler^s dH --rcF|stj}t|dS)zReplacement for os.path.isdir.i@)rgetcwdr\rUs r _path_isdirras zz| dH --rc|sytj|djdd}t|dkDxr$|j dxs|j dS)Replacement for os.path.isabs.Frrrrz\\)rr:replacerr!r<)rErDs r _path_isabsresT""4(+33C>4y1}Q$//&"9"PT]]4=PQrc,|jtS)rc)r!r>rUs r reres//rct|s=tD]}|jd|}tt j |S|S)z Replacement for os.path.abspath..)rer> removeprefixrIrr`)rEr s r _path_abspathrjsG t " 0C$$qY/D 0#**,-- rc|dt|}tj|tjtjztj z|dz} t j|d5}|j|dddtj||y#1swY xYw#t$r' tj|#t$rYwxYwwxYw)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.rhwbN) idropenO_EXCLO_CREATO_WRONLY_ioFileIOwriterdrXunlink)rEr1rZpath_tmpfdfiles r _write_atomicrzs qD #H (**s{{*S\\94%< IB ZZD ! T JJt   Hd#     JJx      sHB/2B#B/#B,(B// C9CC CCCCi r5r(s __pycache__zopt-z.pyz.pywz.pyc) optimizationc<|/tjdt| d}t||rdnd}t j |}t |\}}|jd\}}}tjj} | tddj|r|n||| g} |:tjjdk(rd}ntjj}t|}|dk7r+|j!st#|d | dt$|} | t&dz} tj(Qt+|}|dd k(r|dt,vr|d d}t/tj(|j1t,| St/|t2| 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 rrh$sys.implementation.cache_tag is Nonerz is not alphanumericrr5) _warningswarnDeprecationWarning TypeErrorrfspathrR rpartitionrimplementation cache_tagNotImplementedErrorrBroptimizestrisalnum ValueError_OPTBYTECODE_SUFFIXESpycache_prefixrjr>rIlstrip_PYCACHE) rEdebug_overrider|messageheadrGbaser resttagalmost_filenamefilenames r cache_from_sourcers$!01C E  #JGG$ $+r ::d DT"JD$ooc*OD#t   & &C {!"HIIgg$cBCO 99   "L99--L|$Lr##% //CDE E,-Qtf\NC!21!55H %T" 7c>d1g_<8D    KK (   dHh //rc$tjj tdt j |}t |\}}d}tjKtjjt}|j|tzr|t|d}d}|s+t |\}}|tk7rttd||jd}|dvrtd||d k(rm|j!dd d }|jt"std t"|tt"d}|j%std |d|j'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. Nr~FTz not bottom-level directory in rh>r5zexpected only 2 or 3 dots in rr5z5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer)rrrrrrrRrr=r>r!r?rrrcountrsplitrr partitionrISOURCE_SUFFIXES) rErpycache_filenamefound_in_pycache_prefix stripped_pathpycache dot_countr| opt_level base_filenames r source_from_cacher(s ##+!"HII ::d D(.D # %**11/B ??=83 4M*+,D&* # "#D) g h z)H $x)* * &&s+I89I8LMNN a'..sA6r: &&t,%%)H./ / T,   "2<2BC223 3$..s3A6M dMOA,>> ??rct|dk(ry|jd\}}}|r|jdddk7r|S t|}t |r|S|S#tt f$r|dd}Y%wxYw)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. rNrhpy)rrlowerrrrr^) bytecode_pathr_ extension source_paths r _get_sourcefilerPs =Q&11#6D!Y 9??$R+t3)' 6 '{3;FF  ,)#CR( )s AA10A1c|jttr t|S|jtt r|Sy#t$rYywxYwrN)r<tuplerrrr)rs r _get_cachedrcsW/0 $X. .   5!23 4 #   s A AAc^ t|j}|dz}|S#t$rd}YwxYw)z3Calculate the mode permissions for a bytecode file.rl)rVrYrX)rErZs r _calc_moderos=$''  EMD K s  ,,cZdfd }ttj}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. c| |j}n,|j|k7rtd|jd||||g|i|S)Nz loader for z cannot handle name)r ImportError)selfrargskwargsmethods r _check_name_wrapperz(_check_name.._check_name_wrappersR <99D YY$ !%D28<> >dD242622rc dD]&}t||st||t||(|jj |jy)N) __module____name__ __qualname____doc__)hasattrsetattrgetattr__dict__update)newoldrds r _wrapz_check_name.._wrapsHP A3(C'#w*?@ A LL   -rrN) _bootstrapr)rrrs` r _check_namer{s33   .  v& rc,|dd}|tk7r*d|d|}tjd|t|fi|t |dkr&d|}tjd|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_messagerrEOFErrorr2)r1r exc_detailsmagicrrs r _classify_pycrs !HE (5)<##D'2'1[11 4y2~>''(=>H33D$?O  ! !,"5"5hqk"B CCrloadersubmodule_search_locationsc|!d}t|dr4 |j|}n!tj|} t |}tj|||}d|_ |?tD]1\}}|jt|s!|||}||_ ny|tur(t|dr# |j|}|rg|_n||_|j gk(r+|r)t#|d}|j j%||S#t$rYwxYw#t $rYwxYw#t$rYewxYw)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)rrrrrrjrXr ModuleSpec _set_fileattr_get_supported_file_loadersr<rr _POPULATEr rrRrA) rlocationrrspec loader_classsuffixesr dirnames r spec_from_file_locationr"sm 6> * !..t4::h' $X.H  vh ?DD~&A&C  "L(  x1%dH5$    "Y. 6< ( 9#..t4 68D3*D' &&", !(+A.G  + + 2 27 ; K]      8  s4D D':D6 D$#D$' D32D36 EEct|tsyt}|jdd}|jd|}|||ury| t dt |d|}||dfvr6|||urt nt}|dtjdt|}|J|!||k7rtjdt|S|S)zCHelper function for _warnings.c See GH#97850 for details. N __loader____spec__z+Module globals is missing a __spec__.loaderrz-Module globals; __loader__ != __spec__.loader) rdictobjectgetrrAttributeErrorrrr)module_globalsmissingrr spec_loaderexcs r _bless_my_loaderr!hs nd +hG    d 3F   j' 2D ~ 7? \JK K$'2Kwo% >$/7$:. CCD D 9    "" " f 3 ;   rcZeZdZdZdZdZexrdevZe dZ e dZ e d dZ y) 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|cYSwxYwrN)winregOpenKeyHKEY_CURRENT_USERrXHKEY_LOCAL_MACHINErs r _open_registryz$WindowsRegistryFinder._open_registrysG B>>&":":C@ @ B>>&";";SA A Bs#&-AAc8|jr |j}n |j}|j|dtj ddz} |j |5}tj|d}ddd|S#1swYSxYw#t$rYywxYw)Nz%d.%dr5)fullname sys_versionr ) DEBUG_BUILDREGISTRY_KEY_DEBUG REGISTRY_KEYformatr version_infor)r% QueryValuerX)clsr+ registry_keyrhkeyfilepaths r _search_registryz&WindowsRegistryFinder._search_registrys ??11L++L!!8.58H8H!8L.L"N ##C( 7D!,,T26 7  7  s0B B6B B B B BBNc|j|}|y t|tD]B\}}|j t |s!t j|||||}|cSy#t$rYywxYw)Nr )r7rVrXrr<rrspec_from_loader)r3r+rEtargetr6rrrs r find_speczWindowsRegistryFinder.find_specs''1    x !< =  FH  x1!22839(H3M:B3D    s A11 A=<A=NN)rrrrr/r. _MS_WINDOWSEXTENSION_SUFFIXESr- staticmethodr) classmethodr7r;rrr r#r#sgH  'A8/A#AKBB     rr#c(eZdZdZdZdZdZdZy) _LoaderBasicszSBase class of common code needed by both SourceLoader and SourcelessFileLoader.ct|j|d}|jddd}|jdd}|dk(xr|dk7S)zConcrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.rrhrr5__init__)rRrrr)rr+r filename_base tail_names r r z_LoaderBasics.is_packages]t00:;A> Q/2 '',Q/  *FyJ/FFrcyz*Use default semantics for module creation.Nrrrs r create_modulez_LoaderBasics.create_modulerc|j|j}|td|jdtj t ||j y)zExecute the module.Nzcannot load module z when get_code() returns None)get_coderrr_call_with_frames_removedexecr)rmodulers r exec_modulez_LoaderBasics.exec_modulesS}}V__- < 3FOO3FG889 9,,T4Irc.tj||S)zThis method is deprecated.)r_load_module_shimrr+s r load_modulez_LoaderBasics.load_modules++D(;;rN)rrrrr rJrQrUrrr rBrBsG9J.>$5$0/" !34h3>!@4 $ , "6 ( + #33O]4?A0(?L=H JJ (2?    # ! M !d  ==5L)), D ##$9;G''M,E(&"&"2"23D3?#AK(k<P-k<.1,.?A $$[-F'  sY EE D< B!D''D98D9< EE EE E('E(=H HHN) rrrrZr\r`r^rdrirMrrr rWrWs, 0/ +79OSrrWcdeZdZdZdZdZdZefdZedZ dZ edZ xZ S) FileLoaderzgBase file loader class which implements the loader protocol methods that require file system usage.c ||_||_y)zKCache the module name and the path to the file found by the finder.Nr)rr+rEs r rDzFileLoader.__init__s  rcj|j|jk(xr|j|jk(SrN __class__rrothers r __eq__zFileLoader.__eq__,%//10 / 1rcXt|jt|jz SrNhashrrErs r __hash__zFileLoader.__hash__DIIdii00rc*tt| |S)zdLoad a module from a file. This method is deprecated. Use exec_module() instead. )superrxrU)rr+r|s r rUzFileLoader.load_modulesZ28<? @s4y) #Tyy{ # #D#& #$yy{ # # # # # #sA?%B ?B Bcddlm}||S)Nr) FileReader)importlib.readersr)rrPrs r get_resource_readerzFileLoader.get_resource_readers0$r) rrrrrDrrrrUrrcr __classcell__)r|s@r rxrx|sX" 11 = =#  rrxc(eZdZdZdZdZdddZy)SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cJt|}|j|jdS)z!Return the metadata for the path.)rrm)rVst_mtimest_size)rrErts r r\zSourceFileLoader.path_statss  bjj99rc@t|}|j|||S)N_mode)rr^)rrrr1rZs r r`z SourceFileLoader._cache_bytecodes!+&}}]D}==rrlrct|\}}g}|r8t|s-t|\}}|j||r t|s-t|D]$}t ||} t j |& t|||tjd|y#t$rYWt$r"}tjd||Yd}~yd}~wwxYw#t$r!}tjd||Yd}~yd}~wwxYw)zWrite bytes data to a file.zcould not create {!r}: {!r}Nz created {!r}) rRrarAreversedrIrmkdirFileExistsErrorrXrrrz) rrEr1rparentrrCrKr s r r^zSourceFileLoader.set_datas&t, [0&v.LFD   d #[0Z( D-F  &!  - $e ,  ' ' =#  ++,I,2C9   -  ' '(Et(+ - - -s6&B">#C" C-C5CC D#C??DN)rrrrr\r`r^rrr rrsH: > -2-rrceZdZdZdZdZy)SourcelessFileLoaderz-Loader which handles sourceless file imports.c|j|}|j|}||d}t|||tt |dd||S)Nrr)rr)rrcrrrn)rr+rEr1rs r rMzSourcelessFileLoader.get_codes_  *}}T"  dHk2 t RS !  rcy)z'Return None as there is no source code.NrrTs r rdzSourcelessFileLoader.get_sourcerN)rrrrrMrdrrr rrs7 rrcPeZdZdZdZdZdZdZdZdZ dZ d Z e d Z y ) rz]Loader for extension modules. The constructor is designed to work with FileFinder. c ||_||_yrNr)rrrEs r rDzExtensionFileLoader.__init__s  rcj|j|jk(xr|j|jk(SrNr{r}s r rzExtensionFileLoader.__eq__rrcXt|jt|jz SrNrrs r rzExtensionFileLoader.__hash__rrctjtj|}tj d|j |j |S)z(Create an uninitialized extension modulez&extension module {!r} loaded from {!r})rrNrcreate_dynamicrrrE)rrrPs r rJz!ExtensionFileLoader.create_modules@55   '##$LDII / rctjtj|tj d|j |j y)zInitialize an extension modulez(extension module {!r} executed from {!r}N)rrNr exec_dynamicrrrErrPs r rQzExtensionFileLoader.exec_modules6,,T->->G##$NDII /rcdt|jdtfdtDS)z1Return True if the extension module is a package.rc3.K|] }d|zk(yw)rDNr)r suffix file_names r r z1ExtensionFileLoader.is_package..s#5 V 335s)rRrEanyr>)rr+rs @r r zExtensionFileLoader.is_packages0 *1- 5!355 5rcy)z?Return None as an extension module cannot create a code object.NrrTs r rMzExtensionFileLoader.get_coderrcy)z5Return None as extension modules have no source code.NrrTs r rdzExtensionFileLoader.get_sourcerrc|jSrrUrTs r rz ExtensionFileLoader.get_filename#rrN)rrrrrDrrrJrQr rMrdrrrrr rrsC 11/ 5 rrcVeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd Zy)_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|_|j |_||_yrN)_name_pathr_get_parent_path_last_parent_path_epoch _last_epoch _path_finderrrrE path_finders r rDz_NamespacePath.__init__4s:  !&t'<'<'>!?;;'rcT|jjd\}}}|dk(ry|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rhr )rrE__path__)rr)rrdotmes r _find_parent_path_namesz&_NamespacePath._find_parent_path_names;s3**//4R "9 z!!rcb|j\}}ttj||SrN)rrrmodules)rparent_module_namepath_attr_names r rz_NamespacePath._get_parent_pathEs--1-I-I-K*Ns{{#56GGrcZt|j}||jk7s|j|jk7r_|j |j |}|)|j|jr|j|_ ||_|j|_|jSrN) rrrrrrrrrr)r parent_pathrs r _recalculatez_NamespacePath._recalculateIsD1134 $00 0DKK4CSCS4S$$TZZ=DDKK$722!%!@!@DJ%0D "#{{D zzrc4t|jSrN)iterrrs r __iter__z_NamespacePath.__iter__WsD%%'((rc(|j|SrNr)rindexs r __getitem__z_NamespacePath.__getitem__Zs  "5))rc"||j|<yrNr)rrrEs r __setitem__z_NamespacePath.__setitem__]s  5rc4t|jSrN)rrrs r __len__z_NamespacePath.__len__`s4$$&''rc"d|jdS)Nz_NamespacePath()rrs r __repr__z_NamespacePath.__repr__cs a00rc&||jvSrNrritems r __contains__z_NamespacePath.__contains__fst((***rc:|jj|yrN)rrArs r rAz_NamespacePath.appendis $rN)rrrrrrDrrrrrrrrrrArrr rr)sFF("H )*!(1+ rrc<eZdZdZdZdZdZdZdZdZ dZ y ) NamespaceLoaderc(t||||_yrN)rrrs r rDzNamespaceLoader.__init__qs#D$ < rcy)NTrrTs r r zNamespaceLoader.is_packagetsrcy)Nr rrTs r rdzNamespaceLoader.get_sourcewsrc tddddS)Nr zrOT)rg)rhrTs r rMzNamespaceLoader.get_codezsr:vDAArcyrHrrIs r rJzNamespaceLoader.create_module}rKrcyrNrrs r rQzNamespaceLoader.exec_modules rcntjd|jtj||S)zbLoad a namespace module. This method is deprecated. Use exec_module() instead. z&namespace module loaded with path {!r})rrrrSrTs r rUzNamespaceLoader.load_modules1 ##$L$(JJ 0++D(;;rc2ddlm}||jS)Nr)NamespaceReader)rrr)rrPrs r rz#NamespaceLoader.get_resource_readers5tzz**rN) rrrrDr rdrMrJrQrUrrrr rrps+=B9  <+rrcteZdZdZedZedZedZed dZ ed dZ edZ y) PathFinderz>Meta path finder for sys.path and package __path__ attributes.c8ttjjD]A\}}| t |stj|=%t |ds2|j Ctxjdz c_ddl m }|j y)z}Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).Ninvalidate_cachesrrMetadataPathFinder) listrpath_importer_cacheitemsrerrrrimportlib.metadatar)rfinderrs r rzPathFinder.invalidate_cachess!!8!8!>!>!@A +LD&~[%6++D1!45((*  + "9,,.rctj*tjstjdttjD] } ||cSy#t $rYwxYw)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r path_hooksrr ImportWarningr)rEhooks r _path_hookszPathFinder._path_hookss^ >> %cnn NN4m DNN D Dz!    sA A'&A'c|dk(r tj} tj|}|S#t$rYywxYw#t $r(|j |}|tj|<Y|SwxYw)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)rr`FileNotFoundErrorrrKeyErrorr)r3rErs r _path_importer_cachezPathFinder._path_importer_caches 2: zz|  3,,T2F %    3__T*F,2C # #D )  3s1A ==-A10A1Nc:g}|D]v}t|ts|j|}|(|j||}|=|j|cS|j }| t d|j|xtj|d}||_|S)z?Find the loader or namespace_path for this module/package name.Nzspec missing loader) rrrr;rrrrrr ) r3r+rEr:namespace_pathentryrrportionss r _get_speczPathFinder._get_specs  EeS)--e4F!''&9<;;*K::#%&;<< %%h/# &((48D.[^[h[h2i/ Krc2ddlm}|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 r zPathFinder.find_distributionss  :4!44dEfEErrNr<) rrrrr?rrr@rrr;r rrr rrs}H//"  *8. F FrrcFeZdZdZdZdZdZd dZdZe dZ d Z y) FileFinderzFile-based finder. Interactions with the file system are cached for performance, being refreshed when the directory the finder is handling has been modified. c g}|D]\}|jfd|D!||_|r|dk(rtj|_nt ||_d|_t|_t|_ y)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|]}|f ywrNr)r rrs r r z&FileFinder.__init__..%sCFF+CsrhrN) r_loadersrr`rErj _path_mtimeset _path_cache_relaxed_path_cache)rrEloader_detailsloadersrrs @r rDzFileFinder.__init__sw . D FH NNC(C C D ts{ DI%d+DI5#&5 rcd|_y)zInvalidate the directory mtime.rN)rrs r rzFileFinder.invalidate_caches0s rc2|||}t||||S)Nr)r)rrr+rEsmslr:rs r rzFileFinder._get_spec4s&h-&xfBFH HrNcd}|jdd} t|jxstjj }||jk7r|j||_tr|j}|j}n|j}|}||vrit|j|}|jD]9\} } d| z} t|| } t| s#|j!| || |g|cSt#|}|jD]a\} } t|j|| z} t&j)d| d|| z|vs@t| sL|j!| || d|cS|r6t&j)d t&j+|d} |g| _| Sy#t $rd}YwxYw#t$$rYywxYw) zoTry to find a spec for the specified module. Returns the matching spec, or None if not found. Frhr5rrDNz trying {}) verbosityzpossible namespace for {})rrVrErr`rrXr _fill_cacherrrrrIrr^rrarrrr r)rr+r: is_namespace tail_modulercache cache_module base_pathrr init_filename full_pathrs r r;zFileFinder.find_spec9s  ))#.q1  tyy8CJJL9BBE D$$ $    $D  =,,E&,,.L$$E&L 5 "499k:I(,  6$ *V 3 &y-@  *>>,)i[Z`aa  6 +95 $(MM 8 FL &tyy+2FG   ' ' Y! ' Lf$- *>>,)*.88 8   ' '(CY O((48D/8kD +KQ E 8  s#5F>(G> G  G  GGcT|j} tj|xstj}tjjdst||_ nXt}|D]B}|jd\}}}|r|d|j}n|}|j|D||_ tjjtr$|D chc]} | jc} |_yy#tt t f$rg}YwxYwcc} w)zDFill the cache of potential modules and packages for this directory.rrhN)rErlistdirr`rPermissionErrorNotADirectoryErrorrr r!rrrraddr"r) rrEcontentslower_suffix_contentsrrrrnew_namefns r rzFileFinder._fill_cachelsyy {{4#73::<8H||&&u-"8}D %(E !  4$(NN3$7!c6"&q(89H#H%))(3  4 5D  << " "#> ?=E'Fr 'FD $ @/"?4FG H 0(Gs+D (D% D"!D"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. cFt|s td||gS)z-Path hook for importlib.machinery.FileFinder.zonly directories are supportedrU)rar)rEr3rs r path_hook_for_FileFinderz6FileFinder.path_hook..path_hook_for_FileFinders)t$!"BNNt-n- -rr)r3rr/s`` r path_hookzFileFinder.path_hooks . ('rc"d|jdS)Nz FileFinder(rrUrs r rzFileFinder.__repr__sTYYM++rrN) rrrrrDrrr;rr@r0rrrr r r s<)"H 1fG>((",rr c2|jd}|jd}|s-|r |j}n||k(r t||}n t||}|s t |||}|rt ||_ ||d<||d<||d<||d<y#t$rYywxYw)Nrr)r__file__ __cached__)rrrrrrjcached Exception)nsrpathname cpathnamerrs r _fix_up_moduler:s VVL !F 66* D  [[F  ")$9F%dH5F &tXfE ' 2DK :!<!:$<    s5B BBcpttjf}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|ayrN)r)_bootstrap_modules r _set_bootstrap_modulerBs"Jrct|t}tjj t j |gtjjty)z)Install the path-based import components.N) rBrrrrr r0 meta_pathrAr)rAsupported_loaderss r _installrFsG+,35NN://1BCDEMM$r)rlrN)NNN)rr)T)Wrrrrsrrrr r=ntrr%posixr>allr?rr;rB_pathseps_with_colonr#%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYr"r$rr,r2r6rIrRrVr\r^rarerjrztype__code__rr*rr)r/rprrrrAr<r>rDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESrrrrrrrrrrrrrrrrr!r#rBrWrxrrrrr_NamespaceLoaderrr r:rrBrF)ss0r rRs,  ||w& SkOeO 4O 4444 1 '''/*)89A!A39'-#(:% E"E!F  7 * * *<? "2. .R0 ,-(( ) pq(+g5 NN<:  '6",T,,.H8II5C0C0L%@PG&  >BL8 0 9 D H C47@CL-d00f<<