
    /hJ                     :   d dl Z d dlZd dlmZmZmZmZmZmZm	Z	m
Z
 d dlmZmZ d dlmZ d dl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'm(Z( erddl)m*Z*  e j+        e,          Z-e	d         Z. e
ed          Z/de%dee.         fdZ0dededefdZ1dededefdZ2dededefdZ3 G d de%          Z4 G d de4          Z5 G d d e4          Z6 G d! d"e%          Z7 G d# d$e%          Z8 G d% d&e%          Z9dS )'    N)TYPE_CHECKINGAny	FrozenSetIterableOptionalTupleUnioncast)NormalizedNamecanonicalize_name)Version)	HashErrorInstallationSubprocessErrorMetadataInconsistent)BaseDistribution)Linklinks_equivalent)Wheel)install_req_from_editableinstall_req_from_line)InstallRequirement)direct_url_from_link)normalize_version_info   )	CandidateCandidateVersionRequirementformat_name)Factory)AlreadyInstalledCandidateEditableCandidateLinkCandidatez<Python from Requires-Python>	candidatereturnc                 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     a/var/www/html/venv/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.pyas_base_candidater)   )   s5     	"
 )344 4    linktemplatec                 <   |j         r
J d            |j        rt          |j                  }n| j        }t	          ||j        |j        |j        |j        |j	        t          |j        |j        |j                  |j                  }|j        |_        | |_        |S )Nztemplate is editableinstall_optionsglobal_optionshashesuser_supplied
comes_from
use_pep517isolated
constraintoptionsconfig_settings)editablereqstrurlr   r3   r4   r5   r6   r7   dictr/   r0   hash_optionsr9   original_linkr+   )r+   r,   lineireqs       r(   make_install_req_from_linkrC   5   s      88"8888| 8<  x ,&&"&$4#2(
 
 

 !0  D "/DDIKr*   c                     |j         s
J d            t          | j        |j        |j        |j        |j        |j        |j        t          |j
        |j        |j                  |j        	  	        S )Nztemplate not editabler.   )r3   r4   r5   r6   r7   permit_editable_wheelsr8   r9   )r:   r   r=   r3   r4   r5   r6   r7   rE   r>   r/   r0   r?   r9   )r+   r,   s     r(   make_install_req_from_editablerF   P   s     555555$,&&"&'>$4#2(
 
 

 !0   r*   distc                 R   |j         rt          |j                   }n/|j        r| j         d|j        j         }n| j         d| j         }t          ||j        |j        |j	        |j
        |j        t          |j        |j        |j                  |j                  }| |_        |S )Nz @ z==r.   r2   )r;   r<   r+   canonical_namer=   versionr   r3   r4   r5   r6   r7   r>   r/   r0   r?   r9   satisfied_by)rG   r,   rA   rB   s       r(   _make_install_req_from_distrL   e   s     | 88<  	 8%==(-*;==%7777 ,&&"&$4#2(
 
 

 !0  D DKr*   c                      e Zd ZU dZeed<   dZ	 	 ddedededd	d
e	e
         de	e         ddfdZdefdZdefdZdefdZdedefdZede	e         fd            Zede
fd            Zedefd            Zedefd            ZdefdZdefdZdeddfdZdefdZdedee	e                  fdZ de	e         fdZ!dS )"_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).
    rG   FNr+   source_linkrB   factoryr   namerJ   r$   c                     || _         || _        || _        || _        || _        || _        |                                 | _        d S N)_link_source_link_factory_ireq_name_version_preparerG   )selfr+   rO   rB   rP   rQ   rJ   s          r(   __init__z+_InstallRequirementBackedCandidate.__init__   sB     
'

MMOO			r*   c                 $    | j          d| j         S )N rQ   rJ   r[   s    r(   __str__z*_InstallRequirementBackedCandidate.__str__   s    ),,dl,,,r*   c                 h    d                     | j        j        t          | j                            S )Nz{class_name}({link!r}))
class_namer+   )format	__class____name__r<   rT   r`   s    r(   __repr__z+_InstallRequirementBackedCandidate.__repr__   s2    '..~.TZ / 
 
 	
r*   c                 8    t          | j        | j        f          S rS   )hashre   rT   r`   s    r(   __hash__z+_InstallRequirementBackedCandidate.__hash__   s    T^TZ0111r*   otherc                 d    t          || j                  rt          | j        |j                  S dS NF)r&   re   r   rT   r[   rk   s     r(   __eq__z)_InstallRequirementBackedCandidate.__eq__   s/    eT^,, 	=#DJ<<<ur*   c                     | j         S rS   )rU   r`   s    r(   rO   z._InstallRequirementBackedCandidate.source_link         r*   c                 @    | j         | j        j        | _         | j         S z:The normalised name of the project the candidate refers to)rX   rG   rI   r`   s    r(   project_namez/_InstallRequirementBackedCandidate.project_name   s      :1DJzr*   c                     | j         S rS   rt   r`   s    r(   rQ   z'_InstallRequirementBackedCandidate.name   rq   r*   c                 @    | j         | j        j        | _         | j         S rS   )rY   rG   rJ   r`   s    r(   rJ   z*_InstallRequirementBackedCandidate.version   s    =  I-DM}r*   c                 ~    d                     | j        | j        | j        j        r| j        j        n| j                  S )Nz{} {} (from {}))rd   rQ   rJ   rT   is_file	file_pathr`   s    r(   format_for_errorz3_InstallRequirementBackedCandidate.format_for_error   s=     ''IL$(J$6FDJ  DJ
 
 	
r*   c                      t          d          )NzOverride in subclass)NotImplementedErrorr`   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                            dS dS )z:Check for consistency of project name and version of dist.NrQ   rJ   )rX   rI   r   rW   rY   rJ   r<   )r[   rG   s     r(   _check_metadata_consistencyz>_InstallRequirementBackedCandidate._check_metadata_consistency   s    :!djD4G&G&G&

#	   =$$,)F)F&
DM""DL!!	   %$)F)Fr*   c                     	 |                                  }n4# t          $ r}| j        |_         d }~wt          $ r}d|_         d }~ww xY w|                     |           |S )NzSee above for output.)r~   r   rW   r;   r   contextr   )r[   rG   eexcs       r(   rZ   z+_InstallRequirementBackedCandidate._prepare   s    	--//DD 	 	 	 JAE* 	 	 	1CK	
 	((...s    
A.AAAwith_requiresc              #      K   |r| j                                         nd}|D ]1}| j                            t	          |          | j                  V  2| j                            | j         j                  V  d S N )rG   iter_dependenciesrV   make_requirement_from_specr<   rW    make_requires_python_requirementrequires_python)r[   r   requiresrs       r(   r   z4_InstallRequirementBackedCandidate.iter_dependencies   s      4AI49..000r 	O 	OA-::3q664:NNNNNNm<<TY=VWWWWWWWr*   c                     | j         S rS   )rW   r`   s    r(   get_install_requirementz:_InstallRequirementBackedCandidate.get_install_requirement   s
    zr*   NN)"rf   
__module____qualname____doc__r   __annotations__is_installedr   r   r   r   r   r\   r<   ra   rg   intrj   r   boolro   propertyrO   rt   rQ   rJ   r{   r~   r   rZ   r   r   r   r   r   r*   r(   rN   rN      s          L *..2$ $$ $ !	$
 $ ~&$ *+$ 
$ $ $ $"- - - - -
# 
 
 
 
2# 2 2 2 2C D    
 !Xd^ ! ! ! X! n    X !c ! ! ! X! )    X

# 
 
 
 
:'7 : : : :0@ T    "*    "Xt X+AV8W X X X X2D)E      r*   rN   c                   f     e Zd ZdZ	 	 ddededddee         dee         d	df fd
Z	d	e
fdZ xZS )r"   FNr+   r,   rP   r   rQ   rJ   r$   c                    |}|                     ||          }|'t                              d|j                   |j        }t	          ||          }|j        |k    sJ |j        j        r|j        j        s~t          |j        j                  }	t          |	j
                  }
||
k    sJ |d|
d            |9t          |	j                  }||k    sJ d                    |||                      |K|j        r|j        |j        u rd|_        |j        |j        |_        nt'          ||j                  |_        t)                                          ||||||           d S )NzUsing cached wheel link: %sz != z
 for wheelz{!r} != {!r} for wheel {}T)link_is_in_wheel_cacher+   rO   rB   rP   rQ   rJ   )get_wheel_cache_entryloggerdebugr+   rC   is_wheelry   r   filenamer   rQ   r   rJ   rd   
persistentr@   original_link_is_in_wheel_cacheorigindownload_infor   superr\   )r[   r+   r,   rP   rQ   rJ   rO   cache_entryrB   wheel
wheel_namewheel_versionre   s               r(   r\   zLinkCandidate.__init__  s    33D$??"LL68HIII#D)$99yD    9 		di&7 		$),--E*5:66J:%%%$'N'Nj'N'N'N%%%" ' 6 6-///1L1S1S]D2 2/// "% <(-8;Q*Q*Q7;4!-%0%7"" &:8N& & &" 	# 	 	
 	
 	
 	
 	
r*   c                 R    | j         j        }|                    | j        d          S )NT)parallel_builds)rV   preparerprepare_linked_requirementrW   )r[   r   s     r(   r~   z#LinkCandidate._prepare_distribution2  s'    =)224:t2TTTr*   r   rf   r   r   is_editabler   r   r   r   r   r\   r   r~   __classcell__re   s   @r(   r"   r"      s        K *..2-
 -
-
 %-
 	-

 ~&-
 *+-
 
-
 -
 -
 -
 -
 -
^U'7 U U U U U U U Ur*   r"   c                   f     e Zd ZdZ	 	 ddededddee         dee         d	df fd
Z	d	e
fdZ xZS )r!   TNr+   r,   rP   r   rQ   rJ   r$   c                 r    t                                          ||t          ||          |||           d S )Nr   )r   r\   rF   )r[   r+   r,   rP   rQ   rJ   re   s         r(   r\   zEditableCandidate.__init__:  sL     	/h?? 	 	
 	
 	
 	
 	
r*   c                 J    | j         j                            | j                  S rS   )rV   r   prepare_editable_requirementrW   r`   s    r(   r~   z'EditableCandidate._prepare_distributionK  s    }%BB4:NNNr*   r   r   r   s   @r(   r!   r!   7  s        K *..2
 

 %
 	

 ~&
 *+
 

 
 
 
 
 
"O'7 O O O O O O O Or*   r!   c                      e Zd ZdZdZdededdddfdZdefd	Z	defd
Z
defdZdedefdZedefd            Zedefd            Zedefd            Zedefd            ZdefdZdedeee                  fdZdee         fdZdS )r    TNrG   r,   rP   r   r$   c                     || _         t          ||          | _        || _        d}|j                            | j        |           d S )Nzalready satisfied)rG   rL   rW   rV   r   prepare_installed_requirement)r[   rG   r,   rP   skip_reasons        r(   r\   z"AlreadyInstalledCandidate.__init__S  sK     	0x@@
 *66tz;OOOOOr*   c                 *    t          | j                  S rS   )r<   rG   r`   s    r(   ra   z!AlreadyInstalledCandidate.__str__d  s    49~~r*   c                 N    d                     | j        j        | j                  S )Nz{class_name}({distribution!r}))rc   distribution)rd   re   rf   rG   r`   s    r(   rg   z"AlreadyInstalledCandidate.__repr__g  s,    /66~. 7 
 
 	
r*   c                 D    t          | j        | j        | j        f          S rS   )ri   re   rQ   rJ   r`   s    r(   rj   z"AlreadyInstalledCandidate.__hash__m  s    T^TY=>>>r*   rk   c                 p    t          || j                  r | j        |j        k    o| j        |j        k    S dS rm   )r&   re   rQ   rJ   rn   s     r(   ro   z AlreadyInstalledCandidate.__eq__p  s9    eT^,, 	M9
*Lt|u}/LLur*   c                     | j         j        S rS   )rG   rI   r`   s    r(   rt   z&AlreadyInstalledCandidate.project_nameu  s    y''r*   c                     | j         S rS   rv   r`   s    r(   rQ   zAlreadyInstalledCandidate.namey  rq   r*   c                     | j         j        S rS   )rG   rJ   r`   s    r(   rJ   z!AlreadyInstalledCandidate.version}      y  r*   c                     | j         j        S rS   )rG   r:   r`   s    r(   r   z%AlreadyInstalledCandidate.is_editable  s    y!!r*   c                 &    | j          d| j         dS )Nr^   z (Installed)r_   r`   s    r(   r{   z*AlreadyInstalledCandidate.format_for_error  s    )88dl8888r*   r   c              #      K   |sd S | j                                         D ]1}| j                            t	          |          | j                  V  2d S rS   )rG   r   rV   r   r<   rW   )r[   r   r   s      r(   r   z+AlreadyInstalledCandidate.iter_dependencies  sg       	F,,.. 	O 	OA-::3q664:NNNNNN	O 	Or*   c                     d S rS   r   r`   s    r(   r   z1AlreadyInstalledCandidate.get_install_requirement      tr*   )rf   r   r   r   rO   r   r   r\   r<   ra   rg   r   rj   r   r   ro   r   r   rt   rQ   r   rJ   r   r{   r   r   r   r   r   r   r*   r(   r    r    O  s       LKPP %P 	P
 
P P P P"    
# 
 
 
 
?# ? ? ? ?C D    
 (n ( ( ( X( !c ! ! ! X! !) ! ! ! X! "T " " " X"9# 9 9 9 9Ot O+AV8W O O O O2D)E      r*   r    c                   f   e Zd ZdZdedee         ddfdZdefdZdefdZ	de
fd	Zd
edefdZedefd            Zedefd            Zedefd            ZdefdZedefd            Zedefd            Zedee         fd            Zdedeee                  fdZdee         f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.
    baseextrasr$   Nc                 "    || _         || _        d S rS   )r   r   )r[   r   r   s      r(   r\   zExtrasCandidate.__init__  s    
 	r*   c                     t          | j                                      dd          \  }}d                    |d                    | j                  |          S )Nr^   r   z	{}[{}] {},)r<   r   splitrd   joinr   )r[   rQ   rests      r(   ra   zExtrasCandidate.__str__  sI    ^^))#q11
d!!$(=(=tDDDr*   c                 Z    d                     | j        j        | j        | j                  S )Nz.{class_name}(base={base!r}, extras={extras!r}))rc   r   r   )rd   re   rf   r   r   r`   s    r(   rg   zExtrasCandidate.__repr__  s2    ?FF~.; G 
 
 	
r*   c                 8    t          | j        | j        f          S rS   )ri   r   r   r`   s    r(   rj   zExtrasCandidate.__hash__  s    TY,---r*   rk   c                 p    t          || j                  r | j        |j        k    o| j        |j        k    S dS rm   )r&   re   r   r   rn   s     r(   ro   zExtrasCandidate.__eq__  s9    eT^,, 	K9
*Jt{el/JJur*   c                     | j         j        S rS   )r   rt   r`   s    r(   rt   zExtrasCandidate.project_name      y%%r*   c                 @    t          | j        j        | j                  S rs   )r   r   rt   r   r`   s    r(   rQ   zExtrasCandidate.name  s     4914;???r*   c                     | j         j        S rS   )r   rJ   r`   s    r(   rJ   zExtrasCandidate.version  r   r*   c                     d                     | j                                        d                    t	          | j                                      S )Nz{} [{}]z, )rd   r   r{   r   sortedr   r`   s    r(   r{   z ExtrasCandidate.format_for_error  sC    I&&(($))F4;4G4G*H*H
 
 	
r*   c                     | j         j        S rS   )r   r   r`   s    r(   r   zExtrasCandidate.is_installed  r   r*   c                     | j         j        S rS   )r   r   r`   s    r(   r   zExtrasCandidate.is_editable      y$$r*   c                     | j         j        S rS   )r   rO   r`   s    r(   rO   zExtrasCandidate.source_link  r   r*   r   c              #   b  K   | j         j        }|                    | j                   V  |sd S | j                            | j         j                                                  }| j                            | j         j                                                  }t          |          D ].}t          
                    d| j         j        | j        |           /| j         j                            |          D ]6}|                    t          |          | j         j        |          }|r|V  7d S )Nz%%s %s does not provide the extra '%s')r   rV   make_requirement_from_candidater   intersectionrG   iter_provided_extras
differencer   r   warningrQ   rJ   r   r   r<   rW   )r[   r   rP   valid_extrasinvalid_extrasextrar   requirements           r(   r   z!ExtrasCandidate.iter_dependencies  s5     )$ 55di@@@@@ 	F {//	0S0S0U0UVV//	0S0S0U0UVVN++ 	 	ENN7		    11,?? 	" 	"A!<<A	 K  "!!!!	" 	"r*   c                     d S rS   r   r`   s    r(   r   z'ExtrasCandidate.get_install_requirement   s	     tr*   ) rf   r   r   r   BaseCandidater   r<   r\   ra   rg   r   rj   r   r   ro   r   r   rt   rQ   r   rJ   r{   r   r   r   r   rO   r   r   r   r   r   r   r*   r(   r   r     s&        0 # 
	   E E E E E
# 
 
 
 
.# . . . .C D    
 &n & & & X& @c @ @ @ X@ !) ! ! ! X!
# 
 
 
 

 &d & & & X& %T % % % X% %Xd^ % % % X%"t "+AV8W " " " "82D)E      r*   r   c                       e Zd ZdZdZdeeedf                  ddfdZde	fdZ
edefd            Zede	fd	            Zedefd
            Zde	fdZdedeee                  fdZdee         fdZdS )RequiresPythonCandidateFNpy_version_info.r$   c                     |t          |          }nt          j        d d         }t          d                    d |D                                 | _        d S )N   .c              3   4   K   | ]}t          |          V  d S rS   )r<   ).0cs     r(   	<genexpr>z3RequiresPythonCandidate.__init__.<locals>.<genexpr>  s(      (F(FAQ(F(F(F(F(F(Fr*   )r   sysversion_infor   r   rY   )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*   c                     d| j          S NzPython rY   r`   s    r(   ra   zRequiresPythonCandidate.__str__  s    ((((r*   c                     t           S rS   REQUIRES_PYTHON_IDENTIFIERr`   s    r(   rt   z$RequiresPythonCandidate.project_name      ))r*   c                     t           S rS   r   r`   s    r(   rQ   zRequiresPythonCandidate.name  r   r*   c                     | j         S rS   r   r`   s    r(   rJ   zRequiresPythonCandidate.version!  s
    }r*   c                     d| j          S r   )rJ   r`   s    r(   r{   z(RequiresPythonCandidate.format_for_error%  s    ''''r*   r   c                     dS r   r   )r[   r   s     r(   r   z)RequiresPythonCandidate.iter_dependencies(  s    rr*   c                     d S rS   r   r`   s    r(   r   z/RequiresPythonCandidate.get_install_requirement+  r   r*   )rf   r   r   r   rO   r   r   r   r\   r<   ra   r   r   rt   rQ   r   rJ   r{   r   r   r   r   r   r   r   r*   r(   r   r     sL       LKHsCx(A Hd H H H H) ) ) ) ) *n * * * X* *c * * * X* )    X(# ( ( ( (t +AV8W    2D)E      r*   r   ):loggingr   typingr   r   r   r   r   r   r	   r
   pip._vendor.packaging.utilsr   r   pip._vendor.packaging.versionr   pip._internal.exceptionsr   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   r   rP   r   	getLoggerrf   r   r   r   r)   rC   rF   rL   rN   r"   r!   r    r   r   r   r*   r(   <module>r     s    



 X X X X X X X X X X X X X X X X X X X X 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 ; ; ; ; ; ; G G G G G G G G G G G G !      		8	$	$ "T.2QRR 	 	x/F 	 	 	 	
,   6
,   *
&8   6} } } } } } } }@4U 4U 4U 4U 4U6 4U 4U 4UnO O O O O: O O O0@ @ @ @ @	 @ @ @Fr r r r ri r r rj% % % % %i % % % % %r*   