
    !2iO                       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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/        e0          Z1e	d         Z2 e
ed          Z3d/dZ4d0dZ5d0dZ6d1d"Z7 G d# d$e*          Z8 G d% d&e8          Z9 G d' d(e8          Z: G d) d*e*          Z; G d+ d,e*          Z< G d- d.e*          Z=dS )2    )annotationsN)Iterable)TYPE_CHECKINGAnyUnioncast)InvalidRequirement)NormalizedNamecanonicalize_name)Version)FailedToPrepareCandidate	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>	candidater   returnBaseCandidate | Nonec                R    t           t          t          f}t          | |          r| S dS )z%The runtime version of BaseCandidate.N)r!   r"   r#   
isinstance)r$   base_candidate_classess     m/var/www/html/pixcura-vrs/venv/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.pyas_base_candidater+   0   s5     	"
 )344 4    linkr   templater   c           	        |j         r
J d            |j        rt          |j                  }n| j        }t	          ||j        |j        |j        |j        |j	        |j
                  }|j        |_        | |_        |j        |_        |S )Nztemplate is editableuser_supplied
comes_fromisolated
constrainthash_optionsconfig_settings)editablereqstrurlr   r1   r2   r3   r4   r5   r6   original_linkr-   extras)r-   r.   lineireqs       r*   make_install_req_from_linkr?   <   s      88"8888| 8<  x ,&"&* 0  D "/DDI/DKKr,   c           
         |j         s
J d            |j        r|j         d| j         }n| j        }t          ||j        |j        |j        |j        |j        |j	        |j
                  }|j        |_        |S )Nztemplate not editable @ )r1   r2   r3   r4   permit_editable_wheelsr5   r6   )r7   namer:   r   r1   r2   r3   r4   rB   r5   r6   r<   )r-   r.   
req_stringr>   s       r*   make_install_req_from_editablerE   S   s     555555}  44$(44

X
$,&"&'>* 0	 	 	D /DKKr,   distr   c           	        |j         rt          |j                   }n/|j        r| j         d|j        j         }n| j         d| j         }t          ||j        |j        |j	        |j
        |j        |j                  }| |_        |S )NrA   z==r0   )r8   r9   r-   canonical_namer:   versionr   r1   r2   r3   r4   r5   r6   satisfied_by)rF   r.   r=   r>   s       r*   _make_install_req_from_distrK   i   s     | 88<  	 8%==(-*;==%7777 ,&"&* 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d0dZ	d1dZ
ed2d            Zed3d             Zed/d!            Zed4d#            Zd/d$Zd5d%Zd6d&Zd5d'Zd7d*Zd8d,ZdS )9"_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   FNr-   r   source_linkr>   r   factoryr    rC   NormalizedName | NonerI   Version | Noner%   Nonec                    || _         || _        || _        || _        || _        || _        |                                 | _        d | _        d S N)	_link_source_link_factory_ireq_name_version_preparerF   _hash)selfr-   rN   r>   rO   rC   rI   s          r*   __init__z+_InstallRequirementBackedCandidate.__init__   sI     
'

MMOO	!%


r,   r9   c                $    | j          d| j         S )N rC   rI   r]   s    r*   __str__z*_InstallRequirementBackedCandidate.__str__   s    ),,dl,,,r,   c                J    | j         j         dt          | j                  dS N())	__class____name__r9   rU   rb   s    r*   __repr__z+_InstallRequirementBackedCandidate.__repr__   s&    .)@@C
OO@@@@r,   intc                l    | j         | j         S t          | j        | j        f          | _         | j         S rT   )r\   hashrh   rU   rb   s    r*   __hash__z+_InstallRequirementBackedCandidate.__hash__   s2    :!:4>4:677
zr,   otherr   boolc                d    t          || j                  rt          | j        |j                  S dS NF)r(   rh   r   rU   r]   ro   s     r*   __eq__z)_InstallRequirementBackedCandidate.__eq__   s/    eT^,, 	=#DJ<<<ur,   Link | Nonec                    | j         S rT   )rV   rb   s    r*   rN   z._InstallRequirementBackedCandidate.source_link         r,   r
   c                @    | j         | j        j        | _         | j         S z:The normalised name of the project the candidate refers to)rY   rF   rH   rb   s    r*   project_namez/_InstallRequirementBackedCandidate.project_name   s      :1DJzr,   c                    | j         S rT   rz   rb   s    r*   rC   z'_InstallRequirementBackedCandidate.name   rw   r,   r   c                @    | j         | j        j        | _         | j         S rT   rZ   rF   rI   rb   s    r*   rI   z*_InstallRequirementBackedCandidate.version       =  I-DM}r,   c                f    | j          d| j         d| j        j        r| j        j        n| j         dS )Nr`   z (from rg   )rC   rI   rU   is_file	file_pathrb   s    r*   format_for_errorz3_InstallRequirementBackedCandidate.format_for_error   sS    y S S4< S S-1Z-?OTZ))TZS S S	
r,   c                     t          d          )NzOverride in subclass)NotImplementedErrorrb   s    r*   _prepare_distributionz8_InstallRequirementBackedCandidate._prepare_distribution   s    !"8999r,   c                   | j         1| j         |j        k    r!t          | j        d| j         |j                  | j        K| j        |j        k    r;t          | j        dt          | j                  t          |j                            	 t          |                    t          |	                                                               dS # t          $ r'}t          | j        t          |                    d}~ww xY w)z:Check for consistency of project name and version of dist.NrC   rI   )rY   rH   r   rX   rZ   rI   r9   listiter_dependenciesiter_provided_extrasr	   r   )r]   rF   es      r*   _check_metadata_consistencyz>_InstallRequirementBackedCandidate._check_metadata_consistency   s    :!djD4G&G&G&

#	   =$$,)F)F&
DM""DL!!	  	6''T-F-F-H-H(I(IJJKKKKK! 	6 	6 	6!$*c!ff555	6s   AC 
D "C;;D c                   	 |                                  }n# t          $ r}| j        |_         d }~wt          $ r}t          | j        j        t                    r| j        j                                        }n| j        j        }|d}t          | j        j
        pt          | j                  ||j                  d }~ww xY w|                     |           |S )Nzdirectly requested)package_namerequirement_chainfailed_step)r   r   rX   r8   r   r(   r2   r   	from_pathr   rC   r9   rU   command_descriptionr   )r]   rF   r   excrequest_chains        r*   r[   z+_InstallRequirementBackedCandidate._prepare   s    	--//DD 	 	 	 JAE* 	 	 	$*/1CDD 6 $
 5 ? ? A A $
 5$ 4*!Z_?DJ"/3   	 	((...s    
C.CBB>>Cwith_requiresIterable[Requirement | None]c              #     K   | j                             | j        j                  V  |r| j                                        nd}|D ]5}| j                             t          |          | j                  E d {V  6d S N )rW    make_requires_python_requirementrF   requires_pythonr   make_requirements_from_specr9   rX   )r]   r   requiresrs       r*   r   z4_InstallRequirementBackedCandidate.iter_dependencies  s       m<<TY=VWWWWW4AI49..000r 	U 	UA}@@QTTTTTTTTTT	U 	Ur,   InstallRequirement | Nonec                    | j         S rT   )rX   rb   s    r*   get_install_requirementz:_InstallRequirementBackedCandidate.get_install_requirement  s
    zr,   NN)r-   r   rN   r   r>   r   rO   r    rC   rP   rI   rQ   r%   rR   r%   r9   r%   rk   ro   r   r%   rp   r%   ru   r%   r
   r%   r   r%   r   )rF   r   r%   rR   r   rp   r%   r   r%   r   )ri   
__module____qualname____doc____annotations__is_installedr^   rc   rj   rn   rt   propertyrN   rz   rC   rI   r   r   r   r[   r   r   r   r,   r*   rM   rM      s          L '+"&& & & & &$- - - -A A A A      
 ! ! ! X!    X ! ! ! X!    X

 
 
 
: : : :6 6 6 60   6U U U U     r,   rM   c                  2     e Zd ZdZ	 	 dd fdZddZ xZS )r#   FNr-   r   r.   r   rO   r    rC   rP   rI   rQ   r%   rR   c                   |}|                     ||          }|'t                              d|j                   |j        }t	          ||          }|j        |k    sJ |j        j        rp|j        j        sdt          |j        j                  }	|	j	        }
||
k    sJ |d|
d            |,t          |	j                  }||k    sJ |d|d|             |g|j        j        sJ |j        j        sJ |j        r|j        |j        u r||_        |j        |j        |_        nt#          ||j                  |_        t%                                          ||||||           d S )NzUsing cached wheel link: %sz != z
 for wheelz for wheel )link_is_in_wheel_cacher-   rN   r>   rO   rC   rI   )get_wheel_cache_entryloggerdebugr-   r?   is_wheelr   r   filenamerC   r   rI   
persistentr;   cached_wheel_source_linkorigindownload_infor   superr^   )r]   r-   r.   rO   rC   rI   rN   cache_entryr>   wheel
wheel_namewheel_versionrh   s               r*   r^   zLinkCandidate.__init__  s    33KFF"LL68HIII#D)$99yD    9 		Hdi&7 		H$),--EJ:%%%$'N'Nj'N'N'N%%%" ' 6 6},,,GG]GGGG -,, "9%%%%9$$$$% <(-8;Q*Q*Q0;-!-%0%7"" &:8N& & &" 	# 	 	
 	
 	
 	
 	
r,   r   c                R    | j         j        }|                    | j        d          S )NT)parallel_builds)rW   preparerprepare_linked_requirementrX   )r]   r   s     r*   r   z#LinkCandidate._prepare_distributionG  s'    =)224:t2TTTr,   r   r-   r   r.   r   rO   r    rC   rP   rI   rQ   r%   rR   r   ri   r   r   is_editabler^   r   __classcell__rh   s   @r*   r#   r#     sl        K '+"&/
 /
 /
 /
 /
 /
 /
bU U U U U U U Ur,   r#   c                  2     e Zd ZdZ	 	 dd fdZddZ xZS )r"   TNr-   r   r.   r   rO   r    rC   rP   rI   rQ   r%   rR   c                r    t                                          ||t          ||          |||           d S )Nr   )r   r^   rE   )r]   r-   r.   rO   rC   rI   rh   s         r*   r^   zEditableCandidate.__init__O  sL     	/h?? 	 	
 	
 	
 	
 	
r,   r   c                J    | j         j                            | j                  S rT   )rW   r   prepare_editable_requirementrX   rb   s    r*   r   z'EditableCandidate._prepare_distribution`  s    }%BB4:NNNr,   r   r   r   r   r   s   @r*   r"   r"   L  sk        K '+"&
 
 
 
 
 
 
"O O O O O O O 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dS )*r!   TNrF   r   r.   r   rO   r    r%   rR   c                    || _         t          ||          | _        || _        d | _        d}|j                            | j        |           d S )Nzalready satisfied)rF   rK   rX   rW   rZ   r   prepare_installed_requirement)r]   rF   r.   rO   skip_reasons        r*   r^   z"AlreadyInstalledCandidate.__init__h  sR     	0x@@
 *66tz;OOOOOr,   r9   c                *    t          | j                  S rT   )r9   rF   rb   s    r*   rc   z!AlreadyInstalledCandidate.__str__z  s    49~~r,   c                0    | j         j         d| j        dS re   )rh   ri   rF   rb   s    r*   rj   z"AlreadyInstalledCandidate.__repr__}  s     .)::DI::::r,   ro   objectrp   c                z    t          |t                    st          S | j        |j        k    o| j        |j        k    S rT   )r(   r!   NotImplementedrC   rI   rs   s     r*   rt   z AlreadyInstalledCandidate.__eq__  s8    %!:;; 	"!!yEJ&H4<5=+HHr,   rk   c                8    t          | j        | j        f          S rT   )rm   rC   rI   rb   s    r*   rn   z"AlreadyInstalledCandidate.__hash__  s    TY-...r,   r
   c                    | j         j        S rT   )rF   rH   rb   s    r*   rz   z&AlreadyInstalledCandidate.project_name  s    y''r,   c                    | j         S rT   r|   rb   s    r*   rC   zAlreadyInstalledCandidate.name  rw   r,   r   c                @    | j         | j        j        | _         | j         S rT   r~   rb   s    r*   rI   z!AlreadyInstalledCandidate.version  r   r,   c                    | j         j        S rT   )rF   r7   rb   s    r*   r   z%AlreadyInstalledCandidate.is_editable  s    y!!r,   c                &    | j          d| j         dS )Nr`   z (Installed)ra   rb   s    r*   r   z*AlreadyInstalledCandidate.format_for_error  s    )88dl8888r,   r   r   c              #    K   |sd S 	 | j                                         D ]5}| j                            t	          |          | j                  E d {V  6d S # t          $ r}t          | j         |          d d }~ww xY w)N)rF   invalid_exc)rF   r   rW   r   r9   rX   r	   r   )r]   r   r   r   s       r*   r   z+AlreadyInstalledCandidate.iter_dependencies  s       	F	UY0022 Y Y=DDSVVTZXXXXXXXXXXY Y! 	U 	U 	U)tycJJJPTT	Us   AA 
A?#A::A?r   c                    d S rT   r   rb   s    r*   r   z1AlreadyInstalledCandidate.get_install_requirement      tr,   )rF   r   r.   r   rO   r    r%   rR   r   )ro   r   r%   rp   r   r   r   r%   rp   r   r   )ri   r   r   r   rN   r^   rc   rj   rt   rn   r   rz   rC   rI   r   r   r   r   r   r,   r*   r!   r!   d  sJ       LKP P P P$   ; ; ; ;I I I I
/ / / / ( ( ( X( ! ! ! X!    X
 " " " X"9 9 9 9U U U 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dS ).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)r2   baseBaseCandidater<   frozenset[str]r2   r   r%   rR   c               z    || _         t          d |D                       | _        ||n| j         j        | _        dS )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  4   K   | ]}t          |          V  d S rT   )r   ).0r   s     r*   	<genexpr>z+ExtrasCandidate.__init__.<locals>.<genexpr>  s+      EE 1! 4 4EEEEEEr,   N)r   	frozensetr<   rX   _comes_from)r]   r   r<   r2   s       r*   r^   zExtrasCandidate.__init__  sD     	EEfEEEEE)3)?::TY_r,   r9   c                    t          | j                                      dd          \  }}d                    |d                    | j                  |          S )Nr`   r   z	{}[{}] {},)r9   r   splitformatjoinr<   )r]   rC   rests      r*   rc   zExtrasCandidate.__str__  sI    ^^))#q11
d!!$(=(=tDDDr,   c                @    | j         j         d| j        d| j        dS )Nz(base=z	, extras=rg   )rh   ri   r   r<   rb   s    r*   rj   zExtrasCandidate.__repr__  s*    .)WWWWt{WWWWr,   rk   c                8    t          | j        | j        f          S rT   )rm   r   r<   rb   s    r*   rn   zExtrasCandidate.__hash__  s    TY,---r,   ro   r   rp   c                p    t          || j                  r | j        |j        k    o| j        |j        k    S dS rr   )r(   rh   r   r<   rs   s     r*   rt   zExtrasCandidate.__eq__  s9    eT^,, 	K9
*Jt{el/JJur,   r
   c                    | j         j        S rT   )r   rz   rb   s    r*   rz   zExtrasCandidate.project_name      y%%r,   c                @    t          | j        j        | j                  S ry   )r   r   rz   r<   rb   s    r*   rC   zExtrasCandidate.name  s     4914;???r,   r   c                    | j         j        S rT   )r   rI   rb   s    r*   rI   zExtrasCandidate.version  s    y  r,   c                    d                     | j                                        d                    t	          | j                                      S )Nz{} [{}]z, )r   r   r   r   sortedr<   rb   s    r*   r   z ExtrasCandidate.format_for_error  sC    I&&(($))F4;4G4G*H*H
 
 	
r,   c                    | j         j        S rT   )r   r   rb   s    r*   r   zExtrasCandidate.is_installed  r   r,   c                    | j         j        S rT   )r   r   rb   s    r*   r   zExtrasCandidate.is_editable      y$$r,   ru   c                    | j         j        S rT   )r   rN   rb   s    r*   rN   zExtrasCandidate.source_link   r  r,   r   r   c              #  X  K   | j         j        }|                    | j                   V  |sd S | j                            | j         j                                                  }| j                            | j         j                                                  }t          |          D ].}t          
                    d| j         j        | j        |           /| j         j                            |          D ]1}|                    t          |          | j        |          E d {V  2d S )Nz%%s %s does not provide the extra '%s')r   rW   make_requirement_from_candidater<   intersectionrF   r   
differencer   r   warningrC   rI   r   r   r9   r   )r]   r   rO   valid_extrasinvalid_extrasextrar   s          r*   r   z!ExtrasCandidate.iter_dependencies  sE     )$ 55di@@@@@ 	F {//	0S0S0U0UVV//	0S0S0U0UVVN++ 	 	ENN7		    11,?? 	 	A::A          	 	r,   c                    d S rT   r   rb   s    r*   r   z'ExtrasCandidate.get_install_requirement   s	     tr,   )r   r   r<   r   r2   r   r%   rR   r   r   r   r   r   r   r   r   r   )ri   r   r   r   r^   rc   rj   rn   rt   r   rz   rC   rI   r   r   r   rN   r   r   r   r,   r*   r   r     s        : 15U U U U U U&E E E EX X X X. . . .   
 & & & X& @ @ @ X@ ! ! ! X!
 
 
 

 & & & X& % % % X% % % % X%   8     r,   r   c                      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dS )RequiresPythonCandidateFNpy_version_infotuple[int, ...] | Noner%   rR   c                    |t          |          }nt          j        d d         }t          d                    d |D                                 | _        d S )N   .c              3  4   K   | ]}t          |          V  d S rT   )r9   )r   cs     r*   r   z3RequiresPythonCandidate.__init__.<locals>.<genexpr>0  s(      (F(FAQ(F(F(F(F(F(Fr,   )r   sysversion_infor   r   rZ   )r]   r  r  s      r*   r^   z RequiresPythonCandidate.__init__+  sV    &1/BBLL+BQB/L(F(F(F(F(F F FGGr,   r9   c                    d| j          S NzPython rZ   rb   s    r*   rc   zRequiresPythonCandidate.__str__6  s    ((((r,   c                0    | j         j         d| j        dS re   )rh   ri   rZ   rb   s    r*   rj   z RequiresPythonCandidate.__repr__9  s     .)>>DM>>>>r,   r
   c                    t           S rT   REQUIRES_PYTHON_IDENTIFIERrb   s    r*   rz   z$RequiresPythonCandidate.project_name<      ))r,   c                    t           S rT   r  rb   s    r*   rC   zRequiresPythonCandidate.name@  r  r,   r   c                    | j         S rT   r  rb   s    r*   rI   zRequiresPythonCandidate.versionD  s
    }r,   c                    d| j          S r  )rI   rb   s    r*   r   z(RequiresPythonCandidate.format_for_errorH  s    ''''r,   r   rp   r   c                    dS r   r   )r]   r   s     r*   r   z)RequiresPythonCandidate.iter_dependenciesK  s    rr,   r   c                    d S rT   r   rb   s    r*   r   z/RequiresPythonCandidate.get_install_requirementN  r   r,   )r  r  r%   rR   r   r   r   r   r   )ri   r   r   r   rN   r^   rc   rj   r   rz   rC   rI   r   r   r   r   r,   r*   r  r  '  s        LKH H H H) ) ) )? ? ? ? * * * X* * * * X*    X( ( ( (        r,   r  )r$   r   r%   r&   )r-   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   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   rO   r    	getLoggerri   r   r   r  r+   r?   rE   rK   rM   r#   r"   r!   r   r  r   r,   r*   <module>r4     s{   " " " " " "  



 $ $ $ $ $ $ 2 2 2 2 2 2 2 2 2 2 2 2 A A A A A A I I I I I I I I 1 1 1 1 1 1                4 3 3 3 3 3 < < < < < < < < , , , , , ,        = < < < < < G G G G G G ; ; ; ; ; ; 5 5 5 5 5 5 5 5 5 5 !      		8	$	$ "T.2QRR 	 	 	 	   .   ,   ,Q Q Q Q Q Q Q Qh6U 6U 6U 6U 6U6 6U 6U 6UrO O O O O: O O O0D D D D D	 D D DNy y y y yi y y yx( ( ( ( (i ( ( ( ( (r,   