
    dhN                       d dl mZ d dlZd dlZd dlmZ d dlmZmZm	Z	m
Z
 d dlmZ d dlmZmZ d dlmZ d dlmZmZmZmZmZ d d	lmZ d d
lmZmZ d dlmZ d dlm Z m!Z! d dl"m#Z# d dl$m%Z% d dl&m'Z' ddl(m)Z)m*Z*m+Z+ erddl,m-Z-  ej\                  e/      Z0e	d   Z1 e
ed      Z2d%dZ3	 	 	 	 	 	 d&dZ4	 	 	 	 	 	 d&dZ5	 	 	 	 	 	 d'dZ6 G d de)      Z7 G d de7      Z8 G d de7      Z9 G d d e)      Z: G d! d"e)      Z; G d# d$e)      Z<y)(    )annotationsN)Iterable)TYPE_CHECKINGAnyUnioncast)InvalidRequirement)NormalizedNamecanonicalize_name)Version)	HashErrorInstallationSubprocessErrorInvalidInstalledPackageMetadataInconsistentMetadataInvalid)BaseDistribution)Linklinks_equivalent)Wheel)install_req_from_editableinstall_req_from_line)InstallRequirement)direct_url_from_link)normalize_version_info   )	CandidateRequirementformat_name)Factory)AlreadyInstalledCandidateEditableCandidateLinkCandidatez<Python from Requires-Python>c                B    t         t        t        f}t        | |      r| S y)z%The runtime version of BaseCandidate.N)r    r!   r"   
isinstance)	candidatebase_candidate_classess     p/var/www/html/vivango/api/ia/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.pyas_base_candidater(   /   s+     	"
 )34    c                   |j                   rJ d       |j                  rt        |j                        }n| j                  }t	        ||j
                  |j                  |j                  |j                  |j                  |j                  |j                  |j                  	      }|j                  |_        | |_        |j                  |_        |S )Nztemplate is editableuser_supplied
comes_from
use_pep517isolated
constraintglobal_optionshash_optionsconfig_settings)editablereqstrurlr   r,   r-   r.   r/   r0   r1   r2   r3   original_linklinkextras)r9   templatelineireqs       r'   make_install_req_from_linkr>   ;   s       8"88 ||8<< xx ,,&&&&""&&..** 00
D "//DDI//DKKr)   c                @   |j                   sJ d       t        | j                  |j                  |j                  |j
                  |j                  |j                  |j                  |j                  |j                  |j                  
      }|j                  |_        |S )Nztemplate not editable)	r,   r-   r.   r/   r0   permit_editable_wheelsr1   r2   r3   )r4   r   r7   r,   r-   r.   r/   r0   r@   r1   r2   r3   r:   )r9   r;   r=   s      r'   make_install_req_from_editablerA   T   s     555$,,&&&&""&&'>>..** 00D //DKKr)   c                   |j                   rt        |j                         }nM|j                  r&| j                   d|j                  j                   }n| j                   d| j
                   }t        ||j                  |j                  |j                  |j                  |j                  |j                  |j                  |j                  	      }| |_        |S )Nz @ z==r+   )r5   r6   r9   canonical_namer7   versionr   r,   r-   r.   r/   r0   r1   r2   r3   satisfied_by)distr;   r<   r=   s       r'   _make_install_req_from_distrG   h   s     ||8<< 	%%&c(--*;*;)<=%%&b7 ,,&&&&""&&..** 00
D DKr)   c                      e Zd ZU dZded<   dZ	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZddZdd	Z	dd
Z
edd       Zedd       Zedd       Zedd       ZddZddZddZddZddZd dZy)!"_InstallRequirementBackedCandidatea  A candidate backed by an ``InstallRequirement``.

    This represents a package request with the target not being already
    in the environment, and needs to be fetched and installed. The backing
    ``InstallRequirement`` is responsible for most of the leg work; this
    class exposes appropriate information to the resolver.

    :param link: The link passed to the ``InstallRequirement``. The backing
        ``InstallRequirement`` will use this link to fetch the distribution.
    :param source_link: The link this candidate "originates" from. This is
        different from ``link`` when the link is found in the wheel cache.
        ``link`` would point to the wheel cache, while this points to the
        found remote link (e.g. from pypi.org).
    r   rF   FNc                    || _         || _        || _        || _        || _        || _        | j                         | _        d | _        y N)	_link_source_link_factory_ireq_name_version_preparerF   _hash)selfr9   source_linkr=   factorynamerD   s          r'   __init__z+_InstallRequirementBackedCandidate.__init__   sC     
'

MMO	!%
r)   c                8    | j                    d| j                   S )N rW   rD   rT   s    r'   __str__z*_InstallRequirementBackedCandidate.__str__   s    ))Adll^,,r)   c                `    | j                   j                   dt        | j                        dS N())	__class____name__r6   rL   r\   s    r'   __repr__z+_InstallRequirementBackedCandidate.__repr__   s)    ..))*!C

O+>a@@r)   c                    | j                   | j                   S t        | j                  | j                  f      | _         | j                   S rK   )rS   hashrb   rL   r\   s    r'   __hash__z+_InstallRequirementBackedCandidate.__hash__   s9    ::!::4>>4::67
zzr)   c                p    t        || j                        r t        | j                  |j                        S yNF)r$   rb   r   rL   rT   others     r'   __eq__z)_InstallRequirementBackedCandidate.__eq__   s(    eT^^,#DJJ<<r)   c                    | j                   S rK   )rM   r\   s    r'   rU   z._InstallRequirementBackedCandidate.source_link          r)   c                h    | j                   | j                  j                  | _         | j                   S z:The normalised name of the project the candidate refers to)rP   rF   rC   r\   s    r'   project_namez/_InstallRequirementBackedCandidate.project_name   s)     ::11DJzzr)   c                    | j                   S rK   rq   r\   s    r'   rW   z'_InstallRequirementBackedCandidate.name   rn   r)   c                h    | j                   | j                  j                  | _         | j                   S rK   rQ   rF   rD   r\   s    r'   rD   z*_InstallRequirementBackedCandidate.version   '    ==  II--DM}}r)   c                    | j                    d| j                   d| j                  j                  r| j                  j                   dS | j                   dS )NrZ   z (from ra   )rW   rD   rL   is_file	file_pathr\   s    r'   format_for_errorz3_InstallRequirementBackedCandidate.format_for_error   s\    yyk4<<. )-1ZZ-?-?TZZ))PPQS	
EIZZPPQS	
r)   c                    t        d      )NzOverride in subclass)NotImplementedErrorr\   s    r'   _prepare_distributionz8_InstallRequirementBackedCandidate._prepare_distribution   s    !"899r)   c                0   | j                   E| j                   |j                  k7  r,t        | j                  d| j                   |j                        | j                  W| j                  |j
                  k7  r>t        | j                  dt        | j                        t        |j
                              	 t        |j                  t        |j                                            y# t        $ r$}t        | j                  t        |            d}~ww xY w)z:Check for consistency of project name and version of dist.NrW   rD   )rP   rC   r   rO   rQ   rD   r6   listiter_dependenciesiter_provided_extrasr	   r   )rT   rF   es      r'   _check_metadata_consistencyz>_InstallRequirementBackedCandidate._check_metadata_consistency   s    ::!djjD4G4G&G&



##	  ==$$,,)F&

DMM"DLL!	 	6''T-F-F-H(IJK! 	6!$**c!f55	6s   61C( (	D1DDc                    	 | j                         }| j                  |       |S # t        $ r}| j                  |_         d }~wt        $ r}d|_         d }~ww xY w)NzSee above for output.)r}   r   rO   r5   r   contextr   )rT   rF   r   excs       r'   rR   z+_InstallRequirementBackedCandidate._prepare   s_    	--/D 	((.  	 JJAE* 	1CK	s    % 	AA  AAAc              #  *  K   | j                   j                  | j                  j                         |r| j                  j	                         nd}|D ]9  }| j                   j                  t        |      | j                        E d {    ; y 7 wN )rN    make_requires_python_requirementrF   requires_pythonr   make_requirements_from_specr6   rO   )rT   with_requiresrequiresrs       r'   r   z4_InstallRequirementBackedCandidate.iter_dependencies   ss      mm<<TYY=V=VWW4A499..0r 	UA}}@@QTTT	UTs   BB	B
Bc                    | j                   S rK   )rO   r\   s    r'   get_install_requirementz:_InstallRequirementBackedCandidate.get_install_requirement  s    zzr)   NN)r9   r   rU   r   r=   r   rV   r   rW   NormalizedName | NonerD   Version | NonereturnNoner   r6   r   intrk   r   r   boolr   zLink | Noner   r
   r   r   r   r   )rF   r   r   r   r   r   r   zIterable[Requirement | None]r   InstallRequirement | None)rc   
__module____qualname____doc____annotations__is_installedrX   r]   rd   rg   rl   propertyrU   rq   rW   rD   rz   r}   r   rR   r   r   r   r)   r'   rI   rI      s     L '+"&&& & !	&
 & $&  & 
&$-A
 ! !   ! !  

:60"Ur)   rI   c                  H     e Zd ZdZ	 	 d	 	 	 	 	 	 	 	 	 	 	 d fdZddZ xZS )r"   Fc                V   |}|j                  ||      }|,t        j                  d|j                         |j                  }t	        ||      }|j                  |k(  sJ |j                  j
                  r|j                  j                  sqt        |j                  j                        }	t        |	j                        }
||
k(  sJ |d|
d       |)t        |	j                        }||k(  sJ |d|d|        ||j                  j
                  sJ |j                  j                  sJ |j                  r|j                  |j                  u r||_        |j                   |j                   |_        nt%        ||j                        |_        t&        | Q  ||||||       y )NzUsing cached wheel link: %sz != z
 for wheelz for wheel )link_is_in_wheel_cacher9   rU   r=   rV   rW   rD   )get_wheel_cache_entryloggerdebugr9   r>   is_wheelrx   r   filenamer   rW   r   rD   
persistentr8   cached_wheel_source_linkorigindownload_infor   superrX   )rT   r9   r;   rV   rW   rD   rU   cache_entryr=   wheel
wheel_namewheel_versionrb   s               r'   rX   zLinkCandidate.__init__  s    33KF"LL68H8HI##D)$9yyD   99dii&7&7$)),,-E*5::6J:%N$j^:'NN%" ' 6},H[]$5[GH, "99%%%%99$$$$%%(--8;Q;Q*Q0;-!!-%0%7%7" &:8N8N&" 	# 	 	
r)   c                h    | j                   j                  }|j                  | j                  d      S )NT)parallel_builds)rN   preparerprepare_linked_requirementrO   )rT   r   s     r'   r}   z#LinkCandidate._prepare_distribution>  s+    ==))224::t2TTr)   r   r9   r   r;   r   rV   r   rW   r   rD   r   r   r   r   rc   r   r   is_editablerX   r}   __classcell__rb   s   @r'   r"   r"   
  sV    K '+"&/
/
 %/
 	/

 $/
  /
 
/
bUr)   r"   c                  H     e Zd ZdZ	 	 d	 	 	 	 	 	 	 	 	 	 	 d fdZddZ xZS )r!   Tc                D    t         |   ||t        ||      |||       y )Nr   )r   rX   rA   )rT   r9   r;   rV   rW   rD   rb   s         r'   rX   zEditableCandidate.__init__F  s0     	/h? 	 	
r)   c                `    | j                   j                  j                  | j                        S rK   )rN   r   prepare_editable_requirementrO   r\   s    r'   r}   z'EditableCandidate._prepare_distributionW  s!    }}%%BB4::NNr)   r   r   r   r   r   s   @r'   r!   r!   C  sU    K '+"&

 %
 	

 $
  
 

"Or)   r!   c                      e Zd ZdZdZ	 	 	 	 	 	 	 	 ddZddZddZddZddZ	e
dd       Ze
dd	       Ze
dd
       Ze
dd       ZddZddZddZy)r    TNc                    || _         t        ||      | _        || _        d | _        d}|j
                  j                  | j                  |       y )Nzalready satisfied)rF   rG   rO   rN   rQ   r   prepare_installed_requirement)rT   rF   r;   rV   skip_reasons        r'   rX   z"AlreadyInstalledCandidate.__init___  sH     	0x@
 *66tzz;Or)   c                ,    t        | j                        S rK   )r6   rF   r\   s    r'   r]   z!AlreadyInstalledCandidate.__str__q  s    499~r)   c                N    | j                   j                   d| j                  dS r_   )rb   rc   rF   r\   s    r'   rd   z"AlreadyInstalledCandidate.__repr__t  s$    ..))*!DII=::r)   c                    t        |t              st        S | j                  |j                  k(  xr | j                  |j                  k(  S rK   )r$   r    NotImplementedrW   rD   rj   s     r'   rl   z AlreadyInstalledCandidate.__eq__w  s8    %!:;!!yyEJJ&H4<<5==+HHr)   c                D    t        | j                  | j                  f      S rK   )rf   rW   rD   r\   s    r'   rg   z"AlreadyInstalledCandidate.__hash__|  s    TYY-..r)   c                .    | j                   j                  S rK   )rF   rC   r\   s    r'   rq   z&AlreadyInstalledCandidate.project_name  s    yy'''r)   c                    | j                   S rK   rs   r\   s    r'   rW   zAlreadyInstalledCandidate.name  rn   r)   c                h    | j                   | j                  j                  | _         | j                   S rK   ru   r\   s    r'   rD   z!AlreadyInstalledCandidate.version  rv   r)   c                .    | j                   j                  S rK   )rF   r4   r\   s    r'   r   z%AlreadyInstalledCandidate.is_editable  s    yy!!!r)   c                :    | j                    d| j                   dS )NrZ   z (Installed)r[   r\   s    r'   rz   z*AlreadyInstalledCandidate.format_for_error  s    ))Adll^<88r)   c              #    K   |sy 	 | j                   j                         D ]9  }| j                  j                  t	        |      | j
                        E d {    ; y 7 # t        $ r}t        | j                   |      d d }~ww xY ww)N)rF   invalid_exc)rF   r   rN   r   r6   rO   r	   r   )rT   r   r   r   s       r'   r   z+AlreadyInstalledCandidate.iter_dependencies  sz     	UYY002 Y==DDSVTZZXXXYX! 	U)tyycJPTT	Us;   B	AA  AA  B	A   	B)BBB	c                     y rK   r   r\   s    r'   r   z1AlreadyInstalledCandidate.get_install_requirement      r)   )rF   r   r;   r   rV   r   r   r   r   )rk   objectr   r   r   r   r   r   r   r   r   )rc   r   r   r   rU   rX   r]   rd   rl   rg   r   rq   rW   rD   r   rz   r   r   r   r)   r'   r    r    [  s    LKPP %P 	P
 
P$;I
/ ( ( ! !  
 " "9Ur)   r    c                      e Zd ZdZdd	 	 	 	 	 	 	 ddZddZddZddZddZe	dd	       Z
e	dd
       Ze	dd       ZddZe	dd       Ze	dd       Ze	dd       ZddZddZy)ExtrasCandidatea  A candidate that has 'extras', indicating additional dependencies.

    Requirements can be for a project with dependencies, something like
    foo[extra].  The extras don't affect the project/version being installed
    directly, but indicate that we need additional dependencies. We model that
    by having an artificial ExtrasCandidate that wraps the "base" candidate.

    The ExtrasCandidate differs from the base in the following ways:

    1. It has a unique name, of the form foo[extra]. This causes the resolver
       to treat it as a separate node in the dependency graph.
    2. When we're getting the candidate's dependencies,
       a) We specify that we want the extra dependencies as well.
       b) We add a dependency on the base candidate.
          See below for why this is needed.
    3. We return None for the underlying InstallRequirement, as the base
       candidate will provide it, and we don't want to end up with duplicates.

    The dependency on the base candidate is needed so that the resolver can't
    decide that it should recommend foo[extra1] version 1.0 and foo[extra2]
    version 2.0. Having those candidates depend on foo=1.0 and foo=2.0
    respectively forces the resolver to recognise that this is a conflict.
    N)r-   c                   || _         t        d |D              | _        ||| _        y| j                   j                  | _        y)a  
        :param comes_from: the InstallRequirement that led to this candidate if it
            differs from the base's InstallRequirement. This will often be the
            case in the sense that this candidate's requirement has the extras
            while the base's does not. Unlike the InstallRequirement backed
            candidates, this requirement is used solely for reporting purposes,
            it does not do any leg work.
        c              3  2   K   | ]  }t        |        y wrK   )r   ).0r   s     r'   	<genexpr>z+ExtrasCandidate.__init__.<locals>.<genexpr>  s     E 1! 4E   N)base	frozensetr:   rO   _comes_from)rT   r   r:   r-   s       r'   rX   zExtrasCandidate.__init__  s9     	EfEE)3)?:TYY__r)   c                    t        | j                        j                  dd      \  }}dj                  |dj	                  | j
                        |      S )NrZ   r   z	{}[{}] {},)r6   r   splitformatjoinr:   )rT   rW   rests      r'   r]   zExtrasCandidate.__str__  sB    ^))#q1
d!!$(=tDDr)   c                h    | j                   j                   d| j                  d| j                  dS )Nz(base=z	, extras=ra   )rb   rc   r   r:   r\   s    r'   rd   zExtrasCandidate.__repr__  s/    ..))*&Yt{{oUVWWr)   c                D    t        | j                  | j                  f      S rK   )rf   r   r:   r\   s    r'   rg   zExtrasCandidate.__hash__  s    TYY,--r)   c                    t        || j                        r4| j                  |j                  k(  xr | j                  |j                  k(  S yri   )r$   rb   r   r:   rj   s     r'   rl   zExtrasCandidate.__eq__  s8    eT^^,99

*Jt{{ell/JJr)   c                .    | j                   j                  S rK   )r   rq   r\   s    r'   rq   zExtrasCandidate.project_name      yy%%%r)   c                V    t        | j                  j                  | j                        S rp   )r   r   rq   r:   r\   s    r'   rW   zExtrasCandidate.name  s     499114;;??r)   c                .    | j                   j                  S rK   )r   rD   r\   s    r'   rD   zExtrasCandidate.version  s    yy   r)   c                    dj                  | j                  j                         dj                  t	        | j
                                    S )Nz{} [{}]z, )r   r   rz   r   sortedr:   r\   s    r'   rz   z ExtrasCandidate.format_for_error  s9    II&&($))F4;;4G*H
 	
r)   c                .    | j                   j                  S rK   )r   r   r\   s    r'   r   zExtrasCandidate.is_installed  r   r)   c                .    | j                   j                  S rK   )r   r   r\   s    r'   r   zExtrasCandidate.is_editable      yy$$$r)   c                .    | j                   j                  S rK   )r   rU   r\   s    r'   rU   zExtrasCandidate.source_link  r   r)   c              #    K   | j                   j                  }|j                  | j                          |sy | j                  j	                  | j                   j
                  j                               }| j                  j                  | j                   j
                  j                               }t        |      D ]8  }t        j                  d| j                   j                  | j                  |       : | j                   j
                  j                  |      D ]0  }|j                  t        |      | j                   |      E d {    2 y 7 w)Nz%%s %s does not provide the extra '%s')r   rN   make_requirement_from_candidater:   intersectionrF   r   
differencer   r   warningrW   rD   r   r   r6   r   )rT   r   rV   valid_extrasinvalid_extrasextrar   s          r'   r   z!ExtrasCandidate.iter_dependencies  s
    ))$$ 55dii@@ {{//		0S0S0UV//		0S0S0UVN+ 	ENN7				 11,? 	A::A    	s   EE
EEc                     y rK   r   r\   s    r'   r   z'ExtrasCandidate.get_install_requirement  s     r)   )r   BaseCandidater:   zfrozenset[str]r-   r   r   r   r   r   r   r   r   r   r   r   r   )rc   r   r   r   rX   r]   rd   rg   rl   r   rq   rW   rD   rz   r   r   rU   r   r   r   r)   r'   r   r     s    : 15UU U
 .U 
U&EX.
 & & @ @ ! !

 & & % % % %8r)   r   c                  z    e Zd ZdZdZddZddZddZedd       Z	edd       Z
edd       Zdd	Zdd
ZddZy)RequiresPythonCandidateFNc                    |t        |      }nt        j                  d d }t        dj	                  d |D                    | _        y )N   .c              3  2   K   | ]  }t        |        y wrK   )r6   )r   cs     r'   r   z3RequiresPythonCandidate.__init__.<locals>.<genexpr>'  s     (FAQ(Fr   )r   sysversion_infor   r   rQ   )rT   py_version_infor  s      r'   rX   z RequiresPythonCandidate.__init__"  s?    &1/BL++BQ/L(F(F FGr)   c                     d| j                    S NzPython rQ   r\   s    r'   r]   zRequiresPythonCandidate.__str__-  s    ((r)   c                N    | j                   j                   d| j                  dS r_   )rb   rc   rQ   r\   s    r'   rd   z RequiresPythonCandidate.__repr__0  s%    ..))*!DMM+<A>>r)   c                    t         S rK   REQUIRES_PYTHON_IDENTIFIERr\   s    r'   rq   z$RequiresPythonCandidate.project_name3      ))r)   c                    t         S rK   r  r\   s    r'   rW   zRequiresPythonCandidate.name7  r  r)   c                    | j                   S rK   r  r\   s    r'   rD   zRequiresPythonCandidate.version;  s    }}r)   c                     d| j                    S r  )rD   r\   s    r'   rz   z(RequiresPythonCandidate.format_for_error?  s    ''r)   c                     yr   r   )rT   r   s     r'   r   z)RequiresPythonCandidate.iter_dependenciesB  s    r)   c                     y rK   r   r\   s    r'   r   z/RequiresPythonCandidate.get_install_requirementE  r   r)   )r  ztuple[int, ...] | Noner   r   r   r   r   r   r   )rc   r   r   r   rU   rX   r]   rd   r   rq   rW   rD   rz   r   r   r   r)   r'   r  r    sg    LKH)? * * * *  (r)   r  )r%   r   r   zBaseCandidate | None)r9   r   r;   r   r   r   )rF   r   r;   r   r   r   )=
__future__r   loggingr
  collections.abcr   typingr   r   r   r   "pip._vendor.packaging.requirementsr	   pip._vendor.packaging.utilsr
   r   pip._vendor.packaging.versionr   pip._internal.exceptionsr   r   r   r   r   pip._internal.metadatar   pip._internal.models.linkr   r   pip._internal.models.wheelr   pip._internal.req.constructorsr   r   pip._internal.req.req_installr   &pip._internal.utils.direct_url_helpersr   pip._internal.utils.miscr   r   r   r   r   rV   r   	getLoggerrc   r   r  r  r(   r>   rA   rG   rI   r"   r!   r    r   r  r   r)   r'   <module>r*     s6   "  
 $ 2 2 A I 1  4 < , = G ; 5 5 			8	$ ".2QR 	
,2
,(
&80G GT6U6 6UrO: O0D	 DNyi yx(i (r)   