
    )h                         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mZmZmZ  G d d	e      Z G d
 de      Z G d de      Z G d de      Z G d de      Zy)    )AnyOptional)SpecifierSet)NormalizedNamecanonicalize_name)install_req_drop_extras)InstallRequirement   )	CandidateCandidateLookupRequirementformat_namec                       e Zd Zd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defdZdefdZdedefdZy)ExplicitRequirement	candidatereturnNc                     || _         y Nr   selfr   s     c/var/www/html/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/requirements.py__init__zExplicitRequirement.__init__   s	    "    c                 ,    t        | j                        S r   )strr   r   s    r   __str__zExplicitRequirement.__str__   s    4>>""r   c                 N    | j                   j                   d| j                  dS N())	__class____name__r   r   s    r   __repr__zExplicitRequirement.__repr__   s%    ..))*!DNN+=Q??r   c                 ,    t        | j                        S r   )hashr   r   s    r   __hash__zExplicitRequirement.__hash__   s    DNN##r   otherc                 V    t        |t              sy| j                  |j                  k(  S NF)
isinstancer   r   r   r)   s     r   __eq__zExplicitRequirement.__eq__   s#    %!45~~00r   c                 .    | j                   j                  S r   )r   project_namer   s    r   r0   z ExplicitRequirement.project_name   s     ~~***r   c                 .    | j                   j                  S r   )r   namer   s    r   r2   zExplicitRequirement.name#   s     ~~"""r   c                 6    | j                   j                         S r   )r   format_for_errorr   s    r   r4   z$ExplicitRequirement.format_for_error(   s    ~~..00r   c                     | j                   d fS r   r   r   s    r   get_candidate_lookupz(ExplicitRequirement.get_candidate_lookup+   s    ~~t##r   c                      || j                   k(  S r   r   r   s     r   is_satisfied_byz#ExplicitRequirement.is_satisfied_by.   s    DNN**r   )r$   
__module____qualname__r   r   r   r   r%   intr(   r   boolr.   propertyr   r0   r2   r4   r   r6   r8    r   r   r   r      s    #) # ## #@# @$# $1C 1D 1
 +n + + #c # #1# 1$o $+ +t +r   r   c                       e Zd ZdeddfdZedefd       ZdefdZdefdZ	de
defd	Z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efdZy)SpecifierRequirementireqr   Nc                     |j                   J d       || _        d | _        d | _        t	        d | j                  j
                  D              | _        y )NThis is a link, not a specifierc              3   2   K   | ]  }t        |        y wr   r   .0es     r   	<genexpr>z0SpecifierRequirement.__init__.<locals>.<genexpr>8         Q!!21!5 Q   )link_ireq_equal_cache_hash	frozensetextras_extrasr   rA   s     r   r   zSpecifierRequirement.__init__3   sJ    yy C"CC 
+/$(
  Qtzz?P?P QQr   c                 ~    | j                   | j                   S t        | j                        | _         | j                   S r   rN   r   rM   r   s    r   _equalzSpecifierRequirement._equal:   6    ($$$

O   r   c                 @    t        | j                  j                        S r   )r   rM   reqr   s    r   r   zSpecifierRequirement.__str__B   s    4::>>""r   c                 t    | j                   j                   dt        | j                  j                        dS r    )r#   r$   r   rM   rY   r   s    r   r%   zSpecifierRequirement.__repr__E   s.    ..))*!C

,?+B!DDr   r)   c                 `    t        |t              st        S | j                  |j                  k(  S r   )r,   r@   NotImplementedrV   r-   s     r   r.   zSpecifierRequirement.__eq__H   s&    %!56!!{{ell**r   c                 ~    | j                   | j                   S t        | j                        | _         | j                   S r   rO   r'   rV   r   s    r   r(   zSpecifierRequirement.__hash__M   0    ::!::$++&
zzr   c                     | j                   j                  sJ d       t        | j                   j                  j                        S )N'Specifier-backed ireq is always PEP 508)rM   rY   r   r2   r   s    r   r0   z!SpecifierRequirement.project_nameT   s1    zz~~HHH~ !4!455r   c                 B    t        | j                  | j                        S r   )r   r0   rR   r   s    r   r2   zSpecifierRequirement.nameY   s    4,,dll;;r   c                     t        |       j                  d      D cg c]  }|j                          }}t        |      dk(  ryt        |      dk(  r|d   S dj	                  |d d       dz   |d   z   S c c}w )N,r    r
   z, z and )r   splitstriplenjoin)r   spartss      r   r4   z%SpecifierRequirement.format_for_error]   st    
 %(IOOC$89q99u:?Z1_8Oyys$w.r:: :s   A5c                     d | j                   fS r   )rM   r   s    r   r6   z)SpecifierRequirement.get_candidate_lookupj   s    TZZr   r   c                 *   |j                   | j                   k(  s!J d|j                    d| j                           | j                  j                  sJ d       | j                  j                  j                  }|j	                  |j
                  d      S )Nz6Internal issue: Candidate is not for this requirement z vs ra   Tprereleases)r2   rM   rY   	specifiercontainsversion)r   r   specs      r   r8   z$SpecifierRequirement.is_satisfied_bym   s    ~~* 	
D~~d499+/	
* zz~~HHH~zz~~''}}Y..D}AAr   )r$   r9   r:   r	   r   r=   r   rV   r   r%   objectr<   r.   r;   r(   r   r0   r2   r4   r   r6   r   r8   r>   r   r   r@   r@   2   s    R/ RD R ! ! !# #E# E+F +t +
#  6n 6 6 <c < <;# ; o  
B 
Bt 
Br   r@   c                   R    e Zd ZdZdeddfdZedefd       Zde	de
fdZdefd	Zy)
!SpecifierWithoutExtrasRequirementz
    Requirement backed by an install requirement on a base package.
    Trims extras from its install requirement if there are any.
    rA   r   Nc                     |j                   J d       t        |      | _        d | _        d | _        t        d | j                  j                  D              | _        y )NrC   c              3   2   K   | ]  }t        |        y wr   rE   rF   s     r   rI   z=SpecifierWithoutExtrasRequirement.__init__.<locals>.<genexpr>   rJ   rK   )rL   r   rM   rN   rO   rP   rQ   rR   rS   s     r   r   z*SpecifierWithoutExtrasRequirement.__init__   sO    yy C"CC ,T2
+/$(
  Qtzz?P?P QQr   c                 ~    | j                   | j                   S t        | j                        | _         | j                   S r   rU   r   s    r   rV   z(SpecifierWithoutExtrasRequirement._equal   rW   r   r)   c                 `    t        |t              st        S | j                  |j                  k(  S r   )r,   rw   r\   rV   r-   s     r   r.   z(SpecifierWithoutExtrasRequirement.__eq__   s&    %!BC!!{{ell**r   c                 ~    | j                   | j                   S t        | j                        | _         | j                   S r   r^   r   s    r   r(   z*SpecifierWithoutExtrasRequirement.__hash__   r_   r   )r$   r9   r:   __doc__r	   r   r=   r   rV   ru   r<   r.   r;   r(   r>   r   r   rw   rw   z   sX    
R/ RD R ! ! !+F +t +
# r   rw   c                       e Zd ZdZded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defdZdefdZdedefdZy)RequiresPythonRequirementz4A requirement representing Requires-Python metadata.rq   matchr   Nc                 N    || _         t        |      | _        d | _        || _        y r   )rq   r   _specifier_stringrO   
_candidate)r   rq   r   s      r   r   z"RequiresPythonRequirement.__init__   s#    "!$Y$(
r   c                      d| j                    S )NzPython )rq   r   s    r   r   z!RequiresPythonRequirement.__str__   s    ())r   c                 `    | j                   j                   dt        | j                        dS r    )r#   r$   r   rq   r   s    r   r%   z"RequiresPythonRequirement.__repr__   s*    ..))*!C,?+B!DDr   c                     | j                   | j                   S t        | j                  | j                  f      | _         | j                   S r   )rO   r'   r   r   r   s    r   r(   z"RequiresPythonRequirement.__hash__   s;    ::!::4114??CD
zzr   r)   c                     t        |t              sy| j                  |j                  k(  xr | j                  |j                  k(  S r+   )r,   r   r   r   r-   s     r   r.   z RequiresPythonRequirement.__eq__   s@    %!:;""e&=&== 45#3#33	
r   c                 .    | j                   j                  S r   )r   r0   r   s    r   r0   z&RequiresPythonRequirement.project_name   s    +++r   c                 .    | j                   j                  S r   )r   r2   r   s    r   r2   zRequiresPythonRequirement.name   s    ###r   c                     t        |       S r   r   r   s    r   r4   z*RequiresPythonRequirement.format_for_error       4yr   c                     | j                   j                  | j                  j                  d      r| j                  d fS y)NTro   NN)rq   rr   r   rs   r   s    r   r6   z.RequiresPythonRequirement.get_candidate_lookup   s5    >>""4??#:#:"M??D((r   r   c                     |j                   | j                  j                   k(  sJ d       | j                  j                  |j                  d      S )NzNot Python candidateTro   )r2   r   rq   rr   rs   r   s     r   r8   z)RequiresPythonRequirement.is_satisfied_by   sF    ~~!5!55M7MM5 ~~&&y'8'8d&KKr   )r$   r9   r:   r}   r   r   r   r   r   r%   r;   r(   r   r<   r.   r=   r   r0   r2   r4   r   r6   r8   r>   r   r   r   r      s    > ,  y  T  * *E# E# 
C 
D 
 ,n , , $c $ $# o 
L Lt Lr   r   c                       e Zd ZdZdeddfdZdefdZdefdZde	de
fd	Z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e
fdZy)UnsatisfiableRequirementz'A requirement that cannot be satisfied.r2   r   Nc                     || _         y r   _name)r   r2   s     r   r   z!UnsatisfiableRequirement.__init__   s	    
r   c                      | j                    dS )Nz (unavailable)r   r   s    r   r   z UnsatisfiableRequirement.__str__   s    **^,,r   c                 `    | j                   j                   dt        | j                        dS r    )r#   r$   r   r   r   s    r   r%   z!UnsatisfiableRequirement.__repr__   s)    ..))*!C

O+>a@@r   r)   c                 `    t        |t              st        S | j                  |j                  k(  S r   )r,   r   r\   r   r-   s     r   r.   zUnsatisfiableRequirement.__eq__   s&    %!9:!!zzU[[((r   c                 ,    t        | j                        S r   )r'   r   r   s    r   r(   z!UnsatisfiableRequirement.__hash__   s    DJJr   c                     | j                   S r   r   r   s    r   r0   z%UnsatisfiableRequirement.project_name       zzr   c                     | j                   S r   r   r   s    r   r2   zUnsatisfiableRequirement.name   r   r   c                     t        |       S r   r   r   s    r   r4   z)UnsatisfiableRequirement.format_for_error   r   r   c                      y)Nr   r>   r   s    r   r6   z-UnsatisfiableRequirement.get_candidate_lookup   s    r   r   c                      yr+   r>   r   s     r   r8   z(UnsatisfiableRequirement.is_satisfied_by   s    r   )r$   r9   r:   r}   r   r   r   r   r%   ru   r<   r.   r;   r(   r=   r0   r2   r4   r   r6   r   r8   r>   r   r   r   r      s    1^  - -A# A)F )t )
 #   n   c  # o  t r   r   N)typingr   r    pip._vendor.packaging.specifiersr   pip._vendor.packaging.utilsr   r   pip._internal.req.constructorsr   pip._internal.req.req_installr	   baser   r   r   r   r   r@   rw   r   r   r>   r   r   <module>r      sa      9 I B < F F#++ #+LEB; EBP(< D3L 3Ll#{ #r   