
    ]h]                    V   % S SK Jr  S SKrS SKrS SKrS SK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J r   SSK!J"r"J#r#  SSK$J%r%  Sr&S\'S'   SS jr( " S S\\\	\
4   5      r) " S S\\\	\
4   5      r*          SS jr+g)    )annotationsN)TYPE_CHECKINGGeneric   )	CTKTRTDirectedGraphIterableViewIteratorMappingRequirementInformationStatebuild_iter_view   )AbstractResolverResult)	Criterion)InconsistentCandidateRequirementsConflictedResolutionImpossibleResolutionTooDeepResolverException)
CollectionIterableMapping)AbstractProvider
Preference)BaseReporterg?float_OPTIMISTIC_BACKJUMPING_RATIOc                   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_resultr6   &   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S jrS S jrSrg)!
ResolutionD   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        [        U l        S U l        S U l        g N)_p_r_statesr    _optimistic_backjumping_ratio_save_states_optimistic_start_round)selfproviderreporters      r5   __init__Resolution.__init__K   s0    
 02 .K*<@37$    c                ^     U R                   S   $ ! [         a  n[        S5      UeS nAff = f)Nr,   )r>   
IndexErrorAttributeError)rB   es     r5   r,   Resolution.stateY   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.
rI   Nr"   r$   backtrack_causes)r>   r   r"   copyr$   rP   append)rB   baser,   s      r5   _push_new_stateResolution._push_new_state`   s^     ||BLL%%']]'')!2215

 	E"rG   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requirementsr[   
candidatesinformationr[   )r=   adding_requirementr<   identifygetlistr[   find_matchesr   operatormethodcaller
attrgetterra   rR   r   r   r   r`   r   )	rB   r$   rW   rX   r]   r2   r[   matchesra   s	            r5   _add_to_criteriaResolution._add_to_criterian   s$    	""{"JWW%%{%K
LL,	 $Y%@%@ A "''&&!(%%&89]+
 .##$78/ ' 
 y445K5kJK1+FGK&w/#/
	
 ##(33(rG   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`   ra   rX   r<   rc   r[   )rB   r$   parentsr1   r2   ra   s         r5   !_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`   ra   )r]   resolutionsr`   ra   rP   )	r<   get_preferencer,   r"   r   r$   rg   ri   rP   )rB   names     r5   _get_preferenceResolution._get_preference   s    ww%%

**&

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

####M2 "ZZ88 & 
 	
rG   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)rW   	candidateNr<   is_satisfied_by).0rcurrent_pinrB   s     r5   	<genexpr>8Resolution._is_current_pin_satisfying.<locals>.<genexpr>   s,      
1 GG##[#I1   '*)r,   r"   r*   allrZ   )rB   rt   r2   r   s   `  @r5   _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rz   rX   )r,   r$   rQ   r<   get_dependenciesrk   )rB   rz   r$   rW   s       r5   _get_updated_criteria Resolution._get_updated_criteria   sO    ::&&++-7733i3HK!!(	!J IrG   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ry   r{   )r}   r~   rz   rB   s     r5   r   7Resolution._attempt_to_pin_criterion.<locals>.<genexpr>   s,      5A ''A'K5r   r   )r,   r$   r`   r   r   r=   rejecting_candidater2   rR   r   rZ   r   pinningupdater"   pop)rB   rt   r2   causesr$   rL   	satisfiedrz   s   `      @r5   _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)NrZ   r[   r\   Fr_   T)r,   r$   r*   r<   rf   r   rg   rh   ri   r   extendr[   r   re   ra   )rB   incompatibilities_from_brokenr-   r[   r2   rj   r`   s          r5   _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           
         U R                   ci  U R                   Vs/ s HK  n[        UR                  R	                  5       UR
                  R	                  5       UR                  SS S9PMM     snU l         ggs  snf )zCSave states for potential rollback if optimistic backjumping fails.NrO   )r@   r>   r   r"   rQ   r$   rP   )rB   ss     r5   _save_stateResolution._save_state  sq    $ ! &A IINN,ZZ__.%&%7%7%:
 &!D %!s   AA8c                f    SU l         U R                  (       a  U R                  U l        SU l        gg)z3Rollback states and disable optimistic backjumping.g        N)r?   r@   r>   )rB   s    r5   _rollback_statesResolution._rollback_states*  s-    -0*,,DL $D rG   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  pgU R                  (       d  Xd;  a  OU R                  (       a"  U R                  c  Xd;  a  U R                  5         U 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 R1                  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r;   r   r}   cs     r5   r   'Resolution._backjump.<locals>.<genexpr>Q  s     >v!XQXXvs   ))c              3  8   #    U  H  oR                   v   M     g 7fr;   )rW   r   s     r5   r   r   R  s     +Fq]]Fs      rI   TNF)	itertoolschainr<   rc   lenr>   r,   r   r"   popitemrJ   r*   r   r?   r@   r   r   
isdisjointr$   r%   re   r[   rR   rT   r   )rB   r   incompatible_reqsr~   incompatible_depsbroken_statert   rz   dcurrent_dependenciesr-   r.   r   successs                 r5   	_backjumpResolution._backjump1  s   > 09>v>+F+0
 ;LL:KQWW--a0:KL$,,1$R   ::LA#'<<#3#3#5L&2&:&:&B&B&DOD
 ::5 
 66))15$$& 261I1I)1T(1TAGG$$Q'1T % ( ,667HII
 $++M R <H;P;P;V;V;X-;X41D,,-.;X * -
 *00$1DE  "**+HIG u $,,1$@ C M #H- A.v6D@A.(-s   $H6H "$H4#H9H1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)re   ra   r&   values)rB   criteronr   is       r5   _extract_causesResolution._extract_causes  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         S nS n[        U5       GH  nU R                  R!                  US9  U R"                  (       ab  U R$                  bU  Uc5  Un['        X'-
  U R"                  -  5      nUS::  a  U R)                  5         Mr  OUb  Xv-
  U:  a  U R)                  5         M  U R                  R                  R+                  5        VV	s/ s H  u  pU R-                  X5      (       a  M  UPM!     n
nn	U
(       d1  U R                  R/                  U R                  S9  U R                  s  $ [1        U R                  R                  R3                  5       5      [1        U
5      -
  n[5        U
5      S:  a  [7        U R8                  R;                  U
U R                  R<                  [?        U R                  R                  [@        RB                  " S5      5      [?        U R                  R                  [@        RB                  " S	5      5      U R                  RD                  S
95      nOU
nU(       d  [        S5      e[5        U5      S:  a  [G        XRH                  S9nOUS   nU RK                  U5      nU(       a  U RM                  U5      nU R                  RO                  US9   U RQ                  U5      n[S        U(       + =(       a    U R"                  =(       a    U R$                  5      nU(       a"  U R$                  (       a  U R)                  5         OXR                  RD                  S S & W(       d  [        U R                  RD                  5      eOU R                  R                  R+                  5        VV	s1 s H&  u  pX;   d  M  U R-                  X5      (       a  M$  UiM(     nnn	U RU                  U R                  R                  U5        U R                  5         U R                  RW                  XpR                  S9  GM     [Y        U5      e! [         a%  n[        UR                  R                  5      UeS nAff = fs  sn	nf ! [         a)    U R"                  (       a  U R$                  (       a  Sn GNe f = fs  sn	nf )Nzalready resolvedrO   r   )indexr   )r,   r   r`   ra   )identifiersrr   r`   ra   rP   z-narrow_requirement_selection returned 0 names)r1   )r   T)r   r,   )-r>   RuntimeErrorr=   startingr   collectionsOrderedDictrk   r,   r$   r   r   r2   ra   rT   rangestarting_roundr?   r@   intr   r%   r   endingsetkeysr   re   r<   narrow_requirement_selectionr"   r   rg   ri   rP   minru   r   r   resolving_conflictsr   boolro   ending_roundr   )rB   r^   
max_roundsr~   rL   optimistic_rounds_cutoff"optimistic_backjumping_start_roundround_indexr1   r2   unsatisfied_namessatisfied_namesnarrowed_unstatisfied_namesrt   failure_criterionr   r   failed_optimistic_backjumpingnewly_unsatisfied_namess                      r5   resolveResolution.resolve  s~   <<122 #//1!#
 AK%%djj&9&91T%J  	 04 9=* ,KGG"""5 11d6G6G6S5=9D6/2#1T5W5WW0, 014--/  5 .9#H34 --/  '+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+:"nnV4G 59# . >>. --51 1T5F5F))+5;JJ//2 #24::3N3NOO # +/***=*=*C*C*E+*E-  !;;CK *E ( + 66JJ'')@ $$&GG  {** E_ -b  
++{ * K*1;;+B+BCJKD!l , 99d>O>O8<5	.+sH   !%R* S S;S"T T8T*
S4 SS".TT)r?   rA   r<   r=   r@   r>   N)rC   zAbstractProvider[RT, CT, KT]rD   zBaseReporter[RT, CT, KT]returnNone)r   State[RT, CT, KT])r   r   )r$   dict[KT, Criterion[RT, CT]]rW   r	   rX   z	CT | Noner   r   )r$   r   rn   zCollection[KT]r   r   )rt   r   r   r   )rt   r   r2   zCriterion[RT, CT]r   r   )rz   r   r   r   )rt   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   )r^   Iterable[RT]r   r   r   r   )__name__
__module____qualname____firstlineno____doc__rE   propertyr,   rT   rk   ro   ru   r   r   r   r   r   r   r   r   r   __static_attributes__ rG   r5   r8   r8   D   s    8.8 +8 
	8 1 1#*)-*) *) 	*)
 
*)X3>L	6




#4

	

#J!-F!	!F
%dLR/R	-RN,rG   r8   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   )r8   rC   rD   r   r6   )rB   r^   r   
resolutionr,   s        r5   r   Resolver.resolve3  s7    @  t}}=
""<"GU##rG   r   N)d   )r^   r   r   r   r   Result[RT, CT, KT])	r   r   r   r   r   r   base_exceptionr   r   r   rG   r5   r   r   .  s5    =&N
 "$""$ "$ 
	"$ "$rG   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$   r1   r/   r0   r3   r4   s         r5   r(   r(   X  s     
??]&&(	BqE?D MM#hhBBMM# )   		s   A77
BB)r,   r   r   r   )
r$   zMapping[KT, Criterion[RT, CT]]r1   z	KT | Noner/   zdict[int, KT | None]r0   zset[KT | None]r   r   ),
__future__r   r   r   rg   typingr   r   structsr   r   r	   r
   r   r   r   r   r   abstractr   r   r2   r   
exceptionsr   r   r   r   r   collections.abcr   r   r   	providersr   r   	reportersr   r    __annotations__r6   r8   r   r(   r   rG   r5   <module>r      s    "    )
 
 
 /    ==8('* u *<g,R$ g,T'$B
+ '$T,	 # 	
 
rG   