o ?Ogw@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlmZmZddlmZddlmZmZddlmZmZddlmZddlmZmZdd lmZdd lmZdd l m!Z!dd l m"Z"dd l#m$Z$m%Z%m&Z&m'Z'gdZ(Gddde)Z*GdddZ+Gddde,ddZ-Gddde.Z/Gddde/Z0GdddZ1Gddde1e2Z3Gdd d ej4Z5Gd!d"d"Z6Gd#d$d$Z7Gd%d&d&e!Z8Gd'd(d(Z9Gd)d*d*Z:Gd+d,d,Z;Gd-d.d.e8Zd3d4Z?d5ejfd6d7Z@d8d9ZAd5e'e0e3ffd:d;ZBdd?ZDd5e%eEe$eEffd@dAZFdS)BN) _adapters_meta)PackageMetadata)FreezableDefaultDictPair) method_cache pass_none)unique_everseen)r SimplePath)suppress) import_module)MetaPathFinder)starmap)ListMappingOptionalUnion) DistributionDistributionFinderrPackageNotFoundError distribution distributions entry_pointsfilesmetadatapackages_distributionsrequiresversionc@s"eZdZ ddZeddZdS)rcCs d|jS)Nz"No package metadata was found for nameselfr#B/opt/alt/python310/lib64/python3.10/importlib/metadata/__init__.py__str__2 zPackageNotFoundError.__str__cCs |j\}|SN)argsr"r r#r#r$r 5szPackageNotFoundError.nameN)__name__ __module__ __qualname__r%propertyr r#r#r#r$r/s rc@sBeZdZ edZeddZe d ddZ e ddZ dS) Sectionedzm [sec1] # comments ignored a = 1 b = 2 [sec2] a = 2 cCsdd|j||jdDS)Ncss.|]}|jdur|jt|jdVqdS)N)value)r _replacerparser/).0sectionr#r#r$ fs z*Sectioned.section_pairs..)filter_)readvalidclstextr#r#r$ section_pairsdszSectioned.section_pairsNccsZt|ttj|}d}|D]}|do|d}|r$|d}qt||VqdS)N[]z[])filtermapstrstrip splitlines startswithendswithr)r:r5linesr r/Z section_matchr#r#r$r6ls zSectioned.readcCs|o|d S)N#)rC)liner#r#r$r7wzSectioned.validr') r*r+r,textwrapdedentlstripZ_sample classmethodr; staticmethodr6r7r#r#r#r$r.;s    r.c@sxeZdZU edZ dZeded<ddZ e ddZ e d d Z e d d Z d dZddZddZddZdS) EntryPointzH(?P[\w.]+)\s*(:\s*(?P[\w.]+)\s*)?((?P\[.*\])\s*)?$NrdistcCsF |j|j}t|d}td|dpdd}tt ||S)Nmoduleattr.) patternmatchr/r groupr>split functoolsreducegetattr)r"rUrPattrsr#r#r$loads zEntryPoint.loadcC|j|j}|dS)NrPrTrUr/rVr"rUr#r#r$rP zEntryPoint.modulecCr])NrQr^r_r#r#r$rQr`zEntryPoint.attrcCs$|j|j}td|dpdS)Nz\w+extrasrR)rTrUr/refindallrVr_r#r#r$raszEntryPoint.extrascCs ||_|Sr'rO)r"rOr#r#r$_forszEntryPoint._forcCs d}t|tt|j|fS)NzJConstruction of dict of EntryPoints is deprecated in favor of EntryPoints.)warningswarnDeprecationWarningiterr )r"msgr#r#r$__iter__s  zEntryPoint.__iter__cCs|j|j|j|jffSr') __class__r r/rVr!r#r#r$ __reduce__szEntryPoint.__reduce__c s* fdd|D}tttj||S)Nc3s|]}t|VqdSr'rZ)r2Zparamr!r#r$r4z%EntryPoint.matches..)allr?operatoreqvalues)r"paramsr[r#r!r$matchesszEntryPoint.matches)r*r+r,rbcompilerTrOr__annotations__r\r-rPrQrarerkrmrur#r#r#r$rN|s$     rNZEntryPointBasezname value groupcseZdZ dZejejdeddZ fddZ fddZ fd d Z fd d Z fd dZfddZfddZfddZddZfddZfddZddZZS)DeprecatedListr#zAEntryPoints list interface is deprecated. Cast to list if needed. stacklevelc|tj|i|Sr')_warnsuper __setitem__r"r(kwargsrlr#r$rzDeprecatedList.__setitem__cr|r')r}r~ __delitem__rrr#r$rrzDeprecatedList.__delitem__cr|r')r}r~appendrrr#r$rrzDeprecatedList.appendcr|r')r}r~reverserrr#r$r rzDeprecatedList.reversecr|r')r}r~extendrrr#r$r$rzDeprecatedList.extendcr|r')r}r~poprrr#r$r(rzDeprecatedList.popcr|r')r}r~removerrr#r$r,rzDeprecatedList.removecr|r')r}r~__iadd__rrr#r$r0rzDeprecatedList.__iadd__cCs,t|ts |t|}|t||Sr') isinstancetupler}rlr"otherr#r#r$__add__4s zDeprecatedList.__add__cr|r')r}r~insertrrr#r$r:rzDeprecatedList.insertcr|r')r}r~sortrrr#r$r>rzDeprecatedList.sortcCs(t|ts |t|}t||Sr')rrr}__eq__rr#r#r$rBs zDeprecatedList.__eq__)r*r+r, __slots__rXpartialrfrgrhr}rrrrrrrrrrrr __classcell__r#r#rr$rxs*          rxcsfeZdZ dZfddZddZeddZedd Ze d d Z e d d Z e ddZ ZS) EntryPointsr#csV t|trtjdtddt|Sz tt|j |dWSt y*t |w)NzGAccessing entry points by index is deprecated. Cast to tuple if needed.ryrzr) rintrfrgrhr~ __getitem__nextriselect StopIterationKeyErrorr)rr#r$rQs   zEntryPoints.__getitem__c s tfdd|DS)Nc3s$|] }|jdir|VqdSNr#)rur2Zeprtr#r$r4gs"z%EntryPoints.select..rr"rtr#rr$rbszEntryPoints.selectcC tdd|DS)Ncs|]}|jVqdSr'rrr#r#r$r4nz$EntryPoints.names..setr!r#r#r$namesiszEntryPoints.namescCr)Ncsrr')rVrr#r#r$r4yrz%EntryPoints.groups..rr!r#r#r$groupspzEntryPoints.groupscs|fdd||DS)Nc3|]}|VqdSr')rerrdr#r$r4}roz-EntryPoints._from_text_for..) _from_text)r9r:rOr#rdr$_from_text_for{szEntryPoints._from_text_forcCstt||pdS)NrR) itertoolsrrN _parse_groupsr8r#r#r$rszEntryPoints._from_textcCsddt|DS)Ncss$|] }|jj|jj|jfVqdSr'r/r )r2itemr#r#r$r4s  z,EntryPoints._parse_groups..)r.r;)r:r#r#r$rszEntryPoints._parse_groups)r*r+r,rrrr-rrrLrrrMrrr#r#rr$rJs     rcspeZdZ ejejdeddZfddZ dfdd Z fd d Z fd d Z fd dZ fddZZS) Deprecatedz:SelectableGroups dict interface is deprecated. Use select.ryrzcs|t|Sr')r}r~rr)rr#r$r zDeprecated.__getitem__Ncs|t||Sr')r}r~get)r"r defaultrr#r$rszDeprecated.getc|tSr')r}r~rkr!rr#r$rk zDeprecated.__iter__cs|tj|Sr')r}r~ __contains__)r"r(rr#r$rrzDeprecated.__contains__crr')r}r~keysr!rr#r$rrzDeprecated.keyscrr')r}r~rsr!rr#r$rsrzDeprecated.valuesr')r*r+r,rXrrfrgrhr}rrrkrrrsrr#r#rr$rs    rcsNeZdZ eddZefddZeddZeddZd d Z Z S) SelectableGroupscCs4td}t||d}t||}|dd|DS)NrVkeycss |] \}}|t|fVqdSr'r)r2rVepsr#r#r$r4sz(SelectableGroups.load..)rq attrgettersortedrgroupby)r9rZby_groupZorderedZgroupedr#r#r$r\s   zSelectableGroups.loadcs tt|}ttj|Sr')r~rrsrrchain from_iterable)r"rrr#r$_allszSelectableGroups._allcCs|jjSr')rrr!r#r#r$rzSelectableGroups.groupscCs |jjSr')rrr!r#r#r$rszSelectableGroups.namescKs|s|S|jjdi|Sr)rrrr#r#r$rszSelectableGroups.select) r*r+r,rLr\r-rrrrrr#r#rr$rs   rc@s(eZdZ d ddZddZddZdS) PackagePathutf-8cCs<|j|d }|WdS1swYdS)Nencodinglocateopenr6)r"rstreamr#r#r$ read_texts$zPackagePath.read_textcCs:|d }|WdS1swYdS)Nrbr)r"rr#r#r$ read_binarys$zPackagePath.read_binarycCs |j|Sr')rO locate_filer!r#r#r$rs zPackagePath.locateN)r)r*r+r,rrrr#r#r#r$rs   rc@seZdZddZddZdS)FileHashcCs|d\|_}|_dS)N=) partitionmoder/)r"spec_r#r#r$__init__szFileHash.__init__cCsd|jd|jdS)Nz)rr/r!r#r#r$__repr__szFileHash.__repr__N)r*r+r,rrr#r#r#r$rs rc@seZdZ ejddZejddZeddZeddZ e d d Z e d d Z ed,ddZ edejfddZeddZeddZeddZeddZeddZddZdd Zed!d"Zd#d$Zd%d&Zed'd(Ze d)d*Zd+S)-rcCdSr'r#r"filenamer#r#r$rzDistribution.read_textcCrr'r#r"pathr#r#r$r rzDistribution.locate_filecCsF |D]}|tj|d}tt|d}|dur|Sqt|)Nr)_discover_resolversrContextrrir)r9r resolverZdistsrOr#r#r$ from_names zDistribution.from_namec sP |ddr|rtdptjdi|tjfdd|DS)Ncontextz cannot accept context and kwargsc3s|]}|VqdSr'r#)r2rrr#r$r44s z(Distribution.discover..r#)r ValueErrorrrrrrr)r9rr#rr$discover&s zDistribution.discovercCs tt|Sr')PathDistributionpathlibPath)rr#r#r$at8szDistribution.atcCs ddtjD}td|S)Ncss|] }t|ddVqdS)find_distributionsNrn)r2finderr#r#r$r4Ds  z3Distribution._discover_resolvers..)sys meta_pathr>)Zdeclaredr#r#r$rAs  z Distribution._discover_resolversrScCs@ddlm}m}||}tj|j||d}tt| |S)Nr)buildmeta)Z source_dirsystem) Zpep517rrZ compat_systemrXrrzipfilerZ build_as_zip)r9rootrrrZbuilderr#r#r$_localIs zDistribution._localreturncCs0 |dp|dp|d}tt|S)NZMETADATAzPKG-INFOrR)rrZMessageemailZmessage_from_stringr"r:r#r#r$rUs zDistribution.metadatacC |jdS)NNamerr!r#r#r$r f zDistribution.namecCs t|jSr')Prepared normalizer r!r#r#r$_normalized_nameks zDistribution._normalized_namecCr)NZVersionrr!r#r#r$rprzDistribution.versioncCst|d|S)Nzentry_points.txt)rrrr!r#r#r$ruszDistribution.entry_pointscs8 p}dfdd }|ott|t|S)Ncs6t|}|r t|nd|_|rt|nd|_|_|Sr')rrhashrsizerO)r rZsize_strresultr!r#r$ make_files z%Distribution.files..make_file)NN)_read_files_distinfo_read_files_egginfolistrcsvreader)r"Z file_linesrr#r!r$rys zDistribution.filescCs |d}|o |S)NZRECORD)rrBrr#r#r$rs  z!Distribution._read_files_distinfocCs |d}|otdj|S)Nz SOURCES.txtz"{}")rr?formatrBrr#r#r$rs z Distribution._read_files_egginfocCs |p|}|ot|Sr')_read_dist_info_reqs_read_egg_info_reqsr)r"Zreqsr#r#r$rs zDistribution.requirescCs |jdS)Nz Requires-Dist)rZget_allr!r#r#r$r r&z!Distribution._read_dist_info_reqscCs |d}|dur dS||S)Nz requires.txt)r_deps_from_requires_text)r"sourcer#r#r$r s z Distribution._read_egg_info_reqscCs|t|Sr')%_convert_egg_info_reqs_to_simple_reqsr.r6)r9r r#r#r$r rHz%Distribution._deps_from_requires_textc#sN ddfdd}dd}|D]}||j}|j|||jVqdS)NcSs|od|dS)Nz extra == ""r#rr#r#r$make_conditionszJDistribution._convert_egg_info_reqs_to_simple_reqs..make_conditioncsX|pd}|d\}}}|r|rd|d}ttd||g}|r*dd|SdS)NrR:()z; z and )rrr>join)r3ZextrasepZmarkersZ conditionsrr#r$ quoted_markers  zIDistribution._convert_egg_info_reqs_to_simple_reqs..quoted_markercSs dd|vS)N @r#)Zreqr#r#r$ url_req_space zIDistribution._convert_egg_info_reqs_to_simple_reqs..url_req_spacer)Zsectionsrrr3Zspacer#rr$r s  z2Distribution._convert_egg_info_reqs_to_simple_reqsN)rS)r*r+r,abcabstractmethodrrrLrrrMrrrr-rrrr rrrrrrrr r r r r#r#r#r$rsL               rc@s0eZdZ GdddZejefddZdS)rc@s(eZdZ dZ ddZeddZdS)zDistributionFinder.ContextNcKst||dSr')varsupdate)r"rr#r#r$rz#DistributionFinder.Context.__init__cCs t|dtjS)Nr)rrrrr!r#r#r$rrzDistributionFinder.Context.path)r*r+r,r rr-rr#r#r#r$rs rcCrr'r#)r"rr#r#r$rrz%DistributionFinder.find_distributionsN)r*r+r,rrrrr#r#r#r$rs  rcsfeZdZ efddZddZddZddZd d Z d d Z e d dZ e ddZZS)FastPathcs t|Sr')r~__new__)r9rrr#r$r! s zFastPath.__new__cCs ||_dSr')r)r"rr#r#r$r  zFastPath.__init__cCst|j|Sr')rrr)r"childr#r#r$joinpathzFastPath.joinpathcCslttt|jp dWdS1swYtt |WdS1s/wYgS)NrS)r Exceptionoslistdirr zip_childrenr!r#r#r$childrens   zFastPath.childrencCs2t|j}|j}|j|_tdd|DS)Ncss"|] }|tjddVqdS)rrN)rW posixpathr)r2r#r#r#r$r4s z(FastPath.zip_children..)rrrZnamelistr$dictfromkeys)r"Zzip_pathrr#r#r$r)s  zFastPath.zip_childrencCs||j|Sr')lookupmtimesearchr)r#r#r$r0!rzFastPath.searchcCsDttt|jjWdS1swY|jdSr')r OSErrorr'statrst_mtimer. cache_clearr!r#r#r$r/$s   zFastPath.mtimecCst|Sr')Lookup)r"r/r#r#r$r.*rzFastPath.lookup)r*r+r,rX lru_cacher!rr$r*r)r0r-r/rr.rr#r#rr$r s r c@s"eZdZdefddZddZdS)r5rc Cstj|j}|d}tt|_tt|_ | D]J}|}|drD| dd dd}t |}|j|||q|rf|dkrf| dd dd}t |}|j |||q|j|j dS)Nz.eggz .dist-infoz .egg-inforSr-zegg-info)r'rbasenamerlowerrDrrinfoseggsr* rpartitionrrrrr$legacy_normalizeZfreeze) r"rbaseZ base_is_eggr#Zlowr normalizedlegacy_normalizedr#r#r$r0s"         zLookup.__init__cCsP|r|j|jntj|j}|r|j|jntj|j}t||Sr')r;r@rrrrsr<rA)r"preparedr;r<r#r#r$r0Es z Lookup.searchN)r*r+r,r rr0r#r#r#r$r5/s r5c@s>eZdZ dZdZddZeddZeddZdd Z dS) rNcCs.||_|dur dS|||_|||_dSr')r rr@r>rAr)r#r#r$r[s  zPrepared.__init__cCs tdd|ddS)Nz[-_.]+r8r)rbsubr:replacerr#r#r$rbszPrepared.normalizecCs |ddS)Nr8r)r:rDrr#r#r$r>iszPrepared.legacy_normalizecCs t|jSr')boolr r!r#r#r$__bool__qr"zPrepared.__bool__) r*r+r,r@rArrMrr>rFr#r#r#r$rSs   rc@s4eZdZeefddZeddZddZdS)MetadataPathFindercCs ||j|j}tt|Sr') _search_pathsr rr?r)r9rfoundr#r#r$rvs z%MetadataPathFinder.find_distributionscs* t|tjfddtt|DS)Nc3rr')r0)r2rrBr#r$r4s  z3MetadataPathFinder._search_paths..)rrrrr?r )r9r pathsr#rJr$rHs z MetadataPathFinder._search_pathscCstjdSr')r r!r4)r9r#r#r$invalidate_cachesr%z$MetadataPathFinder.invalidate_cachesN) r*r+r,rLrrrrHrLr#r#r#r$rGus   rGcsTeZdZdefddZddZejje_ddZe fdd Z e d d Z Z S) rrcCs ||_dSr')_pathrr#r#r$rs zPathDistribution.__init__cCsHtttttt|j|jddWdS1swYdS)Nrr) r FileNotFoundErrorIsADirectoryErrorrNotADirectoryErrorPermissionErrorrMr$rrr#r#r$rs$zPathDistribution.read_textcCs |jj|Sr')rMparentrr#r#r$rr&zPathDistribution.locate_filecs0 tjt|j}ttj||pt j Sr') r'rr9r@rMr rr_name_from_stemr~r)r"stemrr#r$rs z!PathDistribution._normalized_namecCs2 tj|\}}|dvrdS|d\}}}|S)Nr7r8)r'rsplitextr)rTrZextr rrestr#r#r$rSs z PathDistribution._name_from_stem)r*r+r,r rrr__doc__rr-rrMrSrr#r#rr$rs  rcCs t|Sr')rrZdistribution_namer#r#r$r rcKs tjdi|Sr)rr)rr#r#r$rsrrcCs t|jSr')rrrrXr#r#r$rrrcC t|jSr')rrrXr#r#r$r rcKsL td}tjt|d}tjdd|tD}t |j di|S)Nrrcsrr')r)r2rOr#r#r$r4s zentry_points..r#) rqrrXrr rrrrrr\r)rtZ norm_nameuniquerr#r#r$rs  rcCrZr')rrrXr#r#r$rrYrcCrZr')rrrXr#r#r$r r[rcCsL tt}tD]}|dpdD] }|||jdqq t|S)Nz top_level.txtrRr) collections defaultdictrrrrWrrr,)Z pkg_to_distrOZpkgr#r#r$rs r)Gr'rbrrrrrrrqrIrfrXrr+r]rRrrr _collectionsrr _functoolsrr _itertoolsr r contextlibr importlibr Z importlib.abcrrtypingrrrr__all__ModuleNotFoundErrorrr. namedtuplerNrrxrrr,rZ PurePosixPathrrrrr r5rrGrrrrrrrrr@rr#r#r#r$sl       A o_A7(R0,$"4