
    *,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 jV                  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%      Z9y)'    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                 B    t         t        t        f}t        | |      r| S y)z%The runtime version of BaseCandidate.N)r    r!   r"   
isinstance)r#   base_candidate_classess     p/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.pyas_base_candidater)   )   s+     	"
 )34    linktemplatec                    |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/   r0   r1   r2   r3   r4   r5   r6   original_linkr+   extras)r+   r,   lineireqs       r(   make_install_req_from_linkr?   5   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/   r0   r1   r2   r3   permit_editable_wheelsr4   r5   r6   )r7   r   r:   r/   r0   r1   r2   r3   rA   r4   r5   r6   r<   )r+   r,   r>   s      r(   make_install_req_from_editablerB   N   s     555$,,&&&&""&&'>>..** 00D //DKKr*   distc                    |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.   )r8   r9   r+   canonical_namer:   versionr   r/   r0   r1   r2   r3   r4   r5   r6   satisfied_by)rC   r,   r=   r>   s       r(   _make_install_req_from_distrH   b   s     ||8<< 	%%&c(--*;*;)<=%%&b7 ,,&&&&""&&..** 00
D DKr*   c                   J   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!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).
    rC   FNr+   source_linkr>   factoryr   namerF   r$   c                     || _         || _        || _        || _        || _        || _        | j                         | _        y N)_link_source_link_factory_ireq_name_version_preparerC   )selfr+   rK   r>   rL   rM   rF   s          r(   __init__z+_InstallRequirementBackedCandidate.__init__   s<     
'

MMO	r*   c                 8    | j                    d| j                   S )N rM   rF   rW   s    r(   __str__z*_InstallRequirementBackedCandidate.__str__   s    ))Adll^,,r*   c                 v    dj                  | j                  j                  t        | j                              S )Nz{class_name}({link!r}))
class_namer+   )format	__class____name__r9   rP   r\   s    r(   __repr__z+_InstallRequirementBackedCandidate.__repr__   s2    '..~~..TZZ / 
 	
r*   c                 D    t        | j                  | j                  f      S rO   )hashra   rP   r\   s    r(   __hash__z+_InstallRequirementBackedCandidate.__hash__   s    T^^TZZ011r*   otherc                 p    t        || j                        r t        | j                  |j                        S yNF)r&   ra   r   rP   rW   rg   s     r(   __eq__z)_InstallRequirementBackedCandidate.__eq__   s(    eT^^,#DJJ<<r*   c                     | j                   S rO   )rQ   r\   s    r(   rK   z._InstallRequirementBackedCandidate.source_link          r*   c                 h    | j                   | j                  j                  | _         | j                   S z:The normalised name of the project the candidate refers to)rT   rC   rE   r\   s    r(   project_namez/_InstallRequirementBackedCandidate.project_name   s)     ::11DJzzr*   c                     | j                   S rO   rp   r\   s    r(   rM   z'_InstallRequirementBackedCandidate.name   rm   r*   c                 h    | j                   | j                  j                  | _         | j                   S rO   rU   rC   rF   r\   s    r(   rF   z*_InstallRequirementBackedCandidate.version   '    ==  II--DM}}r*   c                     dj                  | j                  | j                  | j                  j                  r| j                  j
                        S | j                        S )Nz{} {} (from {}))r`   rM   rF   rP   is_file	file_pathr\   s    r(   format_for_errorz3_InstallRequirementBackedCandidate.format_for_error   sP     ''IILL$(JJ$6$6DJJ  
 	
 =AJJ
 	
r*   c                     t        d      )NzOverride in subclass)NotImplementedErrorr\   s    r(   _prepare_distributionz8_InstallRequirementBackedCandidate._prepare_distribution   s    !"899r*   c                 n   | j                   E| j                   |j                  k7  r,t        | j                  d| j                   |j                        | j                  X| j                  |j
                  k7  r>t        | j                  dt        | j                        t        |j
                              yy)z:Check for consistency of project name and version of dist.NrM   rF   )rT   rE   r   rS   rU   rF   r9   )rW   rC   s     r(   _check_metadata_consistencyz>_InstallRequirementBackedCandidate._check_metadata_consistency   s    ::!djjD4G4G&G&



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

DMM"DLL!	  *G$r*   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   rS   r8   r   contextr~   )rW   rC   eexcs       r(   rV   z+_InstallRequirementBackedCandidate._prepare   s_    	--/D 	((.  	 JJAE* 	1CK	s    % 	AA  AAAwith_requiresc              #     K   |r| j                   j                         nd}|D ]3  }| j                  j                  t	        |      | j
                         5 | j                  j                  | j                   j                         y wN )rC   iter_dependenciesrR   make_requirement_from_specr9   rS    make_requires_python_requirementrequires_python)rW   r   requiresrs       r(   r   z4_InstallRequirementBackedCandidate.iter_dependencies   sk     4A499..0r 	OA--::3q64::NN	Omm<<TYY=V=VWWs   B	Bc                     | j                   S rO   )rS   r\   s    r(   get_install_requirementz:_InstallRequirementBackedCandidate.get_install_requirement   s    zzr*   NN)"rb   
__module____qualname____doc__r   __annotations__is_installedr   r   r   r   r   rX   r9   r]   rc   intrf   r   boolrk   propertyrK   rp   rM   rF   ry   r|   r~   rV   r   r   r   r   r   r*   r(   rJ   rJ   z   s    L *..2$$ $ !	$
 $ ~&$ *+$ 
$"- -
# 
2# 2C D 
 !Xd^ ! ! n   !c ! ! )  

# 
:'7 :0@ T "* "Xt X+AV8W X2D)E r*   rJ   c                   Z     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,   rL   r   rM   rF   r$   c                 h   |}|j                  ||      }|,t        j                  d|j                         |j                  }t	        ||      }|j                  |k(  sJ |j                  j
                  r|j                  j                  szt        |j                  j                        }	t        |	j                        }
||
k(  sJ |d|
d       |2t        |	j                        }||k(  sJ dj                  |||             ||j                  j
                  sJ |j                  j                  sJ |j                  r|j                  |j                  u r||_        |j"                  |j"                  |_        nt'        ||j                        |_        t(        | U  ||||||       y )NzUsing cached wheel link: %sz != z
 for wheelz{!r} != {!r} for wheel {})link_is_in_wheel_cacher+   rK   r>   rL   rM   rF   )get_wheel_cache_entryloggerdebugr+   r?   is_wheelrw   r   filenamer   rM   r   rF   r`   
persistentr;   cached_wheel_source_linkorigindownload_infor   superrX   )rW   r+   r,   rL   rM   rF   rK   cache_entryr>   wheel
wheel_namewheel_versionra   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-/ 1L1S1S]D2  "99%%%99$$$%%(--8;Q;Q*Q0;-!!-%0%7%7" &:8N8N&" 	# 	 	
r*   c                 h    | j                   j                  }|j                  | j                  d      S )NT)parallel_builds)rR   preparerprepare_linked_requirementrS   )rW   r   s     r(   r|   z#LinkCandidate._prepare_distribution.  s+    ==))224::t2TTr*   r   rb   r   r   is_editabler   r   r   r   r   rX   r   r|   __classcell__ra   s   @r(   r"   r"      sj    K *..2/
/
 %/
 	/

 ~&/
 *+/
 
/
bU'7 Ur*   r"   c                   Z     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,   rL   r   rM   rF   r$   c                 D    t         |   ||t        ||      |||       y )Nr   )r   rX   rB   )rW   r+   r,   rL   rM   rF   ra   s         r(   rX   zEditableCandidate.__init__6  s0     	/h? 	 	
r*   c                 `    | j                   j                  j                  | j                        S rO   )rR   r   prepare_editable_requirementrS   r\   s    r(   r|   z'EditableCandidate._prepare_distributionG  s!    }}%%BB4::NNr*   r   r   r   s   @r(   r!   r!   3  si    K *..2

 %
 	

 ~&
 *+
 

"O'7 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y)r    TNrC   r,   rL   r   r$   c                     || _         t        ||      | _        || _        d | _        d}|j
                  j                  | j                  |       y )Nzalready satisfied)rC   rH   rS   rR   rU   r   prepare_installed_requirement)rW   rC   r,   rL   skip_reasons        r(   rX   z"AlreadyInstalledCandidate.__init__O  sH     	0x@
 *66tzz;Or*   c                 ,    t        | j                        S rO   )r9   rC   r\   s    r(   r]   z!AlreadyInstalledCandidate.__str__a  s    499~r*   c                 d    dj                  | j                  j                  | j                        S )Nz{class_name}({distribution!r}))r_   distribution)r`   ra   rb   rC   r\   s    r(   rc   z"AlreadyInstalledCandidate.__repr__d  s.    /66~~.. 7 
 	
r*   c                 Z    t        | j                  | j                  | j                  f      S rO   )re   ra   rM   rF   r\   s    r(   rf   z"AlreadyInstalledCandidate.__hash__j  s     T^^TYY=>>r*   rg   c                     t        || j                        r4| j                  |j                  k(  xr | j                  |j                  k(  S yri   )r&   ra   rM   rF   rj   s     r(   rk   z AlreadyInstalledCandidate.__eq__m  s8    eT^^,99

*Lt||u}}/LLr*   c                 .    | j                   j                  S rO   )rC   rE   r\   s    r(   rp   z&AlreadyInstalledCandidate.project_namer  s    yy'''r*   c                     | j                   S rO   rr   r\   s    r(   rM   zAlreadyInstalledCandidate.namev  rm   r*   c                 h    | j                   | j                  j                  | _         | j                   S rO   rt   r\   s    r(   rF   z!AlreadyInstalledCandidate.versionz  ru   r*   c                 .    | j                   j                  S rO   )rC   r7   r\   s    r(   r   z%AlreadyInstalledCandidate.is_editable  s    yy!!!r*   c                 :    | j                    d| j                   dS )NrZ   z (Installed)r[   r\   s    r(   ry   z*AlreadyInstalledCandidate.format_for_error  s    ))Adll^<88r*   r   c              #      K   |sy | j                   j                         D ]3  }| j                  j                  t	        |      | j
                         5 y wrO   )rC   r   rR   r   r9   rS   )rW   r   r   s      r(   r   z+AlreadyInstalledCandidate.iter_dependencies  sI     ,,. 	OA--::3q64::NN	Os   AAc                      y rO   r   r\   s    r(   r   z1AlreadyInstalledCandidate.get_install_requirement      r*   )rb   r   r   r   rK   r   r   rX   r9   r]   rc   r   rf   r   r   rk   r   r   rp   rM   r   rF   r   ry   r   r   r   r   r   r   r*   r(   r    r    K  s   LKPP %P 	P
 
P$ 
# 
?# ?C D 
 (n ( ( !c ! ! )  
 "T " "9# 9Ot O+AV8W O2D)E r*   r    c                   "   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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.
    baser<   r$   Nc                      || _         || _        y rO   )r   r<   )rW   r   r<   s      r(   rX   zExtrasCandidate.__init__  s    
 	r*   c                     t        | j                        j                  dd      \  }}dj                  |dj	                  | j
                        |      S )NrZ   r   z	{}[{}] {},)r9   r   splitr`   joinr<   )rW   rM   rests      r(   r]   zExtrasCandidate.__str__  sB    ^))#q1
d!!$(=tDDr*   c                 z    dj                  | j                  j                  | j                  | j                        S )Nz.{class_name}(base={base!r}, extras={extras!r}))r_   r   r<   )r`   ra   rb   r   r<   r\   s    r(   rc   zExtrasCandidate.__repr__  s6    ?FF~~..;; G 
 	
r*   c                 D    t        | j                  | j                  f      S rO   )re   r   r<   r\   s    r(   rf   zExtrasCandidate.__hash__  s    TYY,--r*   rg   c                     t        || j                        r4| j                  |j                  k(  xr | j                  |j                  k(  S yri   )r&   ra   r   r<   rj   s     r(   rk   zExtrasCandidate.__eq__  s8    eT^^,99

*Jt{{ell/JJr*   c                 .    | j                   j                  S rO   )r   rp   r\   s    r(   rp   zExtrasCandidate.project_name      yy%%%r*   c                 V    t        | j                  j                  | j                        S ro   )r   r   rp   r<   r\   s    r(   rM   zExtrasCandidate.name  s     499114;;??r*   c                 .    | j                   j                  S rO   )r   rF   r\   s    r(   rF   zExtrasCandidate.version  s    yy   r*   c                     dj                  | j                  j                         dj                  t	        | j
                                    S )Nz{} [{}]z, )r`   r   ry   r   sortedr<   r\   s    r(   ry   z ExtrasCandidate.format_for_error  s9    II&&($))F4;;4G*H
 	
r*   c                 .    | j                   j                  S rO   )r   r   r\   s    r(   r   zExtrasCandidate.is_installed  r   r*   c                 .    | j                   j                  S rO   )r   r   r\   s    r(   r   zExtrasCandidate.is_editable      yy$$$r*   c                 .    | j                   j                  S rO   )r   rK   r\   s    r(   rK   zExtrasCandidate.source_link  r   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 ]9  }|j                  t        |      | j                   j                   |      }|s6| ; y w)Nz%%s %s does not provide the extra '%s')r   rR   make_requirement_from_candidater<   intersectionrC   iter_provided_extras
differencer   r   warningrM   rF   r   r   r9   rS   )rW   r   rL   valid_extrasinvalid_extrasextrar   requirements           r(   r   z!ExtrasCandidate.iter_dependencies  s    ))$$ 55dii@@ {{//		0S0S0UV//		0S0S0UVN+ 	ENN7				 11,? 	"A!<<A		K !!	"s   EEEc                      y rO   r   r\   s    r(   r   z'ExtrasCandidate.get_install_requirement  s     r*   ) rb   r   r   r   BaseCandidater   r9   rX   r]   rc   r   rf   r   r   rk   r   r   rp   rM   r   rF   ry   r   r   r   r   rK   r   r   r   r   r   r   r*   r(   r   r     sJ   0 # 
	E E
# 
.# .C D 
 &n & & @c @ @ !) ! !
# 

 &d & & %T % % %Xd^ % %"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y)RequiresPythonCandidateFNpy_version_info.r$   c                     |t        |      }nt        j                  d d }t        dj	                  d |D                    | _        y )N   .c              3   2   K   | ]  }t        |        y wrO   )r9   ).0cs     r(   	<genexpr>z3RequiresPythonCandidate.__init__.<locals>.<genexpr>  s     (FAQ(Fs   )r   sysversion_infor   r   rU   )rW   r   r   s      r(   rX   z RequiresPythonCandidate.__init__
  s?    &1/BL++BQ/L(F(F FGr*   c                      d| j                    S NzPython rU   r\   s    r(   r]   zRequiresPythonCandidate.__str__  s    ((r*   c                     t         S rO   REQUIRES_PYTHON_IDENTIFIERr\   s    r(   rp   z$RequiresPythonCandidate.project_name      ))r*   c                     t         S rO   r   r\   s    r(   rM   zRequiresPythonCandidate.name  r   r*   c                     | j                   S rO   r   r\   s    r(   rF   zRequiresPythonCandidate.version   s    }}r*   c                      d| j                    S r   )rF   r\   s    r(   ry   z(RequiresPythonCandidate.format_for_error$  s    ''r*   r   c                      yr   r   )rW   r   s     r(   r   z)RequiresPythonCandidate.iter_dependencies'  s    r*   c                      y rO   r   r\   s    r(   r   z/RequiresPythonCandidate.get_install_requirement*  r   r*   )rb   r   r   r   rK   r   r   r   rX   r9   r]   r   r   rp   rM   r   rF   ry   r   r   r   r   r   r   r   r*   r(   r   r     s    LKHsCx(A Hd H) ) *n * * *c * * )  (# (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   rL   r   	getLoggerrb   r   r   r   r)   r?   rB   rH   rJ   r"   r!   r    r   r   r   r*   r(   <module>r     sC    
 X X X I 1 
 4 < , = G ; G G 			8	$ ".2QR 	 	x/F 	
,2
,(
&80} }@6U6 6UrO: O0C	 CLri rj%i %r*   