a  ze$G@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__rrF/opt/bitninja-python-dojo/embedded/lib/python3.9/importlib/metadata.pyr %sr c@sjeZdZedZddZeddZeddZ edd Z e d d Z e d d Z ddZddZdS) 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}|dS)Nrrrrrr$rrrrrQszEntryPoint.modulecCs|j|j}|dS)Nrr'r(rrrrVszEntryPoint.attrcCs(|j|j}ttd|dp"dS)Nz\w+extrasr)rrrlistrefinditerrr(rrrr)[szEntryPoint.extrascsfddDS)Ncs,g|]$}|D]\}}|||qqSritems).0rnamerclsconfigrr bsz+EntryPoint._from_config..)sectionsr1rr1r _from_config`s zEntryPoint._from_configcCsLtdd}t|_z||Wn"ty@|t|Yn0t |S)N=)Z delimiters) rstrZ optionxformZ read_stringAttributeErrorZreadfpioStringIOrr6)r2textr3rrr _from_texths  zEntryPoint._from_textcCst|j|fSN)iterr0r$rrr__iter__tszEntryPoint.__iter__cCs|j|j|j|jffSr>) __class__r0rrr@rrr __reduce__zszEntryPoint.__reduce__N)rrrr+compilerr&propertyrrr) classmethodr6r=rArCrrrrr)s        rZEntryPointBasezname value groupc@s&eZdZd ddZddZddZdS) PackagePathutf-8cCs<|j|d}|WdS1s.0YdS)Nencodinglocateopenread)r$rJstreamrrr read_textszPackagePath.read_textcCs:|d}|WdS1s,0YdS)NrbrK)r$rOrrr read_binaryszPackagePath.read_binarycCs |j|Sr>)dist locate_filer@rrrrLszPackagePath.locateN)rH)rrrrPrRrLrrrrrGs rGc@seZdZddZddZdS)FileHashcCs|d\|_}|_dS)Nr7) partitionmoder)r$spec_rrr__init__szFileHash.__init__cCsd|j|jS)Nz)formatrWrr@rrr__repr__szFileHash.__repr__N)rrrrZr\rrrrrUsrUc@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$filenamerrrrPszDistribution.read_textcCsdSr>rr$pathrrrrTszDistribution.locate_filecCsH|D]2}|tj|d}tt|d}|dur|Sqt|dS)Nr0)_discover_resolversrContextnextr?r )r2r0resolverZdistsrSrrr from_names  zDistribution.from_namec sN|ddr|rtdp.tjfi|tjfdd|DS)Ncontextz cannot accept context and kwargsc3s|]}|VqdSr>r)r/rergrr sz(Distribution.discover..)pop ValueErrorrrc itertoolschain from_iterablerb)r2kwargsrrhrdiscovers zDistribution.discovercCstt|Sr>)PathDistributionpathlibPath)r`rrratszDistribution.atcCsddtjD}td|S)Ncss|]}t|ddVqdS)find_distributionsN)r#)r/finderrrrrisz3Distribution._discover_resolvers..)sys meta_pathr)Zdeclaredrrrrbsz Distribution._discover_resolversrcCs@ddlm}m}||}tj|j||d}tt| |S)Nr)buildmeta)Z source_dirsystem) Zpep517ryrzZ compat_systemr!partialrqzipfilersZ build_as_zip)r2rootryrzr{Zbuilderrrr_locals zDistribution._localcCs(|dp|dp|d}t|S)NZMETADATAzPKG-INFOr)rPemailZmessage_from_stringr$r<rrrrs  zDistribution.metadatacCs |jdS)NZVersion)rr@rrrrszDistribution.versioncCst|dS)Nzentry_points.txt)rr=rPr@rrrr szDistribution.entry_pointscs6p}dfdd }|o4tt|t|S)Ncs6t|}|rt|nd|_|r&t|nd|_|_|Sr>)rGrUhashintsizerS)r0rZsize_strresultr@rr make_files z%Distribution.files..make_file)NN)_read_files_distinfo_read_files_egginfor*rcsvreader)r$Z file_linesrrr@rr s zDistribution.filescCs|d}|o|S)NZRECORD)rP splitlinesrrrrrs z!Distribution._read_files_distinfocCs|d}|otdj|S)Nz SOURCES.txtz"{}")rPmapr[rrrrrr$s z Distribution._read_files_egginfocCs|p|}|ot|Sr>)_read_dist_info_reqs_read_egg_info_reqsr*)r$Zreqsrrrr,szDistribution.requirescCs |jdS)Nz Requires-Dist)rZget_allr@rrrr2sz!Distribution._read_dist_info_reqscCs|d}|o||S)Nz requires.txt)rP_deps_from_requires_text)r$sourcerrrr5s z Distribution._read_egg_info_reqscCs4||}ddt|tdD}||S)NcSs&i|]\}}|tttd|qS)line)r*roperator itemgetter)r/sectionresultsrrr <sz9Distribution._deps_from_requires_text..r)_read_sectionsrrlgroupbyrr%_convert_egg_info_reqs_to_simple_reqs)r2rZ section_pairsr5rrrr9s z%Distribution._deps_from_requires_textccs<d}td|D](}td|}|r.|d}qtVqdS)Nz \[(.*)\]$)rr+rrlocals)linesrrZ section_matchrrrrCs  zDistribution._read_sectionsc#sBddfdd}|D] \}}|D]}|||Vq(qdS)NcSs|odj|dS)Nzextra == "{name}"ra)r[rarrrmake_conditionXszJDistribution._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 )rVr[r*rjoin)rextraseprZ conditionsrrrparse_condition[s  zKDistribution._convert_egg_info_reqs_to_simple_reqs..parse_conditionr-)r5rrZdepsZdeprrrrMs  z2Distribution._convert_egg_info_reqs_to_simple_reqsN)r)rrrabcabstractmethodrPrTrFrfrp staticmethodrtrbrrErrr r rrrrrrrrrrrrrsD              rc@s.eZdZGdddZejefddZdS)rc@s$eZdZdZddZeddZdS)zDistributionFinder.ContextNcKst||dSr>)varsupdate)r$rorrrrZsz#DistributionFinder.Context.__init__cCst|dtjS)Nr`)rgetrwr`r@rrrr`szDistributionFinder.Context.path)rrrr0rZrEr`rrrrrcms rccCsdSr>r)r$rgrrrrusz%DistributionFinder.find_distributionsN)rrrrcrrrurrrrrhsrc@s<eZdZddZddZddZddZd d Zd d Zd S)FastPathcCs||_tj|j|_dSr>)r~osr`basenamelowerbase)r$r~rrrrZszFastPath.__init__cCst|j|Sr>)rrrsr~)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/rrrrrisz(FastPath.zip_children..)r}rsr~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$r0rZn_lowrrrrs    zFastPath.searchN) rrrrZrrrrrrrrrrs  rc@s2eZdZdZdZdZdgddZdZddZdS)Preparedr)z .dist-infoz .egg-infoNrcsV|_|durdS|dd_jd_fddjD_jd_dS)N-rYcsg|]}j|qSr) normalized)r/suffixr@rrr4sz%Prepared.__init__..r)r0rreplacerrrrr)r$r0rr@rrZs  zPrepared.__init__) rrrrrrrrrZrrrrrs rc@s,eZdZeefddZeddZdS)MetadataPathFindercCs||j|j}tt|Sr>) _search_pathsr0r`rrq)r2rgfoundrrrrus z%MetadataPathFinder.find_distributionscs tjfddtt|DS)Nc3s|]}|tVqdSr>)rr)r/r`rarrrisz3MetadataPathFinder._search_paths..)rlrmrnrr)r2r0pathsrrarrsz MetadataPathFinder._search_pathsN)rrrrFrrcrurrrrrrs rc@s.eZdZddZddZejje_ddZdS)rqcCs ||_dSr>)_pathr_rrrrZszPathDistribution.__init__cCsHtttttt$|j|jddWdS1s:0YdS)NrHrI) rFileNotFoundErrorIsADirectoryErrorKeyErrorNotADirectoryErrorPermissionErrorrrrPr]rrrrPszPathDistribution.read_textcCs |jj|Sr>)rparentr_rrrrTszPathDistribution.locate_fileN)rrrrZrPr__doc__rTrrrrrqs rqcCs t|Sr>)rrfZdistribution_namerrrr sr cKstjfi|Sr>)rrp)rorrrr sr cCs t|jSr>)rrfrrrrrrsrcCs t|jSr>)r rrrrrr srcCsHtjddtD}td}t||d}t||}dd|DS)Ncss|] }|jVqdSr>)r )r/rSrrrri/szentry_points..r)keycSsi|]\}}|t|qSr)tuple)r/repsrrrr4sz entry_points..)rlrmrnr r attrgettersortedr)rZby_groupZorderedZgroupedrrrr *s    r cCs t|jSr>)r r rrrrr :sr cCs t|jSr>)r rrrrrrCsr),r:rr+rrrwrrrr}rr!rlr collections configparserr contextlibr importlibr importlib.abcrr__all__ModuleNotFoundErrorr namedtupler PurePosixPathrGrUrrrrrrqr r rrr r rrrrrsN       XP/0