bg@XUddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZmZddlmZddlmZmZddlmZddlmZdd lmZe jd kr dd lmZmZndd lmZmZGd d eZGddejZ e j!e j"e j!dZ#de$d<ddhZ%de$d<GddeZ&GddZ'Gdde'Z(Gdde(Z)Gdd e'Z*Gd!d"e'Z+e(e*e+e)fZ,d:d'Z-d;d)Z.dd?d9Z1dS)@) annotationsN)IteratorSequence)Path)Any NamedTuple) PY310_PLUS) EXT_LIB_DIRS)util))LiteralProtocolceZdZ d d d Zd S)_MetaPathFinder.fullnamestrpathSequence[str] | Nonetargettypes.ModuleType | Nonereturn%importlib.machinery.ModuleSpec | NonecdSN)selfrrrs q/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/astroid/interpreter/_import/spec.py find_specz_MetaPathFinder.find_spec$s N).)rrrrrrrr)__name__ __module__ __qualname__r rr!rrr#s2 +.        r!rc>eZdZdZejZejZejZejZ ejZ ejZ ejZ ejZ ejZejZdS) ModuleTypez(Python module types used for ModuleSpec.N)r"r#r$__doc__enumauto C_BUILTIN C_EXTENSION PKG_DIRECTORYPY_CODERESOURCE PY_COMPILED PY_FROZEN PY_RESOURCE PY_SOURCE PY_ZIPMODULE PY_NAMESPACErr!rr&r&-s22 I$)++KDIKKMdikkO$)++K I$)++K I49;;L49;;LLLr!r&)_EditableFinder_EditableNamespaceFinder_SixMetaPathImporterzdict[str, ModuleType]_MetaPathFinderModuleTypesr4r5zset[str]_EditableFinderClassescReZdZUdZded<ded<dZded<dZded <dZd ed <dS) ModuleSpeczDefines a class similar to PEP 420's ModuleSpec. A module spec defines a name of a module, its type, location and where submodules can be found, if the module is a package. rnamezModuleType | NonetypeNz str | Nonelocationoriginrsubmodule_search_locations)r"r#r$r'__annotations__r=r>r?rr!rr:r:Jsg IIIHF7;;;;;;;r!r:cFeZdZdZdddZejddZddZdS)Finderz@A finder is a class which knows how to find a particular module.NrrrNonec,|p tj|_dSr)sysr_path)rrs r__init__zFinder.__init__[s%SX r!modnamer module_parts Sequence[str] processed list[str]submodule_pathModuleSpec | NonecdS)aFind the given module. Each finder is responsible for each protocol of finding, as long as they all return a ModuleSpec. :param modname: The module which needs to be searched. :param module_parts: It should be a list of strings, where each part contributes to the module's namespace. :param processed: What parts from the module parts were processed so far. :param submodule_path: A list of paths where the module can be looked into. :returns: A ModuleSpec, describing how and where the module was found, None, otherwise. NrrrHrIrKrMs r find_modulezFinder.find_module^r!specr:cdS)z7Get a list of extra paths where this finder can search.NrrrSrKs rcontribute_to_pathzFinder.contribute_to_pathwrRr!r)rrrrC rHrrIrJrKrLrMrrrNrSr:rKrLrr) r"r#r$r'rGabcabstractmethodrQrVrr!rrBrBXsqJJ&&&&&     0FFFFFFr!rBceZdZUdZdejjDdejjDzdejjDzZ de d<ddZ ddZ dS)ImportlibFinderz'A finder based on the importlib module.c*g|]}|tjfSr)r&r+.0ss r zImportlibFinder.s UUU!Z # $UUUr!c*g|]}|tjfSr)r&r1r^s rrazImportlibFinder.s R R RAz# $ R R Rr!c*g|]}|tjfSr)r&r.r^s rrazImportlibFinder.s V V V1Az% & V V Vr!z Sequence[tuple[str, ModuleType]] _SUFFIXESrHrrIrJrKrLrMrrrNc>|t|}n|tjvrt|dtjS t j5t jdttj |}dddn #1swxYwY|rH|j tjjur0t|t!|jddtjSn#t&$rYnwxYwtj}|D]}t*j||}dtjjdfD]f}d|z} t*j|| } t*j| r t||tjccSgt4jD]_\}} ||z} t*j|| } t*j| rt|| | ccS`dS)N)r;r=r<ignore)categoryfilenamez.pyrrG)listrEbuiltin_module_namesr:r&r*warningscatch_warningsfilterwarnings UserWarning importlibr r loader machineryFrozenImportergetattr loader_stater/ ValueErrorrosjoinBYTECODE_SUFFIXESisfiler,r\rd) rrHrIrKrMrSentrypackage_directorysuffixpackage_file_name file_pathtype_ file_names rrQzImportlibFinder.find_modules  %!.11NN 0 0 0)   ,..==+H{KKKK$>33G<>),,%$!2'5 "1!: T T #f, GLL :: 7>>),,T%7YUSSSSSSSST T ts6C.;B C.BC.B A C.. C;:C;rSr:cjdSttjrfdtjD}njdkr{t fdtDs[tj d}|r1|j r*t|j }t|j g}njg}njg}|S)Ncg|]M}tjtjj|gR6tjj|gRNSr)rvrisdirrw)r_prKs rraz6ImportlibFinder.contribute_to_path..se7==a!<)!z5ImportlibFinder.contribute_to_path..s_2 2  M   ! ! , ,[->->-@-@ A A2 2 2 2 2 2 r!)r=_is_setuptools_namespacerrErr;anyr ror r r>rparent)rrSrKrdistutils_spec origin_paths `` rrVz"ImportlibFinder.contribute_to_paths  = 4 #D$7$7 8 8 #DD Y+ % %c2 2 2 2 +2 2 2 / / %'^55kBBN '."7 '"") K.//0 M?D r!NrWrX) r"r#r$r'rorqEXTENSION_SUFFIXESSOURCE_SUFFIXESrxrdr@rQrVrr!rr\r\}s11 VUi.A.TUUU R Ri.A.Q R R R S V V 0C0U V V V W 3333j######r!r\c"eZdZdZdd ZddZdS)ExplicitNamespacePackageFinderz-A finder for the explicit namespace packages.rHrrIrJrKrLrMrrrNc|rd||gz}tj|rC|tjvr5tj|j}t |ddtj|SdS)N. namespacer;r=r>r<r?) rwr is_namespacerEmodules__path__r:r&r3rPs rrQz*ExplicitNamespacePackageFinder.find_modules  6hhyG9455G  W % % 'S[*@*@ [1:N",+9  tr!rSr:c|jSrr?rUs rrVz1ExplicitNamespacePackageFinder.contribute_to_paths ..r!NrWrXr"r#r$r'rQrVrr!rrrsB77(//////r!rc,eZdZdZdfd ZddZxZS) ZipFinderz8Finder that knows how to find a module inside zip files.rrJrrCct||D]H}|tjvr8 t j|tj|<3#tj$rYDwxYwIdSr)superrGrEpath_importer_cache zipimport zipimporterZipImportError)rr entry_path __class__s rrGzZipFinder.__init__s   J!888:C:O";;C+J77!/H 9  s!AA*)A*rHrrIrKrLrMrrNcv t|\}}}n#t$rYdSwxYwt||d||S)Neggr) _search_zip ImportErrorr:)rrHrIrKrM file_typerhrs rrQzZipFinder.find_module sg (3L(A(A %Ix   44 '+     s  $$)rrJrrCrW)r"r#r$r'rGrQ __classcell__)rs@rrrsWBB              r!rc"eZdZdZdd ZddZdS)PathSpecFinderz/Finder based on importlib.machinery.PathFinder.rHrrIrJrKrLrMrrrNc tjj||}|V|jdu}|s|jnd}|r t jnd}t|j||j|t|j pgS|S)N)rr) rorq PathFinderr r>r&r3r:r;rir?) rrHrIrKrMrSis_namespace_pkgr= module_types rrQzPathSpecFinder.find_module$s"-77n7UU  #{d2 *:Dt{{H5EO*114KY!{ +/0O0USU+V+V   r!rSr:c>|jtjkr|jSdSr)r<r&r3r?rUs rrVz!PathSpecFinder.contribute_to_path9s" 9 / / /2 2tr!NrWrXrrr!rrr!sB99*r!rr= pathlib.Pathrboolc t|dz d5}|d}dddn #1swxYwYn#t$rYdSwxYwd|vod|v}d|vod|v}|p|S) Nz __init__.pyrbiFspkgutils extend_paths pkg_resourcessdeclare_namespace(__name__))openreadOSError)r=streamdata extend_pathdeclare_namespaces rrrIs (]*D 1 1 %V;;t$$D % % % % % % % % % % % % % % % uu$?4)?KD K%Ct%K  +++s,A7 A;A;A AA+Iterator[tuple[str, zipimport.zipimporter]]c#KtjD]%\}}t|tjr||fV&dSr)rEritems isinstancerr)filepathimporters r_get_zipimportersrVsZ!5;;==%%( h 5 6 6 %H$ $ $ $%%r!modpathrJ1tuple[Literal[ModuleType.PY_ZIPMODULE], str, str]c |tD]\}}tr||d}n||d}|rAtrk|tjj|s3tdd|ddd|d|nj|tjj|s3tdd|ddd|d|tj tj |tjjztjj|z|fcStdd|)NrNo module named rr z in /) rr r rQrvrseprwrr&r2abspath)rrrfounds rrr\s011(  5!++GAJ77EE((44E   ))"'+*:*:7*C*CDD%+88GABBK0000(((GGE ))"'+*:*:7*C*CDD !kxx ,,,,hhhA '))BGK7"'+:J:J7:S:SS    " <'):):<< = ==r! search_pathrHrrIrLrKrMr+tuple[Finder | _MetaPathFinder, ModuleSpec]c tD]-}||}|||||}|(||fcStjD]}|jj} | t vr# |j} n#t$rY,wxYw| t vr:t | } t|dsX| ||}|r+|t|j | |j |j |j fcStdd|)Nr rr) _SPEC_FINDERSrQrE meta_pathrr"r7AttributeErrorhasattrr r:r;r>r?rrw) rrHrIrKrMfinderfinder_instancerS meta_findermeta_finder_namers r_find_spec_with_pathrxsk %% &--** \9n   < $$$$}"" &09 #= = = #.#7  !    'AAA01AB {K00  $$Wn==  IKK3       A,)?)?AA B BBsA"" A/.A/rc|p tj}|dd}d}|dd}g}|r|d}t|||||p|\}}|||rAt |t r|||}n|jtvr|j }|j tj kr||}||S)aFind a spec for the given module. :type modpath: list or tuple :param modpath: split module's name (i.e name of a module or package split on '.'), with leading empty strings for explicit relative import :type path: list or None :param path: optional list of path where the module or package should be searched (use sys.path if nothing or None is given) :rtype: ModuleSpec :return: A module spec, which describes how the module was found and where. Nrr)rErpoprappendrrBrVr"r8r?r<r&r,_replace) rrrFrMrIrKrHrrSs rr r s"  CHEaaajGN111:LI L++a..+ 7L)^5Kt   !!!  A&&)) A!'!:!:4!K!K$:::!%!@ 9 0 0 0==N=KKD L" Kr!)r=rrr)rr)rrJrr) rrJrHrrIrLrKrLrMrrrr)rrLrrrr:)2 __future__rrYr(roimportlib.machineryimportlib.utilrvpathlibrEtypesrkrcollections.abcrrrtypingrr astroid.constr astroid.modutilsr rr version_inforrtyping_extensionsrEnumr&r1r3r7r@r8r:rBr\rrrrrrrrr rr!rrs #""""""   ........""""""""$$$$$$))))))v(((((((((33333333      h           ""+ * 7&0 55$ < < < < < < < <"F"F"F"F"F"F"F"FJaaaaafaaaH/////_///:          FVB "   , , , ,%%%% >>>>85C5C5C5Cp+++++++r!