
    hƐ                    `   S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSKrSSKrSSKrSSKJrJr  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  S
SKJr  S
SKJrJ r   S
SK!J"r"J#r#  S
SK$J%r%J&r&  S
SK'J(r(J)r)J*r*  S
SKJ+r+J,r,  S
SK-J.r.  S
SK/J0r0J1r1  / SQr2 " S S\35      r4 " S S5      r5 " S S\Rl                  5      r7 " S S5      r8 " S S\95      r: " S S\
Rv                  5      r< " S  S!5      r= " S" S#\R|                  S$9r? " S% S&\5      r@ " S' S(5      rA " S) S*5      rB " S+ S,5      rC\# " S- S.\"\@5      5       rD " S/ S0\?5      rES>S1 jrFS?S2 jrGS@S3 jrHSAS4 jrI\R                  " \*\0R                  S59rL SBS6 jrMSCS7 jrNSDS8 jrOSES9 jrPS: rQSFS; jrRSGS< jrSS= rTg)Hz
APIs exposing metadata from third-party Python packages.

This codebase is shared between importlib.metadata in the stdlib
and importlib_metadata in PyPI. See
https://github.com/python/importlib_metadata/wiki/Development-Methodology
for more detail.
    )annotationsN)IterableMapping)suppress)import_module)MetaPathFinder)starmap)Any   )_meta)FreezableDefaultDictPair)
NullFinderinstall)method_cache	pass_none)always_iterablebucketunique_everseen)PackageMetadata
SimplePath)md_none)py39py311)DistributionDistributionFinderr   PackageNotFoundErrorr   distributiondistributionsentry_pointsfilesmetadatapackages_distributionsrequiresversionc                  6    \ rS rSrSrSS jr\SS j5       rSrg)r   =   zThe package was not found.c                     SU R                    3$ )Nz"No package metadata was found for nameselfs    S/var/www/auris/envauris/lib/python3.13/site-packages/importlib_metadata/__init__.py__str__PackageNotFoundError.__str__@   s    3DII;??    c                "    U R                   u  nU$ N)argsr,   r*   s     r-   r*   PackageNotFoundError.nameC   s    ))r0    Nreturnstr)	__name__
__module____qualname____firstlineno____doc__r.   propertyr*   __static_attributes__r6   r0   r-   r   r   =   s    $@  r0   r   c                      \ rS rSrSr\R                  " S5      R                  5       r\	S 5       r
\S	S j5       r\S
S j5       rSrg)	SectionedI   a8  
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
        c                B    S U R                  XR                  S9 5       $ )Nc              3     #    U  HA  nUR                   c  M  UR                  [        R                  " UR                  5      S9v   MC     g 7f)N)value)r*   _replacer   parserF   ).0sections     r-   	<genexpr>*Sectioned.section_pairs.<locals>.<genexpr>t   s;      
<|| >G4::gmm#<=<s
   A4A)filter_)readvalid)clstexts     r-   section_pairsSectioned.section_pairsr   s#    
88D))8<
 	
r0   Nc              #  &  #    [        U[        [        R                  U R	                  5       5      5      nS nU HS  nUR                  S5      =(       a    UR                  S5      nU(       a  UR                  S5      nMF  [        X45      v   MU     g 7f)N[]z[])filtermapr9   strip
splitlines
startswithendswithr   )rQ   rM   linesr*   rF   section_matchs         r-   rN   Sectioned.readz   so     wCIIt/@ ABE!,,S1IennS6IM{{4(t## s   BBc                @    U =(       a    U R                  S5      (       + $ )N#)r[   )lines    r-   rO   Sectioned.valid   s    0DOOC000r0   r6   r2   )rb   r9   )r:   r;   r<   r=   r>   textwrapdedentlstrip_sampleclassmethodrR   staticmethodrN   rO   r@   r6   r0   r-   rB   rB   I   sd    8 oo	
 fh  
 
 $ $ 1 1r0   rB   c                  4    \ rS rSr% S\S'   S\S'   S\S'   Srg)_EntryPointMatch   r9   moduleattrextrasr6   N)r:   r;   r<   r=   __annotations__r@   r6   r0   r-   rk   rk      s    K
IKr0   rk   c                  (   \ rS rSr% Sr\R                  " S5      r S\S'   S\S'   S\S'   Sr	S	\S
'   SS jr
SS jr\SS j5       r\SS j5       r\SS j5       r\R"                  SS j5       rS rS r\S 5       rS rS rS rS rS rS S jrSrg)!
EntryPoint   a|  An entry point as defined by Python packaging conventions.

See `the packaging docs on entry points
<https://packaging.python.org/specifications/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']

If the value package or module are not valid identifiers, a
ValueError is raised on access.

>>> EntryPoint(name=None, group=None, value='invalid-name').module
Traceback (most recent call last):
...
ValueError: ('Invalid object reference...invalid-name...
>>> EntryPoint(name=None, group=None, value='invalid-name').attr
Traceback (most recent call last):
...
ValueError: ('Invalid object reference...invalid-name...
>>> EntryPoint(name=None, group=None, value='invalid-name').extras
Traceback (most recent call last):
...
ValueError: ('Invalid object reference...invalid-name...

The same thing happens on construction.

>>> EntryPoint(name=None, group=None, value='invalid-name')
Traceback (most recent call last):
...
ValueError: ('Invalid object reference...invalid-name...

zH(?P<module>[\w.]+)\s*(:\s*(?P<attr>[\w.]+)\s*)?((?P<extras>\[.*\])\s*)?$r9   r*   rF   groupNzDistribution | Nonedistc                N    [        U 5      R                  XUS9  U R                    g )Nr*   rF   rt   )varsupdaterm   )r,   r*   rF   rt   s       r-   __init__EntryPoint.__init__   s     T
t>r0   c                    [        U R                  5      n[        SU R                  =(       d    SR	                  S5      5      n[
        R                  " [        X!5      $ )zLoad the entry point from its definition. If only a module
is indicated by the value, return that module. Otherwise,
return the named object.
N .)r   rm   rW   rn   split	functoolsreducegetattr)r,   rm   attrss      r-   loadEntryPoint.load   sD    
 t{{+tdiio244S9:77r0   c                .    U R                   R                  $ r2   )_matchrm   r+   s    r-   rm   EntryPoint.module   s    {{!!!r0   c                .    U R                   R                  $ r2   )r   rn   r+   s    r-   rn   EntryPoint.attr   s    {{r0   c                j    [         R                  " SU R                  R                  =(       d    S5      $ )Nz\w+r}   )refindallr   ro   r+   s    r-   ro   EntryPoint.extras   s"    zz&$++"4"4":;;r0   c                    U R                   R                  U R                  5      nU(       d  [        SU R                  5      e[	        S0 UR                  5       D6$ )NzlInvalid object reference. See https://packaging.python.org/en/latest/specifications/entry-points/#data-modelr6   )patternmatchrF   
ValueErrorrk   	groupdict)r,   r   s     r-   r   EntryPoint._match   sP    ""4::.E 

	   4%//"344r0   c                6    [        U 5      R                  US9  U $ )Nru   rx   ry   )r,   ru   s     r-   _forEntryPoint._for   s    T
t$r0   c                   ^  T R                  U5        U 4S jU 5       n[        [        [        R                  UR                  5       U5      5      $ )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
c              3  <   >#    U  H  n[        TU5      v   M     g 7fr2   r   )rI   paramr,   s     r-   rK   %EntryPoint.matches.<locals>.<genexpr>  s     :6%u%%6s   )_disallow_distallrX   operatoreqvalues)r,   paramsr   s   `  r-   matchesEntryPoint.matches   s;    ( 	F#:6:3x{{FMMOU;<<r0   c                &    SU ;   a  [        S5      eg)z
Querying by dist is not allowed (dist objects are not comparable).
>>> EntryPoint(name='fan', value='fav', group='fag').matches(dist='foo')
Traceback (most recent call last):
...
ValueError: "dist" is not suitable for matching...
ru   zo"dist" is not suitable for matching. Instead, use Distribution.entry_points.select() on a located distribution.N)r   )r   s    r-   r   EntryPoint._disallow_dist  s#     V(  r0   c                H    U R                   U R                  U R                  4$ r2   rw   r+   s    r-   _keyEntryPoint._key%  s    yy$**djj00r0   c                D    U R                  5       UR                  5       :  $ r2   r   r,   others     r-   __lt__EntryPoint.__lt__(  s    yy{UZZ\))r0   c                D    U R                  5       UR                  5       :H  $ r2   r   r   s     r-   __eq__EntryPoint.__eq__+  s    yy{ejjl**r0   c                    [        S5      e)Nz!EntryPoint objects are immutable.)AttributeError)r,   r*   rF   s      r-   __setattr__EntryPoint.__setattr__.  s    @AAr0   c                \    SU R                   < SU R                  < SU R                  < S3$ )NzEntryPoint(name=z, value=z, group=)rw   r+   s    r-   __repr__EntryPoint.__repr__1  s2    tyym8DJJ> BZZN!%	
r0   c                4    [        U R                  5       5      $ r2   )hashr   r+   s    r-   __hash__EntryPoint.__hash__7  s    DIIK  r0   r6   )r*   r9   rF   r9   rt   r9   r8   None)r8   r
   r7   r8   z	list[str])r8   rk   )r8   int)r:   r;   r<   r=   r>   r   compiler   rp   ru   rz   r   r?   rm   rn   ro   r   cached_propertyr   r   r   ri   r   r   r   r   r   r   r   r@   r6   r0   r-   rr   rr      s    &P jj	%G
  IJJ $D
$8 " "     < < 	5 	5=0  1*+B
!r0   rr   c                  ~    \ rS rSrSrSrSS jrS rSS jr\	SS j5       r
\	SS j5       r\S	 5       r\S
 5       rSrg)EntryPointsi;  z;
An immutable collection of selectable EntryPoint objects.
r6   c                x     [        [        U R                  US95      5      $ ! [         a    [	        U5      ef = f)z+
Get the EntryPoint in self matching name.
r)   )nextiterselectStopIterationKeyErrorr4   s     r-   __getitem__EntryPoints.__getitem__B  s;    	!T[[d[3455 	!4. 	!s    # 9c                P    U R                   R                  < S[        U 5      < S3$ )zb
Repr with classname and tuple constructor to
signal that we deviate from regular tuple behavior.
(r   )	__class__r:   tupler+   s    r-   r   EntryPoints.__repr__K  s    
  >>22E$K@@r0   c                .   ^ [        U4S jU  5       5      $ )z^
Select entry points from self that match the
given parameters (typically group and/or name).
c              3  d   >#    U  H%  n[         R                  " U40 TD6(       d  M!  Uv   M'     g 7fr2   )r   
ep_matches)rI   epr   s     r-   rK   %EntryPoints.select.<locals>.<genexpr>W  s#     N"0Mf0M22s    0	0)r   )r,   r   s    `r-   r   EntryPoints.selectR  s    
 NNNNr0   c                D    U  Vs1 s H  oR                   iM     sn$ s  snf )z2
Return the set of all names of all entry points.
r)   r,   r   s     r-   namesEntryPoints.namesY  s    
 #''$B$'''   c                D    U  Vs1 s H  oR                   iM     sn$ s  snf )z3
Return the set of all groups of all entry points.
)rt   r   s     r-   groupsEntryPoints.groups`  s    
 $((4R4(((r   c                F   ^ U " U4S jU R                  U5       5       5      $ )Nc              3  D   >#    U  H  oR                  T5      v   M     g 7fr2   )r   )rI   r   ru   s     r-   rK   -EntryPoints._from_text_for.<locals>.<genexpr>i  s     @+?R774==+?    )
_from_text)rP   rQ   ru   s     `r-   _from_text_forEntryPoints._from_text_forg  s    @3>>$+?@@@r0   c                L    S [         R                  U =(       d    S5       5       $ )Nc              3     #    U  HB  n[        UR                  R                  UR                  R                  UR                  S 9v   MD     g7f)rw   N)rr   rF   r*   )rI   items     r-   rK   )EntryPoints._from_text.<locals>.<genexpr>m  s6      
; DJJOO4::3C3C499U;s   A
Ar}   )rB   rR   )rQ   s    r-   r   EntryPoints._from_textk  s#    
!//
;
 	
r0   N)r*   r9   r8   rr   r8   r   )r8   zset[str])r:   r;   r<   r=   r>   	__slots__r   r   r   r?   r   r   rh   r   ri   r   r@   r6   r0   r-   r   r   ;  sq     I!AO ( ( ) ) A A 
 
r0   r   c                  Z    \ rS rSr% SrS\S'   S\S'   S\S'   SSS	 jjrSS
 jrSS jrSr	g)PackagePathis  z"A reference to a path in a packagezFileHash | Noner   r   sizer   ru   c                <    U R                  5       R                  US9$ )Nencoding)locate	read_text)r,   r   s     r-   r   PackagePath.read_textz  s    {{}&&&99r0   c                >    U R                  5       R                  5       $ r2   )r   
read_bytesr+   s    r-   read_binaryPackagePath.read_binary}  s    {{}''))r0   c                8    U R                   R                  U 5      $ )z'Return a path-like object for this path)ru   locate_filer+   s    r-   r   PackagePath.locate  s    yy$$T**r0   r6   N)utf-8)r   r9   r8   r9   )r8   bytes)r8   r   )
r:   r;   r<   r=   r>   rp   r   r   r   r@   r6   r0   r-   r   r   s  s%    ,

I
:*+r0   r   c                  (    \ rS rSrSS jrSS jrSrg)FileHashi  c                @    UR                  S5      u  U l        o l        g )N=)	partitionmoderF   )r,   spec_s      r-   rz   FileHash.__init__  s    #'>>##6 	1jr0   c                <    SU R                    SU R                   S3$ )Nz<FileHash mode: z value: >r  rF   r+   s    r-   r   FileHash.__repr__  s    !$))HTZZLBBr0   r  N)r	  r9   r8   r   r7   )r:   r;   r<   r=   rz   r   r@   r6   r0   r-   r  r    s    7Cr0   r  c                     \ rS rSrSr\R                  SS j5       r\R                  SS j5       r\	S S j5       r
\	SS.   S!S jj5       r\S"S	 j5       r\S#S
 j5       r\S 5       r\S$S j5       r\\S%S j5       5       r\S&S j5       r\S 5       r\S&S j5       r\S'S j5       r\S(S j5       rS rS rS r\S)S j5       rS rS r\	S 5       r\S 5       r \S 5       r!S r"Sr#g)*r   i  a*  
An abstract Python distribution package.

Custom providers may derive from this class and define
the abstract methods to provide a concrete implementation
for their environment. Some providers may opt to override
the default implementation of some properties to bypass
the file-reading mechanism.
c                    g)a`  Attempt to load metadata file given by the name.

Python distribution metadata is organized by blobs of text
typically represented as "files" in the metadata directory
(e.g. package-1.0.dist-info). These files include things
like:

- METADATA: The distribution metadata including fields
  like Name and Version and Description.
- entry_points.txt: A series of entry points as defined in
  `the entry points spec <https://packaging.python.org/en/latest/specifications/entry-points/#file-format>`_.
- RECORD: A record of files according to
  `this recording spec <https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file>`_.

A package may provide any set of files, including those
not listed here or none at all.

:param filename: The name of the file in the distribution info.
:return: The text if found, otherwise None.
Nr6   r,   filenames     r-   r   Distribution.read_text      r0   c                    g)a)  
Given a path to a file in this distribution, return a SimplePath
to it.

This method is used by callers of ``Distribution.files()`` to
locate files within the distribution. If it's possible for a
Distribution to represent files in the distribution as
``SimplePath`` objects, it should implement this method
to resolve such objects.

Some Distribution providers may elect not to resolve SimplePath
objects within the distribution by raising a
NotImplementedError, but consumers of such a Distribution would
be unable to invoke ``Distribution.files()``.
Nr6   r,   paths     r-   r   Distribution.locate_file  r  r0   c           
         U(       d  [        S5      e [        [        U R                  U R	                  US95      5      5      $ ! [
         a    [        U5      ef = f)av  Return 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)   )r   r   r   _prefer_validdiscoverr   r   )rP   r*   s     r-   	from_nameDistribution.from_name  sX     ?@@	-S..s|||/FGHII 	-&t,,	-s   /A AN)contextc                  ^ T(       a  U(       a  [        S5      eT=(       d    [        R                  " S0 UD6m[        R                  R                  U4S jU R                  5        5       5      $ )a
  Return 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 packages matching
  the context.
z cannot accept context and kwargsc              3  2   >#    U  H  o" T5      v   M     g 7fr2   r6   )rI   resolverr  s     r-   rK   (Distribution.discover.<locals>.<genexpr>  s      -
.G(HW.Gs   r6   )r   r   Context	itertoolschainfrom_iterable_discover_resolvers)rP   r  kwargss    ` r-   r  Distribution.discover  s\     v?@@A/77A&A,, -
.1.E.E.G-
 
 	
r0   c                V    [        U S 5      n[        R                  " US   US   5      $ )zc
Prefer (move to the front) distributions that have metadata.

Ref python/importlib_resources#489.
c                ,    [        U R                  5      $ r2   )boolr"   r   s    r-   <lambda>,Distribution._prefer_valid.<locals>.<lambda>  s    T$---@r0   TF)r   r%  r&  )distsbucketss     r-   r  Distribution._prefer_valid  s*      @Awt}gen==r0   c                @    [        [        R                  " U 5      5      $ )zReturn a Distribution for the indicated metadata path.

:param path: a string or path-like object
:return: a concrete Distribution instance for the path
)PathDistributionpathlibPathr  s    r-   atDistribution.at  s      T 233r0   c                 H    S [         R                   5       n [        SU 5      $ )z9Search the meta_path for resolvers (MetadataPathFinders).c              3  <   #    U  H  n[        US S5      v   M     g7f)find_distributionsNr   )rI   finders     r-   rK   3Distribution._discover_resolvers.<locals>.<genexpr>  s       
FSFGF0$77ms   N)sys	meta_pathrW   )declareds    r-   r(   Distribution._discover_resolvers  s$    
FImm
 dH%%r0   c                    U R                  S5      =(       d)    U R                  S5      =(       d    U R                  S5      nU R                  U5      $ )aF  Return the parsed metadata for this Distribution.

The returned object will have keys that name the various bits of
metadata per the
`Core metadata specifications <https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata>`_.

Custom providers may provide the METADATA file or override this
property.
METADATAzPKG-INFOr}   )r   _assemble_messager,   rQ   s     r-   r"   Distribution.metadata  sL     NN:& "~~j)"
 ~~b! 	 %%d++r0   c                X    SSK Jn  UR                  [        R                  " U 5      5      $ )Nr   )	_adapters)r}   rI  Messageemailmessage_from_string)rQ   rI  s     r-   rE  Distribution._assemble_message  s#     	   !:!:4!@AAr0   c                2    [        U R                  5      S   $ )z8Return the 'Name' metadata for the distribution package.Namer   r"   r+   s    r-   r*   Distribution.name   s     t}}%f--r0   c                @    [         R                  U R                  5      $ )z(Return a normalized version of the name.)Prepared	normalizer*   r+   s    r-   _normalized_nameDistribution._normalized_name%  s     !!$)),,r0   c                2    [        U R                  5      S   $ )z;Return the 'Version' metadata for the distribution package.VersionrP  r+   s    r-   r%   Distribution.version*  s     t}}%i00r0   c                L    [         R                  U R                  S5      U 5      $ )z
Return EntryPoints for this distribution.

Custom providers may provide the ``entry_points.txt`` file
or override this property.
zentry_points.txt)r   r   r   r+   s    r-   r    Distribution.entry_points/  s!     ))$..9K*LdSSr0   c                   ^ ^ SU 4S jjm[         U4S j5       n[         S 5       nU" U" T R                  5       =(       d'    T R                  5       =(       d    T R                  5       5      5      $ )a  Files 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 installed-files.txt or
SOURCES.txt for egg-info) is missing.
Result may be empty if the metadata exists but is empty.

Custom providers are recommended to provide a "RECORD" file (in
``read_text``) or override this property to allow for callers to be
able to resolve filenames provided by the package.
c                   > [        U 5      nU(       a  [        U5      OS Ul        U(       a  [        U5      OS Ul        TUl        U$ r2   )r   r  r   r   r   ru   )r*   r   size_strresultr,   s       r-   	make_file%Distribution.files.<locals>.make_fileI  s7     &F,0(4.dFK+3#h-FKFKMr0   c                B   > SS K n[        TUR                  U 5      5      $ )Nr   )csvr	   reader)r]   rc  r`  s     r-   
make_files&Distribution.files.<locals>.make_filesP  s     9cjj&788r0   c                .    [        [        S U 5      5      $ )Nc                >    U R                  5       R                  5       $ r2   )r   existsr7  s    r-   r.  @Distribution.files.<locals>.skip_missing_files.<locals>.<lambda>Z  s    DKKM,@,@,Br0   )listrW   )package_pathss    r-   skip_missing_files.Distribution.files.<locals>.skip_missing_filesX  s    BMRSSr0   )NN)r   _read_files_distinfo_read_files_egginfo_installed_read_files_egginfo_sources)r,   re  rm  r`  s   `  @r-   r!   Distribution.files9  sw     	 
	9 
	9 
	T 
	T "))+ 65576335
 	
r0   c                V    U R                  S5      nU=(       a    UR                  5       $ )z
Read the lines of RECORD.
RECORD)r   rZ   rF  s     r-   ro  !Distribution._read_files_distinfod  s$     ~~h')))r0   c                   ^ ^ T R                  S5      n[        T SS5      mU(       a  T(       d  gU U4S jUR                  5        5       n[        SR                  U5      $ )a  
Read installed-files.txt and return lines in a similar
CSV-parsable format as RECORD: each file must be placed
relative to the site-packages directory and must also be
quoted (since file names can contain literal commas).

This file is written when the package is installed by pip,
but it might not be written for other installation methods.
Assume the file is accurate if it exists.
zinstalled-files.txt_pathNc              3     >#    U  He  n[         R                  " TU-  R                  5       5      R                  TR	                  S 5      R                  5       SS9R                  5       v   Mg     g7f)r}   T)walk_upN)r   relative_fixresolverelative_tor   as_posix)rI   r*   r,   subdirs     r-   rK   =Distribution._read_files_egginfo_installed.<locals>.<genexpr>~  sb      
 * 6689[))"-557[FXZ *s   A-A0"{}")r   r   rZ   rX   format)r,   rQ   pathsr~  s   `  @r-   rp  *Distribution._read_files_egginfo_installedk  sW     ~~34 w-6
 )	
 6==%((r0   c                ~    U R                  S5      nU=(       a$    [        SR                  UR                  5       5      $ )a  
Read SOURCES.txt and return lines in a similar CSV-parsable
format as RECORD: each file name must be quoted (since it
might contain literal commas).

Note that SOURCES.txt is not a reliable source for what
files are installed by a package. This file is generated
for a source archive, and the files that are present
there (e.g. setup.py) may not correctly reflect the files
that are present after the package has been installed.
zSOURCES.txtr  )r   rX   r  rZ   rF  s     r-   rq  (Distribution._read_files_egginfo_sources  s/     ~~m,=FMM4??+<==r0   c                x    U R                  5       =(       d    U R                  5       nU=(       a    [        U5      $ )z6Generated requirements specified for this Distribution)_read_dist_info_reqs_read_egg_info_reqsrk  )r,   reqss     r-   r$   Distribution.requires  s/     ((*Hd.F.F.H"T
"r0   c                8    U R                   R                  S5      $ )NzRequires-Dist)r"   get_allr+   s    r-   r  !Distribution._read_dist_info_reqs  s    }}$$_55r0   c                Z    U R                  S5      n[        U R                  5      " U5      $ )Nzrequires.txt)r   r   _deps_from_requires_text)r,   sources     r-   r   Distribution._read_egg_info_reqs  s&    /667??r0   c                J    U R                  [        R                  U5      5      $ r2   )%_convert_egg_info_reqs_to_simple_reqsrB   rN   )rP   r  s     r-   r  %Distribution._deps_from_requires_text  s    889OPPr0   c              #     ^#    S mU4S jnS nU  H9  nU" UR                   5      nUR                   U-   U" UR                  5      -   v   M;     g7f)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                     U =(       a    SU  S3$ )Nz
extra == ""r6   r)   s    r-   make_conditionJDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.make_condition  s    0ja00r0   c           	        > U =(       d    Sn U R                  S5      u  pnU(       a  U(       a  SU S3n[        [        S UT" U5      /5      5      nU(       a  SSR                  U5      -   $ S$ )Nr}   :r   r   z; z and )r  rk  rW   join)rJ   extrasepmarkers
conditionsr  s        r-   quoted_markerIDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.quoted_marker  si    mG")"3"3C"8EgYa.fTG^E5J+KLMJ6@4',,z22HbHr0   c                    SSU ;   -  $ )zi
PEP 508 requires a space between the url_spec and the quoted_marker.
Ref python/importlib_metadata#357.
 @r6   )reqs    r-   url_req_spaceIDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.url_req_space  s     #*%%r0   N)rF   r*   )sectionsr  r  rJ   spacer  s        @r-   r  2Distribution._convert_egg_info_reqs_to_simple_reqs  sM     	1	I	&  G!'--0E--%'-*EEE  s   AAc                $    U R                  S5      $ )Nzdirect_url.json)
_load_jsonr+   s    r-   originDistribution.origin  s    011r0   c                ^    SS K n[        UR                  5      " U R                  U5      S S9$ )Nr   c                .    [         R                  " S0 U D6$ )Nr6   )typesSimpleNamespace)datas    r-   r.  )Distribution._load_json.<locals>.<lambda>  s    U%:%:%BT%Br0   )object_hook)jsonr   loadsr   )r,   r  r  s      r-   r  Distribution._load_json  s*    $NN8$B
 	
r0   r6   )r8   
str | Noner  str | os.PathLike[str]r8   r   )r*   r9   r8   r   )r  z!DistributionFinder.Context | Noner8   Iterable[Distribution])r0  r  r8   r  )r  r  r8   r   )r8   _meta.PackageMetadata | None)rQ   r9   r8   z_meta.PackageMetadatar7   r   )r8   list[PackagePath] | None)r8   list[str] | None)$r:   r;   r<   r=   r>   abcabstractmethodr   r   rh   r  r  ri   r  r8  r(  r?   r"   r   rE  r*   rU  r%   r    r!   ro  rp  rq  r$   r  r  r  r  r  r  r@   r6   r0   r-   r   r     s    	 , 	 " - -" =A
:
	
 
& > > 4 4 & & , ,* B  B . . - - 1 1 T T (
 (
T*)6> # #
6@ Q Q  F  FD 2 2
r0   r   )	metaclassc                  d    \ rS rSrSr " S S5      r\R                  \" 5       4SS jj5       rSr	g)	r   i  z
A MetaPathFinder capable of discovering installed distributions.

Custom providers should implement this interface in order to
supply metadata.
c                  8    \ rS rSrSrSr S r\SS j5       rSr	g)zDistributionFinder.Contexti  a  
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.

This mechanism gives a custom provider a means to
solicit additional details from the caller beyond
"name" and "path" when searching distributions.
For example, imagine a provider that exposes suites
of packages in either a "public" or "private" ``realm``.
A caller may wish to query only for distributions in
a particular realm and could call
``distributions(realm="private")`` to signal to the
custom provider to only include distributions from that
realm.
Nc                8    [        U 5      R                  U5        g r2   r   )r,   r)  s     r-   rz   #DistributionFinder.Context.__init__  s    Jf%r0   c                T    [        U 5      R                  S[        R                  5      $ )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  )rx   getr?  r  r+   s    r-   r  DistributionFinder.Context.path  s     :>>&#((33r0   r6   r   )
r:   r;   r<   r=   r>   r*   rz   r?   r  r@   r6   r0   r-   r$  DistributionFinder.Context  s,    	, 	
	& 
	4 
	4r0   r$  c                    g)z
Find distributions.

Return an iterable of all Distribution instances capable of
loading the metadata for packages matching the ``context``,
a DistributionFinder.Context instance.
Nr6   )r,   r  s     r-   r<  %DistributionFinder.find_distributions
  r  r0   r6   Nr8   r  )
r:   r;   r<   r=   r>   r$  r  r  r<  r@   r6   r0   r-   r   r     s1    )4 )4V 	)0  r0   r   c                     ^  \ rS rSrSr\R                  " 5       U 4S j5       rS rS r	S r
S rS r\S	 5       r\S
 5       rSrU =r$ )FastPathi  aM  
Micro-optimized class for searching a root for children.

Root is a path on the file system that may contain metadata
directories either as natural directories or within a zip file.

>>> FastPath('').children()
['...']

FastPath objects are cached and recycled for any given root.

>>> FastPath('foobar') is FastPath('foobar')
True
c                "   > [         TU ]  U 5      $ r2   )super__new__)rP   rootr   s     r-   r  FastPath.__new__%  s    ws##r0   c                    Xl         g r2   )r  )r,   r  s     r-   rz   FastPath.__init__)  s    	r0   c                D    [         R                  " U R                  U5      $ r2   )r5  r6  r  )r,   childs     r-   joinpathFastPath.joinpath,  s    ||DIIu--r0   c                   [        [        5         [        R                  " U R                  =(       d    S5      sS S S 5        $ ! , (       d  f       O= f[        [        5         U R                  5       sS S S 5        $ ! , (       d  f       / $ = fNr~   )r   	Exceptionoslistdirr  zip_childrenr+   s    r-   childrenFastPath.children/  sP    i ::dii.3/ !  i $$& !  	s   )A
A#A==
Bc                    SSK Jn  UR                  U R                  5      nUR                  R	                  5       nUR
                  U l        [        R                  S U 5       5      $ )Nr   )zipfilec              3  f   #    U  H'  oR                  [        R                  S 5      S   v   M)     g7f)r   r   N)r   	posixpathr  )rI   r  s     r-   rK   (FastPath.zip_children.<locals>.<genexpr>>  s"     Q5%[[:1=5s   /1)zipp.compat.overlayr  r6  r  namelistr  dictfromkeys)r,   r  zip_pathr   s       r-   r  FastPath.zip_children6  sK    /<<		*&&( ))}}Q5QQQr0   c                V    U R                  U R                  5      R                  U5      $ r2   )lookupmtimesearchr4   s     r-   r  FastPath.search@  s     {{4::&--d33r0   c                    [        [        5         [        R                  " U R                  5      R
                  sS S S 5        $ ! , (       d  f       O= fU R                  R                  5         g r2   )r   OSErrorr  statr  st_mtimer  cache_clearr+   s    r-   r  FastPath.mtimeC  s<    g77499%.. !s   *A
Ac                    [        U 5      $ r2   )Lookup)r,   r  s     r-   r  FastPath.lookupI  s    d|r0   )r  r  )r:   r;   r<   r=   r>   r   	lru_cacher  rz   r  r  r  r  r?   r  r   r  r@   __classcell__r   s   @r-   r  r    sg     $ $.R4 " "
  r0   r  c                  ,    \ rS rSrSrSS jrSS jrSrg)	r  iN  zC
A micro-optimized class for searching a (fast) path for metadata.
c                   [         R                  R                  UR                  5      R	                  5       nUR                  S5      n[        [        5      U l        [        [        5      U l	        UR                  5        GH  nUR	                  5       nUR                  S5      (       aj  UR                  S5      S   R                  S5      S   n[        R                  U5      nU R                  U   R                  UR!                  U5      5        M  U(       d  M  US:X  d  M  UR                  S5      S   R                  S5      S   n[        R#                  U5      nU R                  U   R                  UR!                  U5      5        GM     U R                  R%                  5         U R                  R%                  5         g)z
Calculate all of the children representing metadata.

From the children in the path, calculate early all of the
children that appear to represent metadata (infos) or legacy
metadata (eggs).
z.eggz
.dist-infoz	.egg-infor~   r   -zegg-infoN)r  r  basenamer  lowerr\   r   rk  infoseggsr  
rpartitionr  rS  rT  appendr  legacy_normalizefreeze)	r,   r  basebase_is_eggr  lowr*   
normalizedlegacy_normalizeds	            r-   rz   Lookup.__init__S  sL    ww		*002mmF+)$/
(.	]]_E++-C||788~~c*1-77<Q?%//5


:&--dmmE.BC
!2s+A.88=a@$,$=$=d$C!		+,33DMM%4HI % 	

		r0   c                   U(       a  U R                   UR                     O6[        R                  R	                  U R                   R                  5       5      nU(       a  U R                  UR                     O6[        R                  R	                  U R                  R                  5       5      n[        R                  " X#5      $ )z7
Yield all infos and eggs matching the Prepared query.
)r  r  r%  r&  r'  r   r  r  )r,   preparedr  r  s       r-   r  Lookup.searchp  s      JJx**+..tzz/@/@/BC 	  IIh001..tyy/?/?/AB 	
 u++r0   )r  r  N)r  r  )r  rS  )r:   r;   r<   r=   r>   rz   r  r@   r6   r0   r-   r  r  N  s    :,r0   r  c                  P    \ rS rSrSrSrSrS	S jr\S 5       r	\S 5       r
S rSrg)
rS  i  a  
A prepared search query for metadata on a possibly-named package.

Pre-calculates the normalization to prevent repeated operations.

>>> none = Prepared(None)
>>> none.normalized
>>> none.legacy_normalized
>>> bool(none)
False
>>> sample = Prepared('Sample__Pkg-name.foo')
>>> sample.normalized
'sample_pkg_name_foo'
>>> sample.legacy_normalized
'sample__pkg_name.foo'
>>> bool(sample)
True
Nc                p    Xl         Uc  g U R                  U5      U l        U R                  U5      U l        g r2   )r*   rT  r  r
  r  r4   s     r-   rz   Prepared.__init__  s2    	<...!%!6!6t!<r0   c                n    [         R                  " SSU 5      R                  5       R                  SS5      $ )z3
PEP 503 normalization plus dashes as underscores.
z[-_.]+r  r
  )r   subr  replacer)   s    r-   rT  Prepared.normalize  s-    
 vvid+113;;CEEr0   c                B    U R                  5       R                  SS5      $ )zd
Normalize the package name as found in the convention in
older packaging tools versions and specs.
r  r
  )r  r  r)   s    r-   r
  Prepared.legacy_normalize  s     zz|##C--r0   c                ,    [        U R                  5      $ r2   )r-  r*   r+   s    r-   __bool__Prepared.__bool__  s    DIIr0   )r  r*   r  )r*   r  )r:   r;   r<   r=   r>   r  r  rz   ri   rT  r
  r  r@   r6   r0   r-   rS  rS    sH    & J= F F . .r0   rS  c                  t    \ rS rSrSr\\R                  5       4 SS jj5       r\S 5       r	\S	S j5       r
Srg)
MetadataPathFinderi  zA degenerate finder for distribution packages on the file system.

This finder supplies only a find_distributions() method for versions
of Python that do not have a PathFinder find_distributions().
c                n    U R                  UR                  UR                  5      n[        [        U5      $ )z
Find distributions.

Return an iterable of all Distribution instances capable of
loading the metadata for packages matching ``context.name``
(or all names if ``None`` indicated) along the paths in the list
of directories ``context.path``.
)_search_pathsr*   r  rX   r4  )rP   r  founds      r-   r<  %MetadataPathFinder.find_distributions  s,     !!',,=#U++r0   c                   ^ [        U5      m[        R                  R                  U4S j[	        [
        U5       5       5      $ )z1Find metadata directories in paths heuristically.c              3  D   >#    U  H  oR                  T5      v   M     g 7fr2   )r  )rI   r  r  s     r-   rK   3MetadataPathFinder._search_paths.<locals>.<genexpr>  s      -
.BdKK!!.Br   )rS  r%  r&  r'  rX   r  )rP   r*   r  r  s      @r-   r$   MetadataPathFinder._search_paths  s9     D>,, -
.1(E.B-
 
 	
r0   c                @    [         R                  R                  5         g r2   )r  r  r  )rP   s    r-   invalidate_caches$MetadataPathFinder.invalidate_caches  s    $$&r0   r6   N)r8   zIterable[PathDistribution])r8   r   )r:   r;   r<   r=   r>   rh   r   r$  r<  r$  r,  r@   r6   r0   r-   r"  r"    sW     '//1,	#, , 
 
 ' 'r0   r"  c                     ^  \ rS rSrSS jrS	S jr\R
                  R                  \l        S
S jr\	U 4S j5       r
\S 5       rSrU =r$ )r4  i  c                    Xl         g)zVConstruct a distribution.

:param path: SimplePath indicating the metadata directory.
Nrw  r  s     r-   rz   PathDistribution.__init__  s	    
 
r0   c                    [        [        [        [        [        [
        5         U R                  R                  U5      R                  SS9sS S S 5        $ ! , (       d  f       g = f)Nr  r   )	r   FileNotFoundErrorIsADirectoryErrorr   NotADirectoryErrorPermissionErrorrw  r  r   r  s     r-   r   PathDistribution.read_text  sP    
 ::&&x0::G:L
 
 
 s   (A
A$c                4    U R                   R                  U-  $ r2   )rw  parentr  s     r-   r   PathDistribution.locate_file  s    zz  4''r0   c                   > [         R                  R                  [        U R                  5      5      n[        [        R                  5      " U R                  U5      5      =(       d
    [        TU ](  $ )zb
Performance optimization: where possible, resolve the
normalized name from the file system path.
)r  r  r  r9   rw  r   rS  rT  _name_from_stemr  rU  )r,   stemr   s     r-   rU  !PathDistribution._normalized_name  sQ     wwDJJ0h(()$*>*>t*DE (w'	
r0   c                ~    [         R                  R                  U 5      u  pUS;  a  gUR                  S5      u  p4nU$ )z
>>> 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')
r  Nr  )r  r  splitextr  )r=  r  extr*   r  rests         r-   r<   PathDistribution._name_from_stem  s?     ((.11",,S14r0   r0  )r  r   r8   r   )r  r  r8   r  r  )r:   r;   r<   r=   rz   r   r   r>   r   r?   rU  ri   r<  r@   r  r  s   @r-   r4  r4    sP    
 %..66I( 	
 	
  r0   r4  c                ,    [         R                  U 5      $ )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).
)r   r  distribution_names    r-   r   r     s     !!"344r0   c                 .    [         R                  " S0 U D6$ )ztGet all ``Distribution`` instances in the current environment.

:return: An iterable of ``Distribution`` instances.
r6   )r   r  )r)  s    r-   r   r     s    
   *6**r0   c                @    [         R                  U 5      R                  $ )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.
)r   r  r"   rE  s    r-   r"   r"     s     !!"34===r0   c                ,    [        U 5      R                  $ )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.
)r   r%   rE  s    r-   r%   r%   '  s     )*222r0   )keyc                     [         R                  R                  S [        [	        5       5       5       5      n[        U5      R                  " S0 U D6$ )zReturn 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.
c              3  8   #    U  H  oR                   v   M     g 7fr2   )r    )rI   ru   s     r-   rK   entry_points.<locals>.<genexpr>C  s      (&>d&>s   r6   )r%  r&  r'  _uniquer   r   r   )r   epss     r-   r    r    :  sG     //
'
' (&-mo&>( C s"",V,,r0   c                ,    [        U 5      R                  $ )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.
)r   r!   rE  s    r-   r!   r!   I  s     )*000r0   c                ,    [        U 5      R                  $ )z
Return a list of requirements for the named package.

:return: An iterable of requirements, suitable for
    packaging.requirement.Requirement.
)r   r$   rE  s    r-   r$   r$   R  s     )*333r0   c                    [         R                  " [        5      n [        5        HP  n[	        U5      =(       d    [        U5       H,  nX   R                  [        UR                  5      S   5        M.     MR     [        U 5      $ )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
rO  )
collectionsdefaultdictrk  r   _top_level_declared_top_level_inferredr	  r   r"   r  )pkg_to_distru   pkgs      r-   r#   r#   \  sj     ))$/K&t,I0CD0IIC##GDMM$:6$BC J   r0   c                R    U R                  S5      =(       d    SR                  5       $ )Nztop_level.txtr}   )r   r   r   s    r-   rU  rU  m  s    NN?+1r88::r0   c                2    U R                   tpU(       a  U$ S$ )z:
Return the top-most parent as long as there is a parent.
N)parts)r*   toprB  s      r-   _topmostr]  q  s     JC3 D r0   c                t    SSK n[        U 5      =(       d#    UR                  U 5      =(       d    [        U 5      $ )a  
Infer a possibly importable module name from a name presumed on
sys.path.

>>> _get_toplevel_name(PackagePath('foo.py'))
'foo'
>>> _get_toplevel_name(PackagePath('foo'))
'foo'
>>> _get_toplevel_name(PackagePath('foo.pyc'))
'foo'
>>> _get_toplevel_name(PackagePath('foo/__init__.py'))
'foo'
>>> _get_toplevel_name(PackagePath('foo.pth'))
'foo.pth'
>>> _get_toplevel_name(PackagePath('foo.dist-info'))
'foo.dist-info'
r   N)inspectr]  getmodulenamer9   )r*   r_  s     r-   _get_toplevel_namera  y  s*    & D>EW2248ECIEr0   c                v    [        [        [        [        U R                  5      5      5      nS n[        X!5      $ )Nc                    SU ;  $ r  r6   r)   s    r-   importable_name,_top_level_inferred.<locals>.importable_name  s    $r0   )setrX   ra  r   r!   rW   )ru   	opt_namesrd  s      r-   rV  rV    s/    C*ODJJ,GHII /--r0   )rF  r9   r8   r   r  )rF  r9   r8   r  )rF  r9   r8   r9   r   )rF  r9   r8   r  )rF  r9   r8   r  )r8   zMapping[str, list[str]])r*   r   r8   r  )r*   r   r8   r9   )Ur>   
__future__r   r  rS  rK  r   r%  r   r  r5  r  r   r?  rd   r  collections.abcr   r   
contextlibr   	importlibr   importlib.abcr   r	   typingr
   r}   r   _collectionsr   r   _compatr   r   
_functoolsr   r   
_itertoolsr   r   r   r   r   _typingr   compatr   r   __all__ModuleNotFoundErrorr   rB   r  rk   rr   r   r   PurePosixPathr   r  ABCMetar   r   r  r  rS  r"  r4  r   r   r"   r%   partialnormalized_namerN  r    r!   r$   r#   rU  r]  ra  rV  r6   r0   r-   <module>rz     s   # 
      	   	 
   -  # (    4 0 @ @ .  "	. 	>1 >1Bu,, h! h!V5
% 5
p+''' +$C CG
S[[ G
T
; ;|6 6r0, 0,f. .b 	 '%7  ' 	 'F4| 4n5+>3 


-14";!F0.r0   