U ,aD @sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZddlmZddlmZddl mZddd d d d d dddg ZGdd d eZGddde ddZGdddejZGdddZGdddZGdddeZ GdddZ!GdddZ"Gd d!d!e Z#Gd"d#d#eZ$d$d Z%d%d Z&d&dZ'd'dZ(d(d Z)d)d Z*d*dZ+dS)+N) ConfigParser)suppress) import_module)MetaPathFinder)starmap DistributionDistributionFinderPackageNotFoundError distribution distributions entry_pointsfilesmetadatarequiresversionc@s eZdZdS)r N)__name__ __module__ __qualname__rr7/opt/alt/python38/lib64/python3.8/importlib/metadata.pyr %sc@sReZdZedZddZeddZe ddZ e dd Z d d Z d d Z dS) EntryPointzF(?P[\w.]+)\s*(:\s*(?P[\w.]+))?\s*(?P\[.*\])?\s*$cCsD|j|j}t|d}td|dp,dd}tt ||S)Nmoduleattr.) patternmatchvaluergroupfiltersplit functoolsreducegetattr)selfrrattrsrrrloadGszEntryPoint.loadcCs(|j|j}ttd|dp"dS)Nz\w+extrasr)rrrlistrefinditerr)r$rrrrr'QszEntryPoint.extrascsfddDS)Ncs,g|]$}|D]\}}|||qqSritems).0rnamerclsconfigrr Xs z+EntryPoint._from_config..)sectionsr/rr/r _from_configVs zEntryPoint._from_configcCsNtdd}t|_z||Wn$tk rB|t|YnXt |S)N=)Z delimiters) rstrZ optionxformZ read_stringAttributeErrorZreadfpioStringIOrr4)r0textr1rrr _from_text^s zEntryPoint._from_textcCst|j|fSN)iterr.r$rrr__iter__jszEntryPoint.__iter__cCs|j|j|j|jffSr<) __class__r.rrr>rrr __reduce__pszEntryPoint.__reduce__N)rrrr)compilerr&propertyr' classmethodr4r;r?rArrrrr)s     rZEntryPointBasezname value groupc@s&eZdZd ddZddZddZdS) PackagePathutf-8c Cs0|j|d}|W5QRSQRXdS)Nencodinglocateopenread)r$rHstreamrrr read_textzszPackagePath.read_textc Cs.|d}|W5QRSQRXdS)NrbrI)r$rMrrr read_binary~szPackagePath.read_binarycCs |j|Sr<)dist locate_filer>rrrrJszPackagePath.locateN)rF)rrrrNrPrJrrrrrEws rEc@seZdZddZddZdS)FileHashcCs|d\|_}|_dS)Nr5) partitionmoder)r$spec_rrr__init__szFileHash.__init__cCsd|j|jS)Nz)formatrUrr>rrr__repr__szFileHash.__repr__N)rrrrXrZrrrrrSsrSc@seZdZejddZejddZeddZeddZ e d d Z e d d Z e d dZe ddZe ddZe ddZddZddZe ddZddZddZedd Ze d!d"Ze d#d$Zd%S)&rcCsdSr<rr$filenamerrrrNszDistribution.read_textcCsdSr<rr$pathrrrrRszDistribution.locate_filecCsD|D].}|tj|d}t|d}|dk r|Sqt|dS)Nr.)_discover_resolversrContextnextr )r0r.resolverZdistsrQrrr from_names   zDistribution.from_namec sJ|ddr|rtdp*tjf|tjfdd|DS)Ncontextz cannot accept context and kwargsc3s|]}|VqdSr<r)r-rcrerr sz(Distribution.discover..)pop ValueErrorrra itertoolschain from_iterabler`)r0kwargsrrfrdiscovers zDistribution.discovercCstt|Sr<)PathDistributionpathlibPath)r^rrratszDistribution.atcCsddtjD}td|S)Ncss|]}t|ddVqdS)find_distributionsN)r#)r-finderrrrrgsz3Distribution._discover_resolvers..)sys meta_pathr)Zdeclaredrrrr`sz Distribution._discover_resolverscCs(|dp|dp|d}t|S)NZMETADATAzPKG-INFOr)rNemailZmessage_from_stringr$r:rrrrs  zDistribution.metadatacCs |jdS)NZVersion)rr>rrrrszDistribution.versioncCst|dS)Nzentry_points.txt)rr;rNr>rrrr szDistribution.entry_pointscs6p}dfdd }|o4tt|t|S)Ncs6t|}|rt|nd|_|r&t|nd|_|_|Sr<)rErShashintsizerQ)r.ryZsize_strresultr>rr make_files z%Distribution.files..make_file)NN)_read_files_distinfo_read_files_egginfor(rcsvreader)r$Z file_linesr}rr>rr s zDistribution.filescCs|d}|o|S)NZRECORD)rN splitlinesrxrrrr~s z!Distribution._read_files_distinfocCs|d}|otdj|S)Nz SOURCES.txtz"{}")rNmaprYrrxrrrrs z Distribution._read_files_egginfocCs|p|}|ot|Sr<)_read_dist_info_reqs_read_egg_info_reqsr()r$ZreqsrrrrszDistribution.requirescCs |jdS)Nz Requires-Dist)rZget_allr>rrrrsz!Distribution._read_dist_info_reqscCs|d}|o||S)Nz requires.txt)rN_deps_from_requires_text)r$sourcerrrr s z Distribution._read_egg_info_reqscCs4||}ddt|tdD}||S)NcSs&i|]\}}|tttd|qS)line)r(roperator itemgetter)r-sectionZresultsrrr 'sz9Distribution._deps_from_requires_text..r)_read_sectionsrrjgroupbyrr%_convert_egg_info_reqs_to_simple_reqs)r0rZ section_pairsr3rrrr$s z%Distribution._deps_from_requires_textccs<d}td|D](}td|}|r.|d}qtVqdS)Nz \[(.*)\]$)rr)rrlocals)linesrrZ section_matchrrrr.s  zDistribution._read_sectionsc#sBddfdd}|D] \}}|D]}|||Vq(qdS)NcSs|odj|dS)Nzextra == "{name}"r_)rYr_rrrmake_conditionCszJDistribution._convert_egg_info_reqs_to_simple_reqs..make_conditioncsX|pd}|d\}}}|r,|r,dj|d}ttd||g}|rTdd|SdS)Nr:z ({markers}))markersz; z and )rTrYr(rjoin)rZextraseprZ conditionsrrrparse_conditionFs  zKDistribution._convert_egg_info_reqs_to_simple_reqs..parse_conditionr+)r3rrZdepsZdeprrrr8s  z2Distribution._convert_egg_info_reqs_to_simple_reqsN)rrrabcabstractmethodrNrRrDrdrn staticmethodrrr`rCrrr r r~rrrrrrrrrrrrs@             c@s.eZdZGdddZejefddZdS)rc@s$eZdZdZddZeddZdS)zDistributionFinder.ContextNcKst||dSr<)varsupdate)r$rmrrrrXjsz#DistributionFinder.Context.__init__cCst|dtjS)Nr^)rgetrur^r>rrrr^mszDistributionFinder.Context.path)rrrr.rXrCr^rrrrraXs racCsdSr<r)r$rerrrrswsz%DistributionFinder.find_distributionsN)rrrrarrrsrrrrrSsc@s<eZdZddZddZddZddZd d Zd d Zd S)FastPathcCs||_tj||_dSr<)rootosr^basenamelowerbase)r$rrrrrXszFastPath.__init__cCst|j|Sr<)rprqr)r$childrrrjoinpathszFastPath.joinpathc CsTttt|jpdW5QRSQRXtt|W5QRSQRXgS)Nr)r Exceptionrlistdirr zip_childrenr>rrrchildrens  " zFastPath.childrencCs2t|j}|j}|j|_tdd|DS)Ncss |]}|tjddVqdS)rrN)r posixpathr)r-rrrrrgsz(FastPath.zip_children..)zipfilerqrZnamelistrdictfromkeys)r$Zzip_pathnamesrrrrs    zFastPath.zip_childrencCs&|j}||jkp$||jo$|dS)N.egg)rversionless_egg_name startswithprefixendswith)r$searchrrrris_eggs   zFastPath.is_eggccsZ|D]L}|}||jksH||jr6||jsH||r|dkr||VqdS)Nzegg-info) rr exact_matchesrrrsuffixesrr)r$r.rZn_lowrrrrs    zFastPath.searchN) rrrrXrrrrrrrrrrs  rc@s2eZdZdZdZdZdgddZdZddZdS)Preparedr)z .dist-infoz .egg-infoNrcsV|_|dkrdS|dd_jd_fddjD_jd_dS)N-rWcsg|]}j|qSr) normalized)r-suffixr>rrr2sz%Prepared.__init__..r)r.rreplacerrrrr)r$r.rr>rrXs  zPrepared.__init__) rrrrrrrrrXrrrrrs rc@s,eZdZeefddZeddZdS)MetadataPathFindercCs||j|j}tt|Sr<) _search_pathsr.r^rro)r0refoundrrrrss z%MetadataPathFinder.find_distributionscs tjfddtt|DS)Nc3s|]}|tVqdSr<)rr)r-r^r_rrrgsz3MetadataPathFinder._search_paths..)rjrkrlrr)r0r.pathsrr_rrsz MetadataPathFinder._search_pathsN)rrrrDrrarsrrrrrrs rc@s.eZdZddZddZejje_ddZdS)rocCs ||_dSr<)_pathr]rrrrXszPathDistribution.__init__c Cs<tttttt"|j|jddW5QRSQRXdS)NrFrG) rFileNotFoundErrorIsADirectoryErrorKeyErrorNotADirectoryErrorPermissionErrorrrrNr[rrrrNs zPathDistribution.read_textcCs |jj|Sr<)rparentr]rrrrRszPathDistribution.locate_fileN)rrrrXrNr__doc__rRrrrrros rocCs t|Sr<)rrdZdistribution_namerrrr scKs tjf|Sr<)rrn)rmrrrr scCs t|jSr<)rrdrrrrrrscCs t|jSr<)r rrrrrr scCsHtjddtD}td}t||d}t||}dd|DS)Ncss|] }|jVqdSr<)r )r-rQrrrrgszentry_points..r)keycSsi|]\}}|t|qSr)tuple)r-repsrrrrsz entry_points..)rjrkrlr r attrgettersortedr)rZby_groupZorderedZgroupedrrrr s    cCs t|jSr<)r r rrrrr %scCs t|jSr<)r rrrrrr.s),r8rr)rrrurwrprrr!rjr collectionsZ configparserr contextlibr importlibr importlib.abcrr__all__ModuleNotFoundErrorr namedtuplerZ PurePosixPathrErSrrrrrror r rrr r rrrrrsb       NE/0