
    Kxhl                     f   d dl Z 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mZmZmZmZmZmZ d dl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m Z m!Z!m"Z"m#Z# d d	l$m%Z% d d
l&m'Z'm(Z( d dl)m*Z* d dl+m,Z, d dl-m.Z. d dl/m0Z0 d dl1m2Z2m3Z3 d dl4m5Z5 d dl6m7Z7 d dl8m9Z9 d dl:m;Z; d dl<m=Z= ddl>m?Z?m@Z@mAZAmBZB ddlCmDZDmEZEmFZFmGZGmHZHmIZImJZJ ddlKmLZLmMZM ddlNmOZOmPZPmQZQmRZR erd dlmSZS  G d deS          ZT ejU        eV          ZW ed          ZXee*eXf         ZY G d de          ZZ G d  d!          Z[dS )"    N)TYPE_CHECKINGDict	FrozenSetIterableIteratorListMapping
NamedTupleOptionalSequenceSetTupleTypeVarcast)InvalidRequirement)SpecifierSet)NormalizedNamecanonicalize_name)ResolutionImpossible)
CacheEntry
WheelCache)DistributionNotFoundInstallationErrorMetadataInconsistentUnsupportedPythonVersionUnsupportedWheel)PackageFinder)BaseDistributionget_default_environment)Link)Wheel)RequirementPreparer)install_req_from_link_and_ireq)InstallRequirementcheck_invalid_constraint_type)InstallRequirementProvider)get_supported)Hashes)get_requirement)running_under_virtualenv   )	CandidateCandidateVersion
ConstraintRequirement)AlreadyInstalledCandidateBaseCandidateEditableCandidateExtrasCandidateLinkCandidateRequiresPythonCandidateas_base_candidate)FoundCandidatesIndexCandidateInfo)ExplicitRequirementRequiresPythonRequirementSpecifierRequirementUnsatisfiableRequirement)Protocolc                   $    e Zd ZU eed<   eed<   dS )ConflictCauserequirementparentN)__name__
__module____qualname__r:   __annotations__r,        ^/var/www/html/what/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.pyr?   r?   G   s*         ....rG   r?   Cc                   Z    e Zd ZU ee         ed<   eeef         ed<   eee	f         ed<   dS )CollectedRootRequirementsrequirementsconstraintsuser_requestedN)
rB   rC   rD   r   r/   rE   r   strr.   intrF   rG   rH   rK   rK   R   sL         {####c:o&&&&cN"""""rG   rK   c                      e Zd Z	 d?dedededee         dededed	ed
ee	e
df                  ddfdZedefd            ZdeddfdZdedee         defdZdedee         dedefdZdedee         dedee         dee         dee         fdZdee         dedededee
         de e         fdZ!d e e"         dee         de#e         fd!Z$d"ed#e%dede#e         fd$Z&d"ed%e'ee e"         f         d&e'ee#e         f         d#e%dede e         fd'Z(d(ed)e e         dee"         fd*Z)d+e*e         de+fd,Z,d-ede-fd.Z.	 d@ded0ee         d)e e         dee"         fd1Z/dedee"         fd2Z0dedee         dee1         fd3Z2d-edee         fd4Z3d5ed6         de4fd7Z5d8e"d9ee         de6fd:Z7d;d<d=e8ee%f         de9fd>Z:dS )AFactoryNfinderpreparermake_install_reqwheel_cacheuse_user_siteforce_reinstallignore_installedignore_requires_pythonpy_version_info.returnc
                 R   || _         || _        || _        t          |	          | _        || _        || _        || _        || _        i | _	        i | _
        i | _        i | _        i | _        |s5t                      }
d |
                    d          D             | _        d S i | _        d S )Nc                     i | ]
}|j         |S rF   )canonical_name).0dists     rH   
<dictcomp>z$Factory.__init__.<locals>.<dictcomp>x   s-     % % % #T% % %rG   F)
local_only)_finderrT   _wheel_cacher5   _python_candidate_make_install_req_from_spec_use_user_site_force_reinstall_ignore_requires_python_build_failures_link_candidate_cache_editable_candidate_cache_installed_candidate_cache_extras_candidate_cacher   iter_installed_distributions_installed_dists)selfrS   rT   rU   rV   rW   rX   rY   rZ   r[   envs              rH   __init__zFactory.__init__Y   s      '!8!I!I+;(+ /'=$9;;="CE&PR'  	$   	')++C% %<<<NN% % %D!!!
 %'D!!!rG   c                     | j         S N)ri   )rr   s    rH   rX   zFactory.force_reinstall   s    $$rG   linkc                     |j         sd S t          |j                  }|                    | j        j                                                  rd S |j         d}t          |          )Nz+ is not a supported wheel on this platform.)is_wheelr!   filename	supportedrd   target_pythonget_tagsr   )rr   rw   wheelmsgs       rH   "_fail_if_link_is_unsupported_wheelz*Factory._fail_if_link_is_unsupported_wheel   sh    } 	Fdm$$??4<5>>@@AA 	FKKKs###rG   baseextrasc                     t          |          |f}	 | j        |         }n*# t          $ r t          ||          }|| j        |<   Y nw xY w|S rv   )idro   KeyErrorr3   )rr   r   r   	cache_key	candidates        rH   _make_extras_candidatezFactory._make_extras_candidate   sr     XXv&		@4Y?II 	@ 	@ 	@'f55I6?D(333	@ s   ! $AAra   templatec                     	 | j         |j                 }n1# t          $ r$ t          |||           }|| j         |j        <   Y nw xY w|s|S |                     ||          S )N)factory)rn   r_   r   r0   r   )rr   ra   r   r   r   s        rH   _make_candidate_from_distz!Factory._make_candidate_from_dist   s    	H243FGDD 	H 	H 	H,T8TJJJDCGD+D,?@@@	H  	K**4888s    +AAnameversionc                 4   || j         v rd S |j        rw|| j        vr`	 t          ||| ||          | j        |<   nB# t          $ r5}t
                              d||ddi           || j         |<   Y d }~d S d }~ww xY w| j        |         }nv|| j        vr`	 t          ||| ||          | j        |<   nB# t          $ r5}t
                              d||ddi           || j         |<   Y d }~d S d }~ww xY w| j        |         }|s|S | 	                    ||          S )N)r   r   r   z3Discarding [blue underline]%s[/]: [yellow]%s[reset]markupT)extra)
rk   editablerm   r2   r   loggerinforl   r4   r   )rr   rw   r   r   r   r   er   s           rH   _make_candidate_from_linkz!Factory._make_candidate_from_link   s    4''' 4 (	44999 ;L  $! '< < <D2488 ,      KKM'.	      23D(.44444  #'"@"FDD4555 7D  $! '8 8 8D.t44 ,      KKM'.	      23D(.44444  -d3D 	K**4888s-   : 
A9*A44A9B1 1
C0;*C++C0ireqs	specifierhashesprefers_installedincompatible_idsc                    	
 |sdS |d         j         s
J d            t          j         j                  
t                      	|D ]R}|j         s
J d            |j         j        z  |                    d          z  	t          |j                  z  	Sdt          t                   f	
 fd}dt          t                   f	
 fd}t          | |            |          S )	NrF   r   z)Candidates found on index must be PEP 508F)trust_internetr\   c                      j         rdS 	 j                 } n# t          $ r Y dS w xY w                    | j        d          sdS                     |           }t          |          v rdS |S )z6Get the candidate for the currently-installed version.NT)prereleases)ra   r   r   )ri   rq   r   containsr   r   r   )installed_distr   r   r   r   rr   r   r   s     rH   _get_installed_candidatez@Factory._iter_found_candidates.<locals>._get_installed_candidate   s     $ t!%!6t!<   tt %%n&<$%OO t66#! 7  I )}} 000ts    
((c            	   3     K   
j                             	          } t          |                                           }t	          d |D                       }dt
          dt          fd} |          }t          |          D ]G}|r|s|j        j	        rt          j        
j        |j        	|j                  }|j        |fV  Hd S )N)project_namer   r   c              3   .   K   | ]}|j         j        V  d S rv   )rw   	is_yanked)r`   icans     rH   	<genexpr>zUFactory._iter_found_candidates.<locals>.iter_index_candidate_infos.<locals>.<genexpr>!  s'      CCTTY0CCCCCCrG   r   r\   c                 ~    | D ]9}|j         dk    r dS |j         dk    r|j                            d          r7 dS dS )Nz===T==z.*F)operatorr   endswith)r   sps     rH   	is_pinnedzUFactory._iter_found_candidates.<locals>.iter_index_candidate_infos.<locals>.is_pinned#  s\    #    B{e++#tt{d** z**400 ! 44urG   )rw   r   r   r   r   )rd   find_best_candidatelistiter_applicableallr   boolreversedrw   r   	functoolspartialr   r   )resulticans
all_yankedr   pinnedr   funcr   r   r   rr   r   r   s          rH   iter_index_candidate_infoszBFactory._iter_found_candidates.<locals>.iter_index_candidate_infos  s     \55!# 6  F
 //1122E
 CCUCCCCCJ	\ 	d 	 	 	 	 Yy))F ! ) )" v 493F  (2!% L   lD((((() )rG   )reqr   r   	frozensetr   r   r   r   r,   r   r8   r7   )rr   r   r   r   r   r   ireqr   r   r   r   r   s   ` `` `   @@@rH   _iter_found_candidateszFactory._iter_found_candidates   si     	2 8|HHHHHH !233!* 	- 	-D8HHHHHH++Idkkk777Fi,,,FF	(9*= 	 	 	 	 	 	 	 	 	 	 	0&	)H5G,H &	) &	) &	) &	) &	) &	) &	) &	) &	) &	) &	)P &$$&&	
 
 	
rG   base_requirementsc              #      K   |D ]O}|                                 \  }}|t          |          }|
J d            |                     ||          V  PdS )a8  Produce explicit candidates from the base given an extra-ed package.

        :param base_requirements: Requirements known to the resolver. The
            requirements are guaranteed to not have extras.
        :param extras: The extras to inject into the explicit requirements'
            candidates.
        Nzno extras here)get_candidate_lookupr6   r   )rr   r   r   r   lookup_cand_	base_cands          rH   #_iter_explicit_candidates_from_basez+Factory._iter_explicit_candidates_from_baseE  s       % 	A 	AC 5577NK" *+66I((*:(((--i@@@@@@	A 	ArG   
identifier
constraintc           	   #      K   |j         D ]^}|                     |           |                     |t                      t	          ||          t          |          d          }|r|V  _dS )zProduce explicit candidates from constraints.

        This creates "fake" InstallRequirement objects that are basically clones
        of what "should" be the template, but with original_link set to link.
        Nr   r   r   r   )linksr   r   r   r#   r   )rr   r   r   r   rw   r   s         rH   !_iter_candidates_from_constraintsz)Factory._iter_candidates_from_constraints[  s       $ 
	  
	 D33D99966 {{7hGG&z22 7  I   
	  
	 rG   rL   incompatibilitiesc           	      *   t                      }g }         D ]G}|                                \  }	}
|	|                    |	           |
|                    |
           Ht	          j        t                    5  t                    }|                    | 	                    
                    |j        d          t          |j                                       d d d            n# 1 swxY w Y   |rD	 |                    |                     |d                              n# t          $ r Y dS w xY wd |
                    d          D             |s#|                     |j        j        |          S fd|D             S )NrF   r   )r   c                 ,    h | ]}t          |          S rF   )r   r`   cs     rH   	<setcomp>z*Factory.find_candidates.<locals>.<setcomp>  s    MMM!1MMMrG   c              3      K   | ]Mt                    v                              (t          fd          D                       IV  NdS )c              3   B   K   | ]}|                               V  d S rv   )is_satisfied_by)r`   r   r   s     rH   r   z4Factory.find_candidates.<locals>.<genexpr>.<genexpr>  s1      OOsC''**OOOOOOrG   N)r   r   r   )r`   r   r   r   incompat_idsrL   s    @rH   r   z*Factory.find_candidates.<locals>.<genexpr>  s       
 
!uuL((**1-- )OOOOl:6NOOOOO ) ((((
 
rG   )setr   addappend
contextlibsuppressr   r)   updater   getr   r   r   r   r   r   r   r   )rr   r   rL   r   r   r   explicit_candidatesr   r   candr   parsed_requirementr   s    `` `       @rH   find_candidateszFactory.find_candidatesr  sJ    /2ee*,
+ 	# 	#C1133JD$#''---T"""  !344 	 	!0!<!<&&88 $$%7%<bAA0788   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  	#**::""!&q ;      $    rr NM'8'<'<Z'L'LMMM # 	..$!!  
 
 
 
 
 
 
(
 
 
 	
s%   >A$C..C25C2<1D. .
D<;D<r   requested_extrasc                    |                     |          s(t                              d|j        |j                   d S |j        st          |          S |                     |j                   |                     |j        t          |j
                  ||j        rt          |j                  nd d           }|:|j        s| j        |j                 t          t          |j                            S |                     |          S )Nz6Ignoring %s: markers '%s' don't match your environmentr   )match_markersr   r   r   markersrw   r;   r   r   r   r   r   rk   r<   make_requirement_from_candidate)rr   r   r   r   s       rH   "_make_requirement_from_install_reqz*Factory._make_requirement_from_install_req  s    !!"233 	KKH	  
 4y 	.'---//	:::--IT[))15D"49--- . 
 
 < 9 6*4955+,=di,H,HIII33D999rG   
root_ireqsc                 <   t          g i i           }t          |          D ]\  }}|j        rt          |          }|rt	          |          |                                sA|j        s
J d            t          |j                  }||j        v r|j        |xx         |z  cc<   t          j
        |          |j        |<   |                     |d          }||j        r|j        |j        vr||j        |j        <   |j                            |           |S )NzConstraint must be namedrF   )r   )rK   	enumerater   r%   r   r   r   r   rM   r.   	from_ireqr   user_suppliedrN   rL   r   )rr   r   	collectedir   problemr   r   s           rH   collect_root_requirementsz!Factory.collect_root_requirements  sX    .b"b99	 ,, 	3 	3GAt 37== 5+G444))++ y<<"<<<<(339000)$///47////2<2Ft2L2LI)$//==%' >   ;% ;#():R*R*R9:I,SX6&--c2222rG   r   c                      t          |          S rv   )r9   )rr   r   s     rH   r   z'Factory.make_requirement_from_candidate  s     #9---rG   rF   
comes_fromc                 Z    |                      ||          }|                     ||          S rv   )rg   r   )rr   r   r   r   r   s        rH   make_requirement_from_specz"Factory.make_requirement_from_spec  s0     //	:FF66t=MNNNrG   c                 `    | j         rd S t          |          sd S t          || j                  S rv   )rj   rO   r:   rf   )rr   r   s     rH    make_requires_python_requirementz(Factory.make_requires_python_requirement  s:     ' 	49~~ 	4(D4JKKKrG   c                 ~    | j         | j        j        rdS | j                             ||t	                                S )a  Look up the link in the wheel cache.

        If ``preparer.require_hashes`` is True, don't use the wheel cache,
        because cached wheels, always built locally, have different hashes
        than the files downloaded from the index server and thus throw false
        hash mismatches. Furthermore, cached wheels at present have
        nondeterministic contents due to file modification times.
        N)rw   package_namesupported_tags)re   rT   require_hashesget_cache_entryr'   )rr   rw   r   s      rH   get_wheel_cache_entryzFactory.get_wheel_cache_entry  sI     $(D$4 00(?? 1 
 
 	
rG   c                     | j                             |j                  }|d S | j        s|S |j        r|S t                      r(|j        r!d|j         d|j         }t          |          d S )NzNWill not install to the user site because it will lack sys.path precedence to z in )
rq   r   r   rh   in_usersiter*   in_site_packagesraw_namelocationr   )rr   r   ra   messages       rH   get_dist_to_uninstallzFactory.get_dist_to_uninstall"  s    $(()?@@<4
 " 	K  	K $%% 	-$*? 	-M*.-M M=A]M M  $G,,,trG   causesr?   c                    |s
J d            | j         j        }t          |          dk    rIt          |d         j        j                  }d|d         j        j        d| d|}t          |          S d| d}|D ]@}|j        	                                }t          |j        j                  }|d	|d
| dz  }At          |          S )Nz,Requires-Python error reported with no causer+   r   zPackage z requires a different Python: z not in z%Packages require a different Python. z not in:
z (required by ))
rf   r   lenrO   r@   r   rA   r   r   format_for_error)rr   r  r   r   r  causepackages          rH   _report_requires_python_errorz%Factory._report_requires_python_error>  s    EEEEEE(0v;;!F1I1;<<I:6!9+0 : :": :,5: :  ,G444K'KKK 	B 	BEl3355GE-788IAIAAwAAAAGG'000rG   r   rA   c                 :   |t          |          }n| d|j         d}| j                            |j                  }| j                                        }d t          d |D                       D             }|r0t                              dd	                    |          pd           t                              d|d		                    |          pd           t          |          d
k    rt          
                    d           t          d|           S )Nz (from r  c                 ,    g | ]}t          |          S rF   )rO   )r`   vs     rH   
<listcomp>z?Factory._report_single_requirement_conflict.<locals>.<listcomp>^  s    GGGqCFFGGGrG   c                     h | ]	}|j         
S rF   )r   r   s     rH   r   z>Factory._report_single_requirement_conflict.<locals>.<setcomp>^  s    +E+E+E!AI+E+E+ErG   zJIgnored the following versions that require a different python version: %sz; nonezNCould not find a version that satisfies the requirement %s (from versions: %s), zrequirements.txtzHINT: You are attempting to install a package literally named "requirements.txt" (which cannot exist). Consider using the '-r' flag to install the packages listed in requirements.txtz#No matching distribution found for )rO   r   rd   find_all_candidatesr   requires_python_skipped_reasonssortedr   criticaljoinr   r   )rr   r   rA   req_dispcandsskipped_by_requires_pythonversionss          rH   #_report_single_requirement_conflictz+Factory._report_single_requirement_conflictT  s8    >3xxHH44fk444H001ABB%)\%Q%Q%S%S"GGF+E+Eu+E+E+E$F$FGGG% 	OO		455?  
 	"IIh)6		
 	
 	
 s88)))KK#   $$O#$O$OPPPrG   r   z,ResolutionImpossible[Requirement, Candidate]rM   c                 \    |j         s
J d             fd|j         D             }|r#                     t          d|                    S t          |j                   dk    r/|j         d         \  }}|j        |vr                     ||          S dt          t                   dt          fd}d	t          dt          fd
}t                      }|j         D ]<\  }}||
                                }	n ||          }	|                    |	           =|r |t          |                    }
nd}
d                    |
          }t                              |           d}t                      }|j         D ]a\  }}|j        |v r|                    |j                   |dz   }|r||j         d|j         dz   }n|dz   }||
                                z   }b|D ]}||         j        }|d| | z  }|dz   dz   dz   dz   dz   }t                              |           t'          d          S )Nz)Installation error reported with no causec                     g | ]=}t          |j        t                    |j                            j                  ;|>S rF   )
isinstancer@   r:   r   rf   )r`   r  rr   s     rH   r  z2Factory.get_installation_error.<locals>.<listcomp>  s[     "
 "
 "
%+-FGG"
 %55d6LMM	"
"
 "
 "
rG   zSequence[ConflictCause]r+   r   partsr\   c                     t          |           dk    r| d         S d                    | d d                   dz   | d         z   S )Nr+   r   r  z and )r	  r  )r"  s    rH   	text_joinz1Factory.get_installation_error.<locals>.text_join  sB    5zzQQx99U3B3Z((72U2Y>>rG   rA   c                     |                                  }|r|j        s| j         d| j         S t	          |j        t
                    rt          |j        j                  S t          |j                  S )Nr   )get_install_requirementr   r   r   r!  r$   rO   )rA   r   s     rH   describe_triggerz8Factory.get_installation_error.<locals>.describe_trigger  st    1133D :t : +99999$/+=>> 14?/000t'''rG   zthe requested packageszOCannot install {} because these package versions have conflicting dependencies.z
The conflict is caused by:z
     z depends on zThe user requested z%
    The user requested (constraint) z

zTo fix this you could try to:
z91. loosen the range of package versions you've specified
z92. remove package versions to allow pip attempt to solve zthe dependency conflict
zResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts)r  r  r   r	  r   r  r   rO   r,   r   r
  r   r  formatr   r  r   r   r   r   )rr   r   rM   requires_python_causesr   rA   r%  r(  triggerstriggerr   r   relevant_constraintskeyspecs   `              rH   get_installation_errorzFactory.get_installation_errorv  s    xDDDDDD"
 "
 "
 "
"
 "
 "
 " 	 55.0FGG   qx==A(1+KCx{**??VLLL	?T#Y 	?3 	? 	? 	? 	?	(Y 	(3 	( 	( 	( 	( 558 	" 	"KC~..00**622LL!!!! 	,9VH--..DD+D--3VD\\ 	 	,"uu8 	/ 	/KCx;&&$((222.C 2v{IIV^IIII11,,...CC' 	H 	HCs#-DGCGGGGCC /0 KK J	J
 ** 	 	C#1
 
 	
rG   rv   )rF   );rB   rC   rD   r   r"   r&   r   r   r   r   rP   rt   propertyrX   r    r   r1   r   rO   r3   r   r   r$   r,   r   r   r-   r   r   r   r(   r   r   r   r/   r   r   r.   r   r	   r   r   r   rK   r   r9   r   r   r   r   r   r  r   r  r   r  r   r   r1  rF   rG   rH   rR   rR   X   s;        6:$' $'$' &$' 5	$'
 j)$' $' $' $' !%$' "%S/2$' 
$' $' $' $'L % % % % X%$t $ $ $ $ $	!	+4S>			 	 	 	99 #9 %	9
 
9 9 9 9<9<9 #<9 %	<9
 ~&<9 *+<9 
)	<9 <9 <9 <9|_
*+_
  _
 	_

  _
 c(_
 
)	_
 _
 _
 _
BA#K0A #A 
)		A A A A,     %	 
 
)	       .D
D
 c8K#889D
 #3(;#;<	D

 D
  D
 
)	D
 D
 D
 D
L:&::B3-:	+	: : : :@12	"   <.".	. . . . +-	O OO /0O #3-	O
 
+	O O O O	L	L 
+		L 	L 	L 	L

 (
	*	
 
 
 
&y XFV=W    81/1	!1 1 1 1, Q Q(0(; Q	 Q  Q  Q  QDe
9e
 #z/*e
 
	e
 e
 e
 e
 e
 e
rG   rR   )\r   r   loggingtypingr   r   r   r   r   r   r	   r
   r   r   r   r   r   r   "pip._vendor.packaging.requirementsr    pip._vendor.packaging.specifiersr   pip._vendor.packaging.utilsr   r   pip._vendor.resolvelibr   pip._internal.cacher   r   pip._internal.exceptionsr   r   r   r   r   "pip._internal.index.package_finderr   pip._internal.metadatar   r   pip._internal.models.linkr    pip._internal.models.wheelr!    pip._internal.operations.preparer"   pip._internal.req.constructorsr#   pip._internal.req.req_installr$   r%   pip._internal.resolution.baser&   &pip._internal.utils.compatibility_tagsr'   pip._internal.utils.hashesr(   pip._internal.utils.packagingr)   pip._internal.utils.virtualenvr*   r   r,   r-   r.   r/   
candidatesr0   r1   r2   r3   r4   r5   r6   found_candidatesr7   r8   rL   r9   r:   r;   r<   r=   r?   	getLoggerrB   r   rI   CacherK   rR   rF   rG   rH   <module>rK     s                                          " B A A A A A 9 9 9 9 9 9 I I I I I I I I 7 7 7 7 7 7 6 6 6 6 6 6 6 6              = < < < < < L L L L L L L L * * * * * * , , , , , , @ @ @ @ @ @ I I I I I I        E D D D D D @ @ @ @ @ @ - - - - - - 9 9 9 9 9 9 C C C C C C F F F F F F F F F F F F                  B A A A A A A A                    
 
	8	$	$GCLLT1W# # # # #
 # # #C

 C

 C

 C

 C

 C

 C

 C

 C

 C

rG   