a DOg>I@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZddlmZddlmZddl mZgdZGdd d eZGd d d e d d ZGdddejZGdddZGdddZGdddeZ GdddZ!GdddZ"Gddde Z#GdddeZ$ddZ%d d!Z&d"d#Z'd$d%Z(d&d'Z)d(d)Z*d*d+Z+dS),N) ConfigParser)suppress) import_module)MetaPathFinder)starmap) DistributionDistributionFinderPackageNotFoundError distribution distributions entry_pointsfilesmetadatarequiresversionc@s eZdZdS)r N)__name__ __module__ __qualname__rr7/opt/alt/python39/lib64/python3.9/importlib/metadata.pyr %sr c@sjeZdZedZddZeddZeddZ edd Z e d d Z e d d Z ddZddZdS) EntryPointzH(?P[\w.]+)\s*(:\s*(?P[\w.]+)\s*)?((?P\[.*\])\s*)?$cCsD|j|j}t|d}td|dp,dd}tt ||S)Nmoduleattr.) patternmatchvaluergroupfiltersplit functoolsreducegetattr)selfrrattrsrrrloadPszEntryPoint.loadcCs|j|j}|dS)Nrrrrrr$rrrrrZszEntryPoint.modulecCs|j|j}|dS)Nrr'r(rrrr_szEntryPoint.attrcCs$|j|j}td|dp dS)Nz\w+extrasr)rrrrefindallrr(rrrr)dszEntryPoint.extrascsfddDS)Ncs,g|]$}|D]\}}|||qqSritems).0rnamerclsconfigrr ksz+EntryPoint._from_config..)sectionsr0rr0r _from_configis zEntryPoint._from_configcCsLtdd}t|_z||Wn"ty@|t|Yn0t |S)N=)Z delimiters) rstrZ optionxformZ read_stringAttributeErrorZreadfpioStringIOrr5)r1textr2rrr _from_textqs  zEntryPoint._from_textcCst|j|fSN)iterr/r$rrr__iter__}szEntryPoint.__iter__cCs|j|j|j|jffSr=) __class__r/rrr?rrr __reduce__szEntryPoint.__reduce__N)rrrr*compilerr&propertyrrr) classmethodr5r<r@rBrrrrr)s       rZEntryPointBasezname value groupc@s&eZdZd ddZddZddZdS) PackagePathutf-8cCs<|j|d}|WdS1s.0YdS)Nencodinglocateopenread)r$rIstreamrrr read_textszPackagePath.read_textcCs:|d}|WdS1s,0YdS)NrbrJ)r$rNrrr read_binaryszPackagePath.read_binarycCs |j|Sr=)dist locate_filer?rrrrKszPackagePath.locateN)rG)rrrrOrQrKrrrrrFs rFc@seZdZddZddZdS)FileHashcCs|d\|_}|_dS)Nr6) partitionmoder)r$spec_rrr__init__szFileHash.__init__cCsd|j|jS)Nz)formatrVrr?rrr__repr__szFileHash.__repr__N)rrrrYr[rrrrrTsrTc@seZdZejddZejddZeddZeddZ e d d Z e d d Z ed)ddZ eddZeddZeddZeddZddZddZeddZddZd d!Zed"d#Ze d$d%Ze d&d'Zd(S)*rcCsdSr=rr$filenamerrrrOszDistribution.read_textcCsdSr=rr$pathrrrrSszDistribution.locate_filecCsH|D]2}|tj|d}tt|d}|dur|Sqt|dS)Nr/)_discover_resolversrContextnextr>r )r1r/resolverZdistsrRrrr from_names  zDistribution.from_namec sN|ddr|rtdp.tjfi|tjfdd|DS)Ncontextz cannot accept context and kwargsc3s|]}|VqdSr=r)r.rdrfrr sz(Distribution.discover..)pop ValueErrorrrb itertoolschain from_iterablera)r1kwargsrrgrdiscovers zDistribution.discovercCstt|Sr=)PathDistributionpathlibPath)r_rrratszDistribution.atcCsddtjD}td|S)Ncss|]}t|ddVqdS)find_distributionsN)r#)r.finderrrrrhsz3Distribution._discover_resolvers..)sys meta_pathr)Zdeclaredrrrrasz Distribution._discover_resolversrcCs@ddlm}m}||}tj|j||d}tt| |S)Nr)buildmeta)Z source_dirsystem) Zpep517rxryZ compat_systemr!partialrpzipfilerrZ build_as_zip)r1rootrxryrzZbuilderrrr_locals zDistribution._localcCs(|dp|dp|d}t|S)NZMETADATAzPKG-INFOr)rOemailZmessage_from_stringr$r;rrrrs  zDistribution.metadatacCs |jdS)NZVersion)rr?rrrrszDistribution.versioncCst|dS)Nzentry_points.txt)rr<rOr?rrrr szDistribution.entry_pointscs6p}dfdd }|o4tt|t|S)Ncs6t|}|rt|nd|_|r&t|nd|_|_|Sr=)rFrThashintsizerR)r/rZsize_strresultr?rr make_files z%Distribution.files..make_file)NN)_read_files_distinfo_read_files_egginfolistrcsvreader)r$Z file_linesrrr?rr s zDistribution.filescCs|d}|o|S)NZRECORD)rO splitlinesrrrrr&s z!Distribution._read_files_distinfocCs|d}|otdj|S)Nz SOURCES.txtz"{}")rOmaprZrrrrrr-s z Distribution._read_files_egginfocCs|p|}|ot|Sr=)_read_dist_info_reqs_read_egg_info_reqsr)r$Zreqsrrrr5szDistribution.requirescCs |jdS)Nz Requires-Dist)rZget_allr?rrrr;sz!Distribution._read_dist_info_reqscCs |d}|durdS||S)Nz requires.txt)rO_deps_from_requires_text)r$sourcerrrr>s z Distribution._read_egg_info_reqscCs4||}ddt|tdD}||S)NcSs&i|]\}}|tttd|qS)line)rroperator itemgetter)r.sectionZresultsrrr Esz9Distribution._deps_from_requires_text..r)_read_sectionsrrkgroupbyrr%_convert_egg_info_reqs_to_simple_reqs)r1rZ section_pairsr4rrrrBs z%Distribution._deps_from_requires_textccs<d}td|D](}td|}|r.|d}qtVqdS)Nz \[(.*)\]$)rr*rrlocals)linesrrZ section_matchrrrrLs  zDistribution._read_sectionsc#sVddfdd}dd}|D],\}}|D]}||}||||Vq0q$dS)NcSs|odj|dS)Nzextra == "{name}"r`)rZr`rrrmake_conditionaszJDistribution._convert_egg_info_reqs_to_simple_reqs..make_conditioncsX|pd}|d\}}}|r,|r,d|d}ttd||g}|rTdd|SdS)Nr:()z; z and )rUrrjoin)rZextrasepZmarkersZ conditionsrrr quoted_markerds  zIDistribution._convert_egg_info_reqs_to_simple_reqs..quoted_markercSs dd|vS)N @r)Zreqrrr url_req_spacelszIDistribution._convert_egg_info_reqs_to_simple_reqs..url_req_spacer,)r4rrrZdepsZdepZspacerrrrVs  z2Distribution._convert_egg_info_reqs_to_simple_reqsN)r)rrrabcabstractmethodrOrSrErero staticmethodrsrar~rDrrr r rrrrrrrrrrrrrsD              rc@s.eZdZGdddZejefddZdS)rc@s$eZdZdZddZeddZdS)zDistributionFinder.ContextNcKst||dSr=)varsupdate)r$rnrrrrYsz#DistributionFinder.Context.__init__cCst|dtjS)Nr_)rgetrvr_r?rrrr_szDistributionFinder.Context.path)rrrr/rYrDr_rrrrrbs rbcCsdSr=r)r$rfrrrrtsz%DistributionFinder.find_distributionsN)rrrrbrrrtrrrrrzsrc@s<eZdZddZddZddZddZd d Zd d Zd S)FastPathcCs||_tj|j|_dSr=)r}osr_basenamelowerbase)r$r}rrrrYszFastPath.__init__cCst|j|Sr=)rqrrr})r$childrrrjoinpathszFastPath.joinpathcCsltt t|jpdWdS1s.0Ytt|WdS1s^0YgS)Nr)r Exceptionrlistdirr} zip_childrenr?rrrchildrens  . &zFastPath.childrencCs2t|j}|j}|j|_tdd|DS)Ncss |]}|tjddVqdS)rrN)r posixpathr)r.rrrrrhsz(FastPath.zip_children..)r|rrr}Znamelistrdictfromkeys)r$Zzip_pathnamesrrrrs    zFastPath.zip_childrencCs&|j}||jkp$||jo$|dS)N.egg)rversionless_egg_name startswithprefixendswith)r$searchrrrris_eggs   zFastPath.is_eggccsZ|D]L}|}||jvsH||jr6||jsH||r|dkr||VqdS)Nzegg-info) rr exact_matchesrrrsuffixesrr)r$r/rZn_lowrrrrs    zFastPath.searchN) rrrrYrrrrrrrrrrs  rc@s2eZdZdZdZdZdgddZdZddZdS)Preparedr)z .dist-infoz .egg-infoNrcsV|_|durdS|dd_jd_fddjD_jd_dS)N-rXcsg|]}j|qSr) normalized)r.suffixr?rrr3sz%Prepared.__init__..r)r/rreplacerrrrr)r$r/rr?rrYs  zPrepared.__init__) rrrrrrrrrYrrrrrs rc@s,eZdZeefddZeddZdS)MetadataPathFindercCs||j|j}tt|Sr=) _search_pathsr/r_rrp)r1rffoundrrrrts z%MetadataPathFinder.find_distributionscs tjfddtt|DS)Nc3s|]}|tVqdSr=)rr)r.r_r`rrrhsz3MetadataPathFinder._search_paths..)rkrlrmrr)r1r/pathsrr`rrsz MetadataPathFinder._search_pathsN)rrrrErrbrtrrrrrrs rc@s.eZdZddZddZejje_ddZdS)rpcCs ||_dSr=)_pathr^rrrrYszPathDistribution.__init__cCsHtttttt$|j|jddWdS1s:0YdS)NrGrH) rFileNotFoundErrorIsADirectoryErrorKeyErrorNotADirectoryErrorPermissionErrorrrrOr\rrrrOszPathDistribution.read_textcCs |jj|Sr=)rparentr^rrrrSszPathDistribution.locate_fileN)rrrrYrOr__doc__rSrrrrrps rpcCs t|Sr=)rreZdistribution_namerrrr sr cKstjfi|Sr=)rro)rnrrrr !sr cCs t|jSr=)rrerrrrrr)srcCs t|jSr=)r rrrrrr2srcCsHtjddtD}td}t||d}t||}dd|DS)Ncss|] }|jVqdSr=)r )r.rRrrrrhAszentry_points..r)keycSsi|]\}}|t|qSr)tuple)r.repsrrrrFsz entry_points..)rkrlrmr r attrgettersortedr)rZby_groupZorderedZgroupedrrrr <s    r cCs t|jSr=)r r rrrrr Lsr cCs t|jSr=)r rrrrrrUsr),r9rr*rrrvrrqr|rr!rkr collectionsZ configparserr contextlibr importlibr importlib.abcrr__all__ModuleNotFoundErrorr namedtuplerZ PurePosixPathrFrTrrrrrrpr r rrr r rrrrrsN       aY/0