=OgyddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlmZmZddlmZmZddlmZmZddlmZmZddlmZmZddlmZdd lm Z dd l!m"Z"dd l m#Z#dd l$m%Z%m&Z&m'Z'm(Z(gd Z)Gdde*Z+GddZ,GddZ-Gdde-Z.Gdde/Z0Gdde0Z1GddZ2Gdde2e3Z4Gddej5Z6Gd d!Z7Gd"d#Z8Gd$d%e"Z9Gd&d'Z:Gd(d)Z;Gd*d+Z<Gd,d-e9Z=Gd.d/e8Z>d0Z?d1Z@d2ejfd3ZAd4ZBe jCeejDd56ZE d2e(e1e4ffd7ZFd8ZGd9ZHd2e&eIe%eIffd:ZJd;ZKd<ZLdS)=N) _adapters_meta)FreezableDefaultDictPair) method_cache pass_none)always_iterableunique_everseen)PackageMetadata SimplePath)suppress) import_module)MetaPathFinder)starmap)ListMappingOptionalUnion) DistributionDistributionFinderr PackageNotFoundError distribution distributions entry_pointsfilesmetadatapackages_distributionsrequiresversionc.eZdZdZdZedZdS)rzThe package was not found.cd|jS)Nz"No package metadata was found for nameselfs B/opt/alt/python311/lib64/python3.11/importlib/metadata/__init__.py__str__zPackageNotFoundError.__str__1s?DI???c|j\}|SN)argsr&r$s r'r$zPackageNotFoundError.name4s) r)N)__name__ __module__ __qualname____doc__r(propertyr$r)r'rr.sG$$@@@Xr)rceZdZdZejdZedZ e ddZ e dZ dS) Sectioneda A simple entry point config parser for performance >>> for item in Sectioned.read(Sectioned._sample): ... print(item) Pair(name='sec1', value='# comments ignored') Pair(name='sec1', value='a = 1') Pair(name='sec1', value='b = 2') Pair(name='sec2', value='a = 2') >>> res = Sectioned.section_pairs(Sectioned._sample) >>> item = next(res) >>> item.name 'sec1' >>> item.value Pair(name='a', value='1') >>> item = next(res) >>> item.value Pair(name='b', value='2') >>> item = next(res) >>> item.name 'sec2' >>> item.value Pair(name='a', value='2') >>> list(res) [] zm [sec1] # comments ignored a = 1 b = 2 [sec2] a = 2 cNd|||jDS)Nc3~K|]8}|j |tj|jV9dS)N)value)r$_replacerparser8).0sections r' z*Sectioned.section_pairs..esS  |'   4:gm#<#<  = =''''  r))filter_)readvalid)clstexts r' section_pairszSectioned.section_pairscs5  88D#)8<<    r)Nc#4Kt|ttj|}d}|D]V}|do|d}|r|d}Dt||VWdS)N[]z[])filtermapstrstrip splitlines startswithendswithr)rBr>linesr$r8 section_matchs r'r?zSectioned.readkswCIt/@/@ A ABB $ $E!,,S11IennS6I6IM {{4((tU## # # # #  $ $r)c2|o|d S)N#)rL)lines r'r@zSectioned.validvs0DOOC0000r)r+) r.r/r0r1textwrapdedentlstrip_sample classmethodrC staticmethodr?r@r3r)r'r5r5:s8ho    fhh   [ $$$\$11\111r)r5cJeZdZdZejejdedZ dZ dS)DeprecatedTuplea Provide subscript item access for backward compatibility. >>> recwarn = getfixture('recwarn') >>> ep = EntryPoint(name='name', value='value', group='group') >>> ep[:] ('name', 'value', 'group') >>> ep[0] 'name' >>> len(recwarn) 1 zAEntryPoint tuple interface is deprecated. Access members by name. stacklevelc^|||Sr+)_warn_key)r&items r' __getitem__zDeprecatedTuple.__getitem__s" yy{{4  r)N) r.r/r0r1 functoolspartialwarningswarnDeprecationWarningr_rbr3r)r'rZrZ{sV   I  K    E!!!!!r)rZceZdZUdZejdZ eed<eed<eed<dZ e ded<d Z d Z e d Ze d Ze d ZdZdZdZdZdZdZdZdZdZdS) EntryPointaAn entry point as defined by Python packaging conventions. See `the packaging docs on entry points `_ for more information. >>> ep = EntryPoint( ... name=None, group=None, value='package.module:attr [extra1, extra2]') >>> ep.module 'package.module' >>> ep.attr 'attr' >>> ep.extras ['extra1', 'extra2'] zH(?P[\w.]+)\s*(:\s*(?P[\w.]+)\s*)?((?P\[.*\])\s*)?$r$r8groupNrdistcPt||||dS)Nr$r8rjvarsupdate)r&r$r8rjs r'__init__zEntryPoint.__init__s) T t5>>>>>r)c*|j|j}t|d}t d|dpdd}tjt||S)zLoad the entry point from its definition. If only a module is indicated by the value, return that module. Otherwise, return the named object. moduleNattr.) patternmatchr8rrjrGsplitrcreducegetattr)r&rxrsattrss r'loadzEntryPoint.loadsw  ""4:..u{{84455tekk&117R>>sCCDD777r)cj|j|j}|dS)Nrsrwrxr8rjr&rxs r'rszEntryPoint.modules+ ""4:..{{8$$$r)cj|j|j}|dS)Nrtrrs r'rtzEntryPoint.attrs+ ""4:..{{6"""r)c|j|j}tjd|dpdS)Nz\w+extrasru)rwrxr8refindallrjrs r'rzEntryPoint.extrass< ""4:..z&%++h"7"7"=2>>>r)cLt|||S)Nrkrn)r&rks r'_forzEntryPoint._fors$ T t$$$ r)cfd}tj|tt|j|fS)zP Supply iter so one may construct dicts of EntryPoints by name. zJConstruction of dict of EntryPoints is deprecated in favor of EntryPoints.)rerfrgiterr$)r&msgs r'__iter__zEntryPoint.__iter__s6  $   c-...TY%&&&r)c fd|D}tttj||S)a$ EntryPoint matches the given parameters. >>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]') >>> ep.matches(group='foo') True >>> ep.matches(name='bar', value='bing:bong [extra1, extra2]') True >>> ep.matches(group='foo', name='other') False >>> ep.matches() True >>> ep.matches(extras=['extra1', 'extra2']) True >>> ep.matches(module='bing') True >>> ep.matches(attr='bong') True c38K|]}t|VdSr+r{)r;paramr&s r'r=z%EntryPoint.matches..s-::%u%%::::::r))allrHoperatoreqvalues)r&paramsr|s` r'matcheszEntryPoint.matchessB(;:::6:::3x{FMMOOU;;<< ")))???888%%X%##X#??X? ' ' '===.111***+++BBB   !!!!!r)riceZdZdZdZejejde dZ de ffd Z e ee dd Zd ZxZS) DeprecatedLista> Allow an otherwise immutable object to implement mutability for compatibility. >>> recwarn = getfixture('recwarn') >>> dl = DeprecatedList(range(3)) >>> dl[0] = 1 >>> dl.append(3) >>> del dl[3] >>> dl.reverse() >>> dl.sort() >>> dl.extend([4]) >>> dl.pop(-1) 4 >>> dl.remove(1) >>> dl += [5] >>> dl + [6] [1, 2, 5, 6] >>> dl + (6,) [1, 2, 5, 6] >>> dl.insert(0, 0) >>> dl [0, 1, 2, 5] >>> dl == [0, 1, 2, 5] True >>> dl == (0, 1, 2, 5) True >>> len(recwarn) 1 r3zAEntryPoints list interface is deprecated. Cast to list if needed.r[r\ method_namecfd}|fS)Ncp|tt|i|Sr+)r_r{super)r&r,kwargs __class__rs r'wrappedz7DeprecatedList._wrap_deprecated_method..wrappedCs3 JJLLL07577K00$A&AA Ar)r3)rrrs` r'_wrap_deprecated_methodz&DeprecatedList._wrap_deprecated_methodBs5 B B B B B BG##r)zM__setitem__ __delitem__ append reverse extend pop remove __iadd__ insert sortct|ts#|t|}|t||zSr+) isinstancetupler_rrs r'__add__zDeprecatedList.__add__QsI%'' ! JJLLL%LLE~~eDkkE1222r)ct|ts#|t|}t||Sr+)rrr_rrs r'rzDeprecatedList.__eq__WsF%'' ! JJLLL%LLET{{!!%(((r))r.r/r0r1 __slots__rcrdrerfrgr_rIrlocalsrprHryrr __classcell__rs@r'rrs>I I  K    E$S$$$$$$ FHHOO  # ##(577  333 )))))))r)rceZdZdZdZfdZdZedZedZ e dZ e dZ xZS) EntryPointszC An immutable collection of selectable EntryPoint objects. r3cDt|tr=tjdtdt |S tt| |S#t$rt|wxYw)z; Get the EntryPoint in self matching name. zGAccessing entry points by index is deprecated. Cast to tuple if needed.r[r\r#) rintrerfrgrrbnextrselect StopIterationKeyErrorr&r$rs r'rbzEntryPoints.__getitem__fs dC  - M+"      77&&t,, , !T[[d[334455 5 ! ! !4..  !s /BBc :tfd|DS)zv Select entry points from self that match the given parameters (typically group and/or name). c36K|]}|jdi|VdSNr3)r)r;eprs r'r=z%EntryPoints.select..|s:EE"  0D0DV0D0DE2EEEEEEr)rr&rs `r'rzEntryPoints.selectws( EEEEEEEEEEr)cd|DS)zB Return the set of all names of all entry points. ch|] }|j Sr3r#r;rs r' z$EntryPoints.names..s'''B'''r)r3r%s r'nameszEntryPoints.names~s ('$''''r)cd|DS)z Return the set of all groups of all entry points. For coverage while SelectableGroups is present. >>> EntryPoints().groups set() ch|] }|j Sr3)rjrs r'rz%EntryPoints.groups..s(((R(((r)r3r%s r'groupszEntryPoints.groupss)(4((((r)cX|fd||DS)Nc3BK|]}|VdSr+)r)r;rrks r'r=z-EntryPoints._from_text_for..s-@@R2774==@@@@@@r)) _from_text)rArBrks `r'_from_text_forzEntryPoints._from_text_fors4s@@@@3>>$+?+?@@@@@@r)cNdt|pdDS)Nc3lK|]/}t|jj|jj|jV0dS)rmN)rir8r$)r;ras r'r=z)EntryPoints._from_text..sP   DJO4:3C49 U U U      r)ru)r5rC)rBs r'rzEntryPoints._from_texts5  !// ;;    r))r.r/r0r1rrbrr2rrrWrrXrrrs@r'rr_sI!!!!!"FFF((X( ))X)AA[A  \     r)rceZdZdZejejdedZ fdZ d fd Z fdZ fd Z fd Zfd ZxZS) Deprecateda Compatibility add-in for mapping to indicate that mapping behavior is deprecated. >>> recwarn = getfixture('recwarn') >>> class DeprecatedDict(Deprecated, dict): pass >>> dd = DeprecatedDict(foo='bar') >>> dd.get('baz', None) >>> dd['foo'] 'bar' >>> list(dd) ['foo'] >>> list(dd.keys()) ['foo'] >>> 'foo' in dd True >>> list(dd.values()) ['bar'] >>> len(recwarn) 1 z:SelectableGroups dict interface is deprecated. Use select.r[r\cn|t|Sr+)r_rrbrs r'rbzDeprecated.__getitem__s( ww""4(((r)Ncp|t||Sr+)r_rget)r&r$defaultrs r'rzDeprecated.gets( ww{{4)))r)cl|tSr+)r_rrr&rs r'rzDeprecated.__iter__s& ww!!!r)cX|tj|Sr+)r_r __contains__)r&r,rs r'rzDeprecated.__contains__s$ #uww#T**r)cl|tSr+)r_rkeysrs r'rzDeprecated.keyss" ww||~~r)cl|tSr+)r_rrrs r'rzDeprecated.valuess$ ww~~r)r+)r.r/r0r1rcrdrerfrgr_rbrrrrrrrs@r'rrs, I  D    E)))))******"""""+++++         r)rczeZdZdZedZefdZedZedZ dZ xZ S)SelectableGroupszs A backward- and forward-compatible result from entry_points that fully implements the dict interface. ctjd}t||}tj||}|d|DS)Nrjkeyc3>K|]\}}|t|fVdSr+r)r;rjepss r'r=z(SelectableGroups.load..s3GGE;s++,GGGGGGr))r attrgettersorted itertoolsgroupby)rArby_grouporderedgroupeds r'r}zSelectableGroups.loadsU&w//(+++#GX66sGGwGGGGGGr)ctt|}ttj|S)zH Reconstruct a list of all entrypoints from the groups. )rrrrrchain from_iterable)r&rrs r'_allzSelectableGroups._alls> z4((//119?88@@AAAr)c|jjSr+)rrr%s r'rzSelectableGroups.groupss yr)c|jjS)zR for coverage: >>> SelectableGroups().names set() )rrr%s r'rzSelectableGroups.namessyr)c .|s|S|jjdi|Sr)rrrs r'rzSelectableGroups.selects* Kty))&)))r)) r.r/r0r1rWr}r2rrrrrrs@r'rrs HH[H BBBBXB  X X*******r)rc&eZdZdZddZdZdZdS) PackagePathz"A reference to a path in a packageutf-8c||5}|cdddS#1swxYwYdS)Nencodinglocateopenr?)r&rstreams r' read_textzPackagePath.read_texts [[]]    2 2 !f;;== ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !sA  AAc|d5}|cdddS#1swxYwYdS)Nrbr)r&rs r' read_binaryzPackagePath.read_binarys [[]]   % % !;;== ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !sA  A A c6|j|S)z'Return a path-like object for this path)rk locate_filer%s r'rzPackagePath.locatesy$$T***r)N)r)r.r/r0r1rr rr3r)r'rrsL,,!!!!!!!+++++r)rceZdZdZdZdS)FileHashcL|d\|_}|_dS)N=) partitionmoder8)r&spec_s r'rqzFileHash.__init__ s"#'>>##6#6  1djjjr)c(d|jd|jdS)Nz)rr8r%s r'rzFileHash.__repr__sB$)BBTZBBBBr)N)r.r/r0rqrr3r)r'r r  s7777CCCCCr)r ceZdZdZejdZejdZede fdZ edZ e dZ e dZed ejfd Zed Zed Zed ZedZedZdZdZedZdZdZedZe dZdS)rzA Python distribution package.cdS)zAttempt to load metadata file given by the name. :param filename: The name of the file in the distribution info. :return: The text if found, otherwise None. Nr3r&filenames r'rzDistribution.read_textr)cdS)z[ Given a path to a file in this distribution, return a path to it. Nr3r&paths r'r zDistribution.locate_filerr)r$c|std t||S#t$rt |wxYw)aReturn the Distribution for the given package name. :param name: The name of the distribution package to search for. :return: The Distribution instance (or subclass thereof) for the named package, if found. :raises PackageNotFoundError: When the named package's distribution metadata cannot be found. :raises ValueError: When an invalid value is supplied for name. z A distribution name is required.r#) ValueErrorrdiscoverrr)rAr$s r' from_namezDistribution.from_name%sf A?@@ @ - $ //00 0 - - -&t,, , -s "6Ac |ddr|rtdptjdi|tjfd|DS)aReturn an iterable of Distribution objects for all packages. Pass a ``context`` or pass keyword arguments for constructing a context. :context: A ``DistributionFinder.Context`` object. :return: Iterable of Distribution objects for all packages. contextNz cannot accept context and kwargsc3.K|]}|VdSr+r3)r;resolverr#s r'r=z(Distribution.discover..Es>- - "*HHW  - - - - - - r)r3)poprrContextrrr_discover_resolvers)rArr#s @r'r zDistribution.discover7s**Y--  Av A?@@ @A/7AA&AA,,- - - - .1.E.E.G.G- - -    r)cDttj|S)zReturn a Distribution for the indicated metadata path :param path: a string or path-like object :return: a concrete Distribution instance for the path )PathDistributionpathlibPath)rs r'atzDistribution.atIs  T 2 2333r)cNdtjD}td|S)z#Search the meta_path for resolvers.c38K|]}t|ddVdS)find_distributionsNr)r;finders r'r=z3Distribution._discover_resolvers..Us@  r%s r'r zDistribution.versionus}Y''r)c^t|d|S)Nzentry_points.txt)rrrr%s r'rzDistribution.entry_pointszs%))$..9K*L*LdSSSr)cdfd tfd}|pS)aBFiles in this distribution. :return: List of PackagePath for this distribution or None Result is `None` if the metadata file that enumerates files (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is missing. Result may be empty if the metadata exists but is empty. Nct|}|rt|nd|_|rt|nd|_|_|Sr+)rr rrsizerk)r$rsize_strresultr&s r' make_filez%Distribution.files..make_filesH &&F,0:(4...dFK+3=#h---FKFKMr)cbtttj|Sr+)listrcsvreader)rNrKs r' make_filesz&Distribution.files..make_filess% 3:e+<+<==>> >r))NN)r _read_files_distinfo_read_files_egginfo)r&rPrKs` @r'rzDistribution.files~sv        ? ? ? ?  ?z$3355S9Q9Q9S9STTTr)cX|d}|o|S)z* Read the lines of RECORD RECORD)rrKr;s r'rQz!Distribution._read_files_distinfos*~~h''))))r)c~|d}|o&tdj|S)z` SOURCES.txt might contain literal commas, so wrap each line in quotes. z SOURCES.txtz"{}")rrHformatrKr;s r'rRz Distribution._read_files_egginfos6 ~~m,,=FM4??+<+<===r)ct|p|}|ot|S)z6Generated requirements specified for this Distribution)_read_dist_info_reqs_read_egg_info_reqsrM)r&reqss r'rzDistribution.requiress7((**Hd.F.F.H.H"T "r)c6|jdS)Nz Requires-Dist)rget_allr%s r'rXz!Distribution._read_dist_info_reqss}$$_555r)cf|d}t|j|S)Nz requires.txt)rr _deps_from_requires_text)r&sources r'rYz Distribution._read_egg_info_reqss.//7y677???r)c\|t|Sr+)%_convert_egg_info_reqs_to_simple_reqsr5r?)rAr_s r'r^z%Distribution._deps_from_requires_texts"889O9OPPPr)c#Kdfd}d}|D]/}||j}|j|z||jzV0dS)a Historically, setuptools would solicit and store 'extra' requirements, including those with environment markers, in separate sections. More modern tools expect each dependency to be defined separately, with any relevant extras and environment markers attached directly to that requirement. This method converts the former to the latter. See _test_deps_from_requires_text for an example. c|od|dS)Nz extra == ""r3r#s r'make_conditionzJDistribution._convert_egg_info_reqs_to_simple_reqs..make_conditions00000 0r)c |pd}|d\}}}|r|rd|d}ttd||g}|rdd|zndS)Nru:(rz; z and )rrMrGjoin)r<extrasepmarkers conditionsres r' quoted_markerzIDistribution._convert_egg_info_reqs_to_simple_reqs..quoted_markersmG")"3"3C"8"8 E3 ) )(g...fTG^^E5J5J+KLLMMJ6@H4',,z2222b Hr)cdd|vzS)z PEP 508 requires a space between the url_spec and the quoted_marker. Ref python/importlib_metadata#357.  @r3)reqs r' url_req_spacezIDistribution._convert_egg_info_reqs_to_simple_reqs..url_req_spaces #*% %r)N)r8r$)sectionsrnrsr<spaceres @r'raz2Distribution._convert_egg_info_reqs_to_simple_reqss 1 1 1 I I I I I & & &  F FG!M'-00E-%'-- *E*EE E E E E F Fr)N)r.r/r0r1abcabstractmethodrr rWrIr!r rXr-r(r2rr rr$rBr rrrQrRrrXrYr^rar3r)r'rrs"((       -S---[-"  [ "44\4&&\&B%/BBBXB %%X%--X-((X(TTXTUUXU0***>>>##X# 666@@@QQ[Q F F\ F F Fr)rc`eZdZdZGddZejefdZdS)rzJ A MetaPathFinder capable of discovering installed distributions. c4eZdZdZdZ dZedZdS)DistributionFinder.Contextaw Keyword arguments presented by the caller to ``distributions()`` or ``Distribution.discover()`` to narrow the scope of a search for distributions in all DistributionFinders. Each DistributionFinder may expect any parameters and should attempt to honor the canonical parameters defined below when appropriate. Nc Jt||dSr+rn)r&rs r'rqz#DistributionFinder.Context.__init__s" JJ  f % % % % %r)c\t|dtjS)z The sequence of directory path that a distribution finder should search. Typically refers to Python installed package paths such as "site-packages" directories and defaults to ``sys.path``. r)rorr2rr%s r'rzDistributionFinder.Context.paths ::>>&#(33 3r))r.r/r0r1r$rqr2rr3r)r'r'rzsT   & & &  4 4  4 4 4r)r'cdS)z Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching the ``context``, a DistributionFinder.Context instance. Nr3)r&r#s r'r0z%DistributionFinder.find_distributionsrr)N)r.r/r0r1r'rvrwr0r3r)r'rrst44444444@ )0      r)rceZdZdZejfdZdZdZdZ dZ dZ e dZ ed ZxZS) FastPathzs Micro-optimized class for searching a path for children. >>> FastPath('').children() ['...'] cFt|Sr+)r__new__)rArootrs r'rzFastPath.__new__swws###r)c||_dSr+)r)r&rs r'rqzFastPath.__init__s  r)c6tj|j|Sr+)r+r,r)r&childs r'joinpathzFastPath.joinpaths|DIu---r)ctt5tj|jpdcdddS#1swxYwYtt5|cdddS#1swxYwYgS)Nrv)r Exceptionoslistdirr zip_childrenr%s r'childrenzFastPath.childrens i  0 0:di.3// 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 i  ' '$$&& ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' s!=AAA==BBctj|j}|j}|j|_t d|DS)Nc3bK|]*}|tjddV+dS)rrN)ry posixpathrk)r;rs r'r=z(FastPath.zip_children..*s7QQ%U[[::1=QQQQQQr))zipfiler,rnamelistrdictfromkeys)r&zip_pathrs r'rzFastPath.zip_children%sQ< ** &&(( ) }}QQ5QQQQQQr)c\||j|Sr+)lookupmtimesearchr-s r'rzFastPath.search,s${{4:&&--d333r)ctt5tj|jjcdddS#1swxYwY|jdSr+)rOSErrorrstatrst_mtimer cache_clearr%s r'rzFastPath.mtime/s g   / /749%%. / / / / / / / / / / / / / / / / !!!!!sAAAc t|Sr+)Lookup)r&rs r'rzFastPath.lookup5sd||r))r.r/r0r1rc lru_cacherrqrrrrr2rrrrrs@r'rr sY$$$$$...RRR444""X" \r)rc eZdZdefdZdZdS)rrctj|j}|d}t t|_t t|_ | D]7}|}|dr| dd dd}t|}|j||||r|dkr| dd dd}t|}|j |||9|j|j dS)Nz.eggz .dist-infoz .egg-inforvr-zegg-info)rrbasenamerlowerrMrrMinfoseggsr rpartitionrr@rAappendrlegacy_normalizefreeze) r&rbase base_is_eggrlowr$ normalizedlegacy_normalizeds r'rqzLookup.__init__;sw **0022mmF++ )$// (.. ]]__ J JE++--C||788 J~~c**1-77<X* , , , , ,r)rcReZdZdZdZdZdZedZedZ dZ dS)r@zE A prepared search for metadata on a possibly-named package. Nc||_|dS|||_|||_dSr+)r$rArrrr-s r'rqzPrepared.__init__fsB < F....!%!6!6t!.s@- - &*DKK ! !- - - - - - r))r@rrrrHr)rAr$pathsrs @r'rz MetadataPathFinder._search_pathssZD>>,,- - - - .1(E.B.B- - -    r)cBtjdSr+)rrr)rAs r'invalidate_cachesz$MetadataPathFinder.invalidate_cachess$$&&&&&r)N) r.r/r0rWrr'r0rrr3r)r'rrsw(:(B(B(D(D , , ,[ ,  [ ''['''r)rc~eZdZdefdZdZejje_dZe fdZ e dZ xZ S)r*rc||_dS)zfConstruct a distribution. :param path: SimplePath indicating the metadata directory. N)_pathrs r'rqzPathDistribution.__init__s  r)ctttttt 5|j|dcdddS#1swxYwYdS)Nrr) rFileNotFoundErrorIsADirectoryErrorrNotADirectoryErrorPermissionErrorrrrrs r'rzPathDistribution.read_texts          M M:&&x00::G:LL M M M M M M M M M M M M M M M M M Ms.A((A,/A,c |jj|z Sr+)rparentrs r'r zPathDistribution.locate_filesz 4''r)ctjt|j}t t j||ptj S)zz Performance optimization: where possible, resolve the normalized name from the file system path. ) rrrrIrr r@rA_name_from_stemrrB)r&stemrs r'rBz!PathDistribution._normalized_names\ wDJ00 )Ih( ) )$*>*>t*D*D E E (ww' r)ctj|\}}|dvrdS|d\}}}|S)a7 >>> PathDistribution._name_from_stem('foo-3.0.egg-info') 'foo' >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info') 'CherryPy' >>> PathDistribution._name_from_stem('face.egg-info') 'face' >>> PathDistribution._name_from_stem('foo.bar') rNr)rrsplitextr)rrextr$rkrests r'rz PathDistribution._name_from_stemsL((.. # 1 1 1 F",,S11c4 r))r.r/r0r rqrrr1r r2rBrXrrrs@r'r*r*sZMMM%.6I(((     X  \r)r*c6t|S)zGet the ``Distribution`` instance for the named package. :param distribution_name: The name of the distribution package as a string. :return: A ``Distribution`` instance (or subclass thereof). )rr!distribution_names r'rrs  ! !"3 4 44r)c $tjdi|S)z|Get all ``Distribution`` instances in the current environment. :return: An iterable of ``Distribution`` instances. r3)rr )rs r'rrs  * *6 * **r)r5c@t|jS)zGet the metadata for the named package. :param distribution_name: The name of the distribution package to query. :return: A PackageMetadata containing the parsed metadata. )rr!rrs r'rrs  ! !"3 4 4 ==r)c*t|jS)zGet the version string for the named package. :param distribution_name: The name of the distribution package to query. :return: The version string for the package as defined in the package's "Version" metadata key. )rr rs r'r r s ) * * 22r)rBrc tjdtt D}t |jdi|S)aReturn EntryPoint objects for all installed packages. Pass selection parameters (group or name) to filter the result to entry points matching those properties (see EntryPoints.select()). For compatibility, returns ``SelectableGroups`` object unless selection parameters are supplied. In the future, this function will return ``EntryPoints`` instead of ``SelectableGroups`` even when no selection parameters are supplied. For maximum future compatibility, pass selection parameters or invoke ``.select`` with parameters on the result. :return: EntryPoints or SelectableGroups for all installed packages. c3$K|] }|jV dSr+)r)r;rks r'r=zentry_points..s6(("((((((r)r3)rrr_uniquerrr}r)rrs r'rrsj" / ' '((&-moo&>&>(((  C   % % , 6 6v 6 66r)c*t|jS)zReturn a list of files for the named package. :param distribution_name: The name of the distribution package to query. :return: List of files composing the distribution. )rrrs r'rrs ) * * 00r)c*t|jS)z Return a list of requirements for the named package. :return: An iterator of requirements, suitable for packaging.requirement.Requirement. )rrrs r'rrs ) * * 33r)ctjt}tD]I}t |pt |D](}|||jd)Jt|S)z Return a mapping of top-level packages to their distributions. >>> import collections.abc >>> pkgs = packages_distributions() >>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values()) True r=) collections defaultdictrMr_top_level_declared_top_level_inferredrrr) pkg_to_distrkpkgs r'rr's)$//K;;&t,,I0CD0I0I ; ;C   # #DM&$9 : : : : ;   r)cT|dpdS)Nz top_level.txtru)rryrs r'rr8s% NN? + + 1r 8 8 : ::r)c>dt|jDS)Nch|]L}|jdk t|jdkr |jdn|djMS)z.pyrrru)suffixlenparts with_suffixr$)r;fs r'rz&_top_level_inferred..=sZ    8u  !'llQ&& AMM",=,=,B   r))r rrs r'rr<s-   ,,   r))MrrrvrNr2r9r+rrrSrercrrrrurr _collectionsrr _functoolsrr _itertoolsr r r r contextlibr importlibr importlib.abcrrtypingrrrr__all__ModuleNotFoundErrorrr5rZrirMrrrrr PurePosixPathrr rrrrr@rr*rrrr rdrrrrrrIrrrr3r)r'rs 44444444////////88888888........######((((((111111111111        .   >1>1>1>1>1>1>1>1B!!!!!!!!4A!A!A!A!A!A!A!A!HC)C)C)C)C)TC)C)C)L: : : : : .: : : z4 4 4 4 4 4 4 4 n%*%*%*%*%*z4%*%*%*P + + + + +'' + + + CCCCCCCCEFEFEFEFEFEFEFEFP- - - - - - - - `,,,,,,,,^!,!,!,!,!,!,!,!,HD'''''+'''622222|222j555+++>5#8>>>>333 ) .//    7eK1A$AB7777.111444T#Y 7";;;r)