
    q"hP                    >   S SK Jr  S SKrS SKrS SKrS SKJrJrJrJ	r	J
r
  SSKJrJrJrJrJrJrJrJrJr  SSKJrJr  SSKJr  SS	KJrJrJrJrJr  \(       a  SS
K J!r!J"r"  SSK#J$r$  SS jr% " S S\\\\4   5      r& " S S\\\\4   5      r'          SS jr(g)    )annotationsN)TYPE_CHECKING
CollectionGenericIterableMapping   )	CTKTRTDirectedGraphIterableViewIteratorMappingRequirementInformationStatebuild_iter_view   )AbstractResolverResult)	Criterion)InconsistentCandidateRequirementsConflictedResolutionImpossibleResolutionTooDeepResolverException)AbstractProvider
Preference)BaseReporterc                   U R                   nUR                  5        VVs0 s H  u  p#[        U5      U_M     nnnS U[        S 5      '   [        5       nUR	                  S 5        S 1nU R
                  R                  5        H  u  px[        U R
                  XtU5      (       d  M#  Xu;  a  UR	                  U5        UR                  5        H9  n	 U[        U	5         n
X;  a  UR	                  U
5        UR                  X5        M;     M     [        UR                  5        VVs0 s H  u  p#X&;   d  M  X#_M     snnUU R
                  S9$ s  snnf ! [         a     M  f = fs  snnf )N)mappinggraphcriteria)r    itemsidr   addr"   _has_route_to_rootiter_parentKeyErrorconnectr   )stater    kvall_keysr!   	connectedkey	criterionppkeys              ]/var/www/html/env/lib/python3.13/site-packages/pip/_vendor/resolvelib/resolvers/resolution.py_build_resultr4   "   s4   mmG;B==?%K?41beQh?H%KHRX&3oE	IIdO!%I....0!%..#KKIIcN&&(A1  		$MM$$ ) 1 ")--/D/$!Q^/D + &L   Es#   E
E#E!
2E!

EEc                      \ rS rSrSr      SS jr\SS j5       rSS jr        SS jr	      SS jr
SS jr      SS	 jrSS
 jrSS jr    SS jrSS jr    SS jrSS jrSrg)
Resolution@   zStateful resolution object.

This is designed as a one-off object that holds information to kick start
the resolution process, and holds the results afterwards.
c                *    Xl         X l        / U l        g N_p_r_states)selfproviderreporters      r3   __init__Resolution.__init__G   s    
 02    c                ^     U R                   S   $ ! [         a  n[        S5      UeS nAff = f)Nr*   )r=   
IndexErrorAttributeError)r>   es     r3   r*   Resolution.stateP   s3    	1<<## 	1 )q0	1s    
,',c                    U R                   S   n[        UR                  R                  5       UR                  R                  5       UR
                  SS S9nU R                   R                  U5        g)zqPush a new state into history.

This new state will be used to hold resolution results of the next
coming round.
rE   Nr    r"   backtrack_causes)r=   r   r    copyr"   rL   append)r>   baser*   s      r3   _push_new_stateResolution._push_new_stateW   s^     ||BLL%%']]'')!2215

 	E"rC   c           
     n   U R                   R                  X#S9  U R                  R                  US9nUR	                  U5      nU(       a  [        UR                  5      nO/ nU R                  R                  U[        U[        R                  " S5      XB/05      [        U[        R                  " S5      XF05      S9nU(       a0  [        UR                  5      nUR                  [        X#5      5        O[        X#5      /n[        [!        U5      UUS9nUR"                  (       d  [%        U5      eXQU'   g )N)requirementparent)requirement_or_candidateiter_requirementincompatibilities
identifierrequirementsrW   
candidatesinformationrW   )r<   adding_requirementr;   identifygetlistrW   find_matchesr   operatormethodcaller
attrgetterr]   rN   r   r   r   r\   r   )	r>   r"   rS   rT   rY   r0   rW   matchesr]   s	            r3   _add_to_criteriaResolution._add_to_criteriae   s$    	""{"JWW%%{%K
LL,	 $Y%@%@ A "''&&!(%%&89]+
 .##$78/ ' 
 y445K5kJK1+FGK&w/#/
	
 ##(33(rC   c           
     <   U(       d  gUR                  5        H{  u  p4[        UR                  UR                   Vs/ s H=  nUR                  b+  U R
                  R                  UR                  5      U;  d  M;  UPM?     snUR                  5      X'   M}     gs  snf )a/  Remove information from parents of criteria.

Concretely, removes all values from each criterion's ``information``
field that have one of ``parents`` as provider of the requirement.

:param criteria: The criteria to update.
:param parents: Identifiers for which to remove information from all criteria.
N)r#   r   r\   r]   rT   r;   r_   rW   )r>   r"   parentsr/   r0   r]   s         r3   !_remove_information_from_criteria,Resolution._remove_information_from_criteria   s     &nn.NC%$$ (1'<'<'<#**277++K,>,>?wN	  '< ++HM /s   :B:Bc                T   U R                   R                  UU R                  R                  [	        U R                  R
                  [        R                  " S5      5      [	        U R                  R
                  [        R                  " S5      5      U R                  R                  S9$ )Nr\   r]   )rY   resolutionsr\   r]   rL   )	r;   get_preferencer*   r    r   r"   rc   re   rL   )r>   names     r3   _get_preferenceResolution._get_preference   s    ww%%

**&

####L1 (

####M2 "ZZ88 & 
 	
rC   c                   ^ ^  T R                   R                  U   m[        UU 4S jUR	                  5        5       5      $ ! [         a     gf = f)NFc              3  X   >#    U  H  nTR                   R                  UTS 9v   M!     g7f)rS   	candidateNr;   is_satisfied_by).0rcurrent_pinr>   s     r3   	<genexpr>8Resolution._is_current_pin_satisfying.<locals>.<genexpr>   s,      
1 GG##[#I1   '*)r*   r    r(   allrV   )r>   rp   r0   r{   s   `  @r3   _is_current_pin_satisfying%Resolution._is_current_pin_satisfying   sU    	**,,T2K  
//1
 
 	
  		s   A 
AAc                    U R                   R                  R                  5       nU R                  R	                  US9 H  nU R                  X#US9  M     U$ )Nrv   rT   )r*   r"   rM   r;   get_dependenciesrg   )r>   rv   r"   rS   s       r3   _get_updated_criteria Resolution._get_updated_criteria   sO    ::&&++-7733i3HK!!(	!J IrC   c                  ^ ^ T R                   R                  U   n/ nUR                   H  m T R                  T5      n[        UU 4S jUR                  5        5       5      nU(       d  [        TU5      eT R
                  R                  TS9  T R                   R                  R                  U5        T R                   R                  R                  US 5        TT R                   R                  U'   / s  $    U$ ! [         aM  nT R
                  R                  UR                  T5        UR                  UR                  5         S nAGM#  S nAff = f)Nc              3  X   >#    U  H  nTR                   R                  UTS 9v   M!     g7fru   rw   )ry   rz   rv   r>   s     r3   r|   7Resolution._attempt_to_pin_criterion.<locals>.<genexpr>   s,      5A ''A'K5r~   r   )r*   r"   r\   r   r   r<   rejecting_candidater0   rN   r   rV   r   pinningupdater    pop)r>   rp   r0   causesr"   rH   	satisfiedrv   s   `      @r3   _attempt_to_pin_criterion$Resolution._attempt_to_pin_criterion   s   JJ''-	*,"--I55i@  "335 I +IyAAGGOOiO0JJ&&x0 JJ""4.'0DJJt$I7 .> 9 * ++AKKCakk*s   C;;
EAEEc                R   U GH  u  p#U(       d  M   U R                   R                  U   nU R                  R	                  U[        U R                   R                  [        R                  " S5      5      [        U R                   R                  [        R                  " S5      X#05      S9n[        U5      nU(       d    gUR                  UR                  5        [        U[        UR                  5      US9U R                   R                  U'   GM     g! [         a     GM"  f = f)NrV   rW   rX   Fr[   T)r*   r"   r(   r;   rb   r   rc   rd   re   r   extendrW   r   ra   r]   )r>   incompatibilities_from_brokenr+   rW   r0   rf   r\   s          r3   _patch_criteriaResolution._patch_criteria   s   
 %B A$ JJ//2	 gg**,JJ''))*<= #2JJ''''(;<*# + G ,;7+CJ$$Y%@%@A%.% !6!67"3&DJJ"/ %B8 /  s   D
D&%D&c                   [         R                  " S U 5       S U 5       5      nU Vs1 s H  o0R                  R                  U5      iM     nn[	        U R
                  5      S:  Ga`  U R
                  S	 U R                  n  U R
                  R                  5       nUR                  R                  5       u  pgXd;  a  OnU R                  R                  U5       Vs1 s H  oR                  R                  U5      iM     n	nU	R                  U5      (       d  OUR                  (       d  OM  UR                  R!                  5        V
Vs/ s H  u  pU
[#        UR$                  5      4PM     nn
nUR'                  Xg/45        U R)                  5         U R+                  U5      nU(       a  g[	        U R
                  5      S:  a  GM`  gs  snf ! [        [        4 a    [        U5      Sef = fs  snf s  snn
f )ar  Perform backjumping.

When we enter here, the stack is like this::

    [ state Z ]
    [ state Y ]
    [ state X ]
    .... earlier states are irrelevant.

1. No pins worked for Z, so it does not have a pin.
2. We want to reset state Y to unpinned, and pin another candidate.
3. State X holds what state Y was before the pin, but does not
   have the incompatibility information gathered in state Y.

Each iteration of the loop will:

1.  Identify Z. The incompatibility is not always caused by the latest
    state. For example, given three requirements A, B and C, with
    dependencies A1, B1 and C1, where A1 and B1 are incompatible: the
    last state might be related to C, so we want to discard the
    previous state.
2.  Discard Z.
3.  Discard Y but remember its incompatibility information gathered
    previously, and the failure we're dealing with right now.
4.  Push a new state Y' based on X, and apply the incompatibility
    information from Y to Y'.
5a. If this causes Y' to conflict, we need to backtrack again. Make Y'
    the new Z and go back to step 2.
5b. If the incompatibilities apply cleanly, end backtracking.
c              3  V   #    U  H  oR                   c  M  UR                   v   M!     g 7fr9   r   ry   cs     r3   r|   'Resolution._backjump.<locals>.<genexpr>5  s     >v!XQXXvs   ))c              3  8   #    U  H  oR                   v   M     g 7fr9   )rS   r   s     r3   r|   r   6  s     +Fq]]Fs      rE   TNF)	itertoolschainr;   r_   lenr=   r*   r   r    popitemrF   r(   r   r   
isdisjointr"   r#   ra   rW   rN   rP   r   )r>   r   incompatible_reqsrz   incompatible_depsbroken_staterp   rv   dcurrent_dependenciesr+   r,   r   successs                 r3   	_backjumpResolution._backjump  s   > 09>v>+F+0
 ;LL:KQWW--a0:KL$,,1$R   ::LA#'<<#3#3#5L&2&:&:&B&B&DOD 0
 261I1I)1T(1TAGG$$Q'1T % ( ,667HII
 $++3 8 <H;P;P;V;V;X-;X41D,,-.;X * -
 *00$1DE  "**+HIG [ $,,1$f i M #H- A.v6D@A(-s   $G6G $G0#G5G-c           
         [        U VVs0 s H"  o"R                    H  n[        U5      U_M     M$     snnR                  5       5      $ s  snnf )z5Extract causes from list of criterion and deduplicate)ra   r]   r$   values)r>   criteronr   is       r3   _extract_causesResolution._extract_causesn  s<     xGx!ARUAXUxGNNPQQGs   )A

c                "   U R                   (       a  [        S5      eU R                  R                  5         [	        [
        R                  " 5       0 / S9/U l         U H)  n U R                  U R                  R                  US S9  M+     U R                  5         [        U5       GH  nU R                  R!                  US9  U R                  R                  R#                  5        VVs/ s H  u  pgU R%                  Xg5      (       a  M  UPM!     nnnU(       d1  U R                  R'                  U R                  S9  U R                  s  $ [)        U R                  R                  R+                  5       5      [)        U5      -
  n	[-        U5      S:  a  [/        U R0                  R3                  UU R                  R4                  [7        U R                  R                  [8        R:                  " S5      5      [7        U R                  R                  [8        R:                  " S5      5      U R                  R<                  S	95      n
OUn
U
(       d  [        S
5      e[-        U
5      S:  a  [?        XR@                  S9nOU
S   nU RC                  U5      nU(       az  U RE                  U5      nU R                  RG                  US9  U RI                  U5      nXR                  R<                  S S & U(       d  [        U R                  R<                  5      eOU R                  R                  R#                  5        VVs1 s H&  u  pgXi;   d  M  U R%                  Xg5      (       a  M$  UiM(     nnnU RK                  U R                  R                  U5        U R                  5         U R                  RM                  XPR                  S9  GM!     [O        U5      e! [         a%  n[        UR                  R                  5      UeS nAff = fs  snnf s  snnf )Nzalready resolvedrK   r   )index)r*   r   r\   r]   )identifiersrn   r\   r]   rL   z-narrow_requirement_selection returned 0 names)r/   r   )r   )r   r*   )(r=   RuntimeErrorr<   startingr   collectionsOrderedDictrg   r*   r"   r   r   r0   r]   rP   rangestarting_roundr#   r   endingsetkeysr   ra   r;   narrow_requirement_selectionr    r   rc   re   rL   minrq   r   r   resolving_conflictsr   rk   ending_roundr   )r>   rZ   
max_roundsrz   rH   round_indexr/   r0   unsatisfied_namessatisfied_namesnarrowed_unstatisfied_namesrp   failure_criterionr   r   newly_unsatisfied_namess                   r3   resolveResolution.resolvet  sv   <<122 #//1!#
 AK%%djj&9&91T%J  	 ,KGG"""5 '+jj&9&9&?&?&A!&ANC66sF &A  ! %TZZ0zz! "$**"5"5":":"<=DU@VVO$%).2GG88$5$(JJ$6$6#2 JJ//$//=$ %4 JJ//$//>% *.)D)D 9 /+  /@+ /"#RSS ./!36<P<PQ215 $ > >t D --.?@ ++6+:..017

++A. .tzz/J/JKK  +/***=*=*C*C*E+*E-  !;;CK *E ( + 66JJ'')@ $$&GG  {** EW -Z  
++k * K*1;;+B+BCJK!x+s6   !%O)P	P:P	P!P
P O==Pr:   N)r?   zAbstractProvider[RT, CT, KT]r@   zBaseReporter[RT, CT, KT]returnNone)r   State[RT, CT, KT])r   r   )r"   dict[KT, Criterion[RT, CT]]rS   r   rT   z	CT | Noner   r   )r"   r   rj   zCollection[KT]r   r   )rp   r   r   r   )rp   r   r0   zCriterion[RT, CT]r   bool)rv   r
   r   r   )rp   r   r   list[Criterion[RT, CT]])r   zlist[tuple[KT, list[CT]]]r   r   )r   $list[RequirementInformation[RT, CT]]r   r   )r   r   r   r   )rZ   Iterable[RT]r   intr   r   )__name__
__module____qualname____firstlineno____doc__rA   propertyr*   rP   rg   rk   rq   r   r   r   r   r   r   r   __static_attributes__ rC   r3   r6   r6   @   s    3.3 +3 
	3 1 1#*)-*) *) 	*)
 
*)X3>L	6




#4

	

#J!-F!	!FWrR/R	-Rf,rC   r6   c                  6    \ rS rSrSr\r S     SS jjrSrg)Resolveri  z3The thing that performs the actual resolution work.c                v    [        U R                  U R                  5      nUR                  XS9n[	        U5      $ )af  Take a collection of constraints, spit out the resolution result.

The return value is a representation to the final resolution result. It
is a tuple subclass with three public members:

* `mapping`: A dict of resolved candidates. Each key is an identifier
    of a requirement (as returned by the provider's `identify` method),
    and the value is the resolved candidate.
* `graph`: A `DirectedGraph` instance representing the dependency tree.
    The vertices are keys of `mapping`, and each edge represents *why*
    a particular package is included. A special vertex `None` is
    included to represent parents of user-supplied requirements.
* `criteria`: A dict of "criteria" that hold detailed information on
    how edges in the graph are derived. Each key is an identifier of a
    requirement, and the value is a `Criterion` instance.

The following exceptions may be raised if a resolution cannot be found:

* `ResolutionImpossible`: A resolution cannot be found for the given
    combination of requirements. The `causes` attribute of the
    exception is a list of (requirement, parent), giving the
    requirements that could not be satisfied.
* `ResolutionTooDeep`: The dependency tree is too deeply nested and
    the resolver gave up. This is usually caused by a circular
    dependency, but you can try to resolve this by increasing the
    `max_rounds` argument.
)r   )r6   r?   r@   r   r4   )r>   rZ   r   
resolutionr*   s        r3   r   Resolver.resolve  s7    @  t}}=
""<"GU##rC   r   N)d   )rZ   r   r   r   r   Result[RT, CT, KT])	r   r   r   r   r   r   base_exceptionr   r   r   rC   r3   r   r     s5    =&N
 "$""$ "$ 
	"$ "$rC   r   c                   X;   a  gX;  a  gUc   eX   R                  5        HN  n U[        U5         nXS;   a  UR                  U5          g[	        XX#5      (       d  M=  UR                  U5          g   g! [         a     M`  f = f)NTF)r'   r$   r(   r%   r&   )r"   r/   r-   r.   r1   r2   s         r3   r&   r&     s     
??]&&(	BqE?D MM#hhBBMM# )   		s   A77
BB)r*   r   r   r   )
r"   zMapping[KT, Criterion[RT, CT]]r/   z	KT | Noner-   zdict[int, KT | None]r.   zset[KT | None]r   r   ))
__future__r   r   r   rc   typingr   r   r   r   r   structsr
   r   r   r   r   r   r   r   r   abstractr   r   r0   r   
exceptionsr   r   r   r   r   	providersr   r   	reportersr   r4   r6   r   r&   r   rC   r3   <module>r      s    "    H H
 
 
 /    8(<Z,R$ Z,z'$B
+ '$T,	 # 	
 
rC   