źhg~ddlZddlZddlZddlZddlZddlmZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlmZmZmZddlmZmZddlmZmZmZddlmZmZdd lmZmZdd lm Z m!Z!dd l"m#Z#dd l$m%Z%dd l&m'Z'ddl m(Z(ddl)m*Z*m+Z+m,Z,gdZ-Gdde.Z/GddZ0GddZ1Gdde1Z2Gdde3Z4Gddej5Z6GddZ7Gdd ej8!Z9Gd"d#e'Z:Gd$d%Z;Gd&d'Z<Gd(d)Z=eGd*d+ee:Z>Gd,d-e9Z?d.Z@d/ZAd0ej fd1ZBd2ZCe jDeejE3ZF d0e4fd4ZGd5ZHd6ZId0e+eJe*eJffd7ZKd8ZLd9ZMdS):N)zipp) _adapters_meta _py39compat)FreezableDefaultDictPair) NullFinderinstall pypy_partial) method_cache pass_none)always_iterableunique_everseen)PackageMetadata SimplePath)suppress) import_module)MetaPathFinder)starmap)ListMappingOptional) DistributionDistributionFinderrPackageNotFoundError distribution distributions entry_pointsfilesmetadatapackages_distributionsrequiresversionc.eZdZdZdZedZdS)rzThe package was not found.cd|jS)Nz"No package metadata was found for nameselfs /builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib/python3.11/site-packages/setuptools/_vendor/importlib_metadata/__init__.py__str__zPackageNotFoundError.__str__6s?DI???c|j\}|SN)argsr+r)s r,r)zPackageNotFoundError.name9s) r.N)__name__ __module__ __qualname____doc__r-propertyr)r.r,rr3sG$$@@@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)_replacer parser=).0sections r, z*Sectioned.section_pairs..jsS  |'   4:gm#<#<  = =''''  r.)filter_)readvalid)clstexts r, section_pairszSectioned.section_pairshs5  88D#)8<<    r.Nc#4Kt|ttj|}d}|D]V}|do|d}|r|d}Dt||VWdS)N[]z[])filtermapstrstrip splitlines startswithendswithr )rGrClinesr)r= section_matchs r,rDzSectioned.readpswCIt/@/@ A ABB $ $E!,,S11IennS6I6IM {{4((tU## # # # #  $ $r.c2|o|d S)N#)rQ)lines r,rEzSectioned.valid{s0DOOC0000r.r0) r3r4r5r6textwrapdedentlstrip_sample classmethodrH staticmethodrDrEr8r.r,r:r:?s8ho    fhh   [ $$$\$11\111r.r:c\eZdZdZejejdee dZ 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.r) stacklevelc^|||Sr0)_warn_key)r+items r, __getitem__zDeprecatedTuple.__getitem__s" yy{{4  r.N) r3r4r5r6 functoolspartialwarningswarnDeprecationWarningr rbrer8r.r,r_r_s^   I  K<??    E!!!!!r.r_ceZdZUdZejdZ eed<eed<eed<dZ e ded<d Z d Z e d Ze d Ze d ZdZdZdZdZdZdZdZdZdS) 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)r=groupNrdistcPt||||dS)Nr)r=rmvarsupdate)r+r)r=rms 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.) patternmatchr=rrmrLsplitrfreducegetattr)r+r{rvattrss r,loadzEntryPoint.loadsw  ""4:..u{{84455tekk&117R>>sCCDD777r.cj|j|j}|dS)Nrvrzr{r=rmr+r{s r,rvzEntryPoint.modules+ ""4:..{{8$$$r.cj|j|j}|dS)Nrwrrs r,rwzEntryPoint.attrs+ ""4:..{{6"""r.c|j|j}tjd|dpdS)Nz\w+extrasrx)rzr{r=refindallrmrs r,rzEntryPoint.extrass< ""4:..z&%++h"7"7"=2>>>r.cLt|||S)Nrnrq)r+rns r,_forzEntryPoint._fors$ T t$$$ 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|VdSr0r~)r@paramr+s r,rBz%EntryPoint.matches..s-::%u%%::::::r.)allrMoperatoreqvalues)r+paramsrs` r,matcheszEntryPoint.matchessB(;:::6:::3x{FMMOOU;;<< ")))???888%%X%##X#??X?===.111***+++BBB   !!!!!r.rlczeZdZdZdZdZdZedZedZ e dZ e dZ d S) EntryPointszC An immutable collection of selectable EntryPoint objects. r8c tt||S#t$rt |wxYw)z; Get the EntryPoint in self matching name. r()nextiterselect StopIterationKeyErrorr2s r,rezEntryPoints.__getitem__sR !T[[d[334455 5 ! ! !4..  !s /2A c :tfd|DS)zv Select entry points from self that match the given parameters (typically group and/or name). c3@K|]}tj|fi|VdSr0)r ep_matches)r@eprs r,rBz%EntryPoints.select..)s;UU" 0Fr0T0TV0T0TU2UUUUUUr.)r)r+rs `r,rzEntryPoints.select$s( UUUUUUUUUUr.cd|DS)zB Return the set of all names of all entry points. ch|] }|j Sr8r(r@rs r, z$EntryPoints.names..0s'''B'''r.r8r*s r,nameszEntryPoints.names+s ('$''''r.cd|DS)zC Return the set of all groups of all entry points. ch|] }|j Sr8)rmrs r,rz%EntryPoints.groups..7s(((R(((r.r8r*s r,groupszEntryPoints.groups2s )(4((((r.cX|fd||DS)Nc3BK|]}|VdSr0)r)r@rrns r,rBz-EntryPoints._from_text_for..;s-@@R2774==@@@@@@r.) _from_text)rFrGrns `r,_from_text_forzEntryPoints._from_text_for9s4s@@@@3>>$+?+?@@@@@@r.cNdt|pdDS)Nc3lK|]/}t|jj|jj|jV0dS)rpN)rlr=r))r@rds r,rBz)EntryPoints._from_text..?sP   DJO4:3C49 U U U      r.rx)r:rH)rGs r,rzEntryPoints._from_text=s5  !// ;;    r.N)r3r4r5r6 __slots__rerr7rrr\rr]rr8r.r,rrsI!!!VVV((X( ))X) AA[A  \   r.rc&eZdZdZddZdZdZdS) PackagePathz"A reference to a path in a packageutf-8c||5}|cdddS#1swxYwYdS)NencodinglocateopenrD)r+rstreams r, read_textzPackagePath.read_textHs [[]]    2 2 !f;;== ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !sA  AAc|d5}|cdddS#1swxYwYdS)Nrbr)r+rs r, read_binaryzPackagePath.read_binaryLs [[]]   % % !;;== ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !sA  A A c6|j|S)z'Return a path-like object for this path)rn locate_filer*s r,rzPackagePath.locatePsy$$T***r.N)r)r3r4r5r6rrrr8r.r,rrEsL,,!!!!!!!+++++r.rceZdZdZdZdS)FileHashcL|d\|_}|_dS)N=) partitionmoder=)r+spec_s r,rtzFileHash.__init__Vs"#'>>##6#6  1djjjr.c(d|jd|jdS)Nz)rr=r*s r,rzFileHash.__repr__YsB$)BBTZBBBBr.N)r3r4r5rtrr8r.r,rrUs7777CCCCCr.rceZdZdZejdZejdZede 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. Nr8r+filenames r,rzDistribution.read_text`r.cdS)z[ Given a path to a file in this distribution, return a path to it. Nr8r+paths r,rzDistribution.locate_filehrr.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)rFr)s r, from_namezDistribution.from_nameosf 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|]}|VdSr0r8)r@resolverrs r,rBz(Distribution.discover..s>- - "*HHW  - - - - - - r.r8)poprrContext itertoolschain from_iterable_discover_resolvers)rFkwargsrs @r,rzDistribution.discovers**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.ats  T 2 2333r.cNdtjD}td|S)z#Search the meta_path for resolvers.c38K|]}t|ddVdS)find_distributionsNr)r@finders r,rBz3Distribution._discover_resolvers..s@  .make_filesH &&F,0:(4...dFK+3=#h---FKFKMr.cbtttj|Sr0)listrcsvreader)rSrs r, make_filesz&Distribution.files..make_filess% 3:e+<+<==>> >r.)NN)r_read_files_distinfo_read_files_egginfo)r+rrs` @r,r!zDistribution.filessv        ? ? ? ?  ?z$3355S9Q9Q9S9STTTr.cX|d}|o|S)z* Read the lines of RECORD RECORD)rrPrs r,rz!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"{}")rrMformatrPrs r,rz Distribution._read_files_egginfos6 ~~m,,=FM4??+<+<===r.ct|p|}|ot|S)z6Generated requirements specified for this Distribution)_read_dist_info_reqs_read_egg_info_reqsr)r+reqss r,r$zDistribution.requiress7((**Hd.F.F.H.H"T "r.c6|jdS)Nz Requires-Dist)r"get_allr*s r,r%z!Distribution._read_dist_info_reqss}$$_555r.cf|d}t|j|S)Nz requires.txt)rr_deps_from_requires_text)r+sources r,r&z Distribution._read_egg_info_reqss.//7y677???r.c\|t|Sr0)%_convert_egg_info_reqs_to_simple_reqsr:rD)rFr,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 == ""r8r(s r,make_conditionzJDistribution._convert_egg_info_reqs_to_simple_reqs..make_condition s00000 0r.c |pd}|d\}}}|r|rd|d}ttd||g}|rdd|zndS)Nrx:(rz; z and )rrrLjoin)rAextrasepmarkers conditionsr2s 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.  @r8)reqs r, url_req_spacezIDistribution._convert_egg_info_reqs_to_simple_reqs..url_req_spaces #*% %r.N)r=r))sectionsr;r@rAspacer2s @r,r.z2Distribution._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)r3r4r5r6abcabstractmethodrrr\rNrrr]rrr7rrr"r)rr%r r!rrr$r%r&r+r.r8r.r,rr]s"((       -S---[-"  [ "44\4&&\&B%/BBBXB %%X%--X-((X(TTXTUUXU0***>>>##X# 666@@@QQ[Q F F\ F F Fr.r) metaclassc`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||dSr0rq)r+rs r,rtz#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)rrgetrrr*s r,rzDistributionFinder.Context.path?s ::>>&#(33 3r.)r3r4r5r6r)rtr7rr8r.r,rrH*sT   & & &  4 4  4 4 4r.rcdS)z Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching the ``context``, a DistributionFinder.Context instance. Nr8)r+rs r,rz%DistributionFinder.find_distributionsJrr.N)r3r4r5r6rrCrDrr8r.r,rr%st44444444@ )0      r.rceZdZdZejfdZdZdZdZ dZ dZ e dZ ed ZxZS) FastPathzs Micro-optimized class for searching a path for children. >>> FastPath('').children() ['...'] cFt|Sr0)super__new__)rFroot __class__s r,rQzFastPath.__new__^swws###r.c||_dSr0)rR)r+rRs r,rtzFastPath.__init__bs  r.c6tj|j|Sr0)rrrR)r+childs r,joinpathzFastPath.joinpathes|DIu---r.ctt5tj|jpdcdddS#1swxYwYtt5|cdddS#1swxYwYgS)Nry)r ExceptionoslistdirrR zip_childrenr*s r,childrenzFastPath.childrenhs 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)r| posixpathr8)r@rVs r,rBz(FastPath.zip_children..ts7QQ%U[[::1=QQQQQQr.)rrrRnamelistrWdictfromkeys)r+zip_pathrs r,r\zFastPath.zip_childrenosQ9TY'' &&(( ) }}QQ5QQQQQQr.c\||j|Sr0)lookupmtimesearchr2s r,rhzFastPath.searchvs${{4:&&--d333r.ctt5tj|jjcdddS#1swxYwY|jdSr0)rOSErrorrZstatrRst_mtimerf cache_clearr*s r,rgzFastPath.mtimeys g   / /749%%. / / / / / / / / / / / / / / / / !!!!!sAAAc t|Sr0)Lookup)r+rgs r,rfzFastPath.lookupsd||r.)r3r4r5r6rf lru_cacherQrtrWr]r\rhr7rgrrf __classcell__rSs@r,rNrNUsY$$$$$...RRR444""X" \r.rNc eZdZdefdZdZdS)rorctj|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-inforyr-zegg-info)rZrbasenamerRlowerrRr rinfoseggsr] rpartitionrr r appendrWlegacy_normalizefreeze) r+rbase base_is_eggrVlowr) normalizedlegacy_normalizeds r,rtzLookup.__init__sw **0022mmF++ )$// (.. ]]__ J JE++--C||788 J~~c**1-77<X* , , , , ,r.rocReZdZdZdZdZdZedZedZ dZ dS)r zE A prepared search for metadata on a possibly-named package. Nc||_|dS|||_|||_dSr0)r)r rr}rr2s r,rtzPrepared.__init__sB < F....!%!6!6t!>#U+++r.ct|tjfdt t |DS)z1Find metadata directories in paths heuristically.c3BK|]}|VdSr0)rh)r@rrs r,rBz3MetadataPathFinder._search_paths..s@- - &*DKK ! !- - - - - - r.)r rrrrMrN)rFr)pathsrs @r,rz MetadataPathFinder._search_pathssZD>>,,- - - - .1(E.B.B- - -    r.cBtjdSr0)rNrQrm)rFs r,invalidate_cachesz$MetadataPathFinder.invalidate_cachess$$&&&&&r.N) r3r4r5r6rrrr\rrr8r.r,rrsm *<)C)C)E)E , , , ,  [ '''''r.rc~eZdZdefdZdZejje_dZe fdZ e dZ xZ S)rrc||_dS)zfConstruct a distribution. :param path: SimplePath indicating the metadata directory. N)_pathrs r,rtzPathDistribution.__init__s  r.ctttttt 5|j|dcdddS#1swxYwYdS)Nrr) rFileNotFoundErrorIsADirectoryErrorrNotADirectoryErrorPermissionErrorrrWrrs 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 Sr0)rparentrs r,rzPathDistribution.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. ) rZrrwrNrrr r _name_from_stemrPr)r+stemrSs r,rz!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') ruNrv)rZrsplitextr)rrextr)r8rests r,rz PathDistribution._name_from_stem sL((.. # 1 1 1 F",,S11c4 r.)r3r4r5rrtrrr6rr7rr]rrqrrs@r,rrsZMMM%.6I(((     X  \r.rc6t|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). )rrdistribution_names r,rrs  ! !"3 4 44r.c $tjdi|S)z|Get all ``Distribution`` instances in the current environment. :return: An iterable of ``Distribution`` instances. r8)rr)rs r,rr(s  * *6 * **r.rc@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. )rrr"rs r,r"r"0s  ! !"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%9s ) * * 22r.)keyc 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()). :return: EntryPoints for all installed packages. c3$K|] }|jV dSr0)r )r@rns r,rBzentry_points..Us6(("((((((r.r8)rrr_uniquerrr)repss r,r r Lsf / ' '((&-moo&>&>(((  C #;s   " , ,V , ,,r.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. )rr!rs r,r!r![s ) * * 00r.c*t|jS)z Return a list of requirements for the named package. :return: An iterator of requirements, suitable for packaging.requirement.Requirement. )rr$rs r,r$r$ds ) * * 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 defaultdictrr_top_level_declared_top_level_inferredr|r"rb) pkg_to_distrnpkgs r,r#r#ns)$//K;;&t,,I0CD0I0I ; ;C   # #DM&$9 : : : : ;   r.cT|dpdS)Nz top_level.txtrx)rr|rs r,rrs% NN? + + 1r 8 8 : ::r.c>dt|jDS)Nch|]L}|jdk t|jdkr |jdn|djMS)z.pyrrrx)suffixlenparts with_suffixr))r@fs r,rz&_top_level_inferred..sZ    8u  !'llQ&& AMM",=,=,B   r.)rr!rs r,rrs-   ,,   r.)NrZrrCrrrxrrrrrXrhrfrr`rrrr _collectionsr r _compatr r r _functoolsrr _itertoolsrrrr contextlibr importlibr importlib.abcrrtypingrrr__all__ModuleNotFoundErrorrr:r_rltupler PurePosixPathrrABCMetarrrNror rrrrr"r%rgnormalized_namerr r!r$rNr#rrr8r.r,rsL  ++++++++++44444444 0///////88888888........######((((((**********        .   >1>1>1>1>1>1>1>1B!!!!!!!!6v!v!v!v!v!v!v!v!r. . . . . %. . . b + + + + +'' + + + CCCCCCCCEFEFEFEFEFS[EFEFEFEFP- - - - - - - - `,,,,,,,,^!,!,!,!,!,!,!,!,HD '''''%7'' '>22222|222j555+++>5#8>>>>333 ) #    -k - - - -111444T#Y 7";;;r.