
    :ie                         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)    )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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     YE:\TRUCKING_PROJECT\Lib\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                 d    dj                  | j                  j                  | j                        S )Nz{class_name}({candidate!r}))
class_namer   )format	__class____name__r   r   s    r   __repr__zExplicitRequirement.__repr__   s.    ,33~~..nn 4 
 	
r   c                 .    | j                   j                  S r   )r   project_namer   s    r   r$   z ExplicitRequirement.project_name   s     ~~***r   c                 .    | j                   j                  S r   )r   namer   s    r   r&   zExplicitRequirement.name   s     ~~"""r   c                 6    | j                   j                         S r   )r   format_for_errorr   s    r   r(   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"   propertyr   r$   r&   r(   r
   r*   boolr,    r   r   r   r   
   s    #) # ## #
# 
 +n + + #c # #1# 1$o $+ +t +r   r   c                       e Zd ZdeddfdZ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       || _        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>/         Q!!21!5 Q   )link_ireq	frozensetextras_extrasr   r4   s     r   r   zSpecifierRequirement.__init__,   s8    yy C"CC
  Qtzz?P?P QQr   c                 @    t        | j                  j                        S r   )r   r@   reqr   s    r   r   zSpecifierRequirement.__str__1   s    4::>>""r   c                     dj                  | j                  j                  t        | j                  j
                              S )Nz{class_name}({requirement!r}))r   requirement)r   r    r!   r   r@   rF   r   s    r   r"   zSpecifierRequirement.__repr__4   s7    .55~~..DJJNN+ 6 
 	
r   c                     | j                   j                  sJ d       t        | j                   j                  j                        S )N'Specifier-backed ireq is always PEP 508)r@   rF   r   r&   r   s    r   r$   z!SpecifierRequirement.project_name:   s/    zz~~HHH !4!455r   c                 B    t        | j                  | j                        S r   )r   r$   rC   r   s    r   r&   zSpecifierRequirement.name?   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   r(   z%SpecifierRequirement.format_for_errorC   st    
 %(IOOC$89q99u:?Z1_8Oyys$w.r:: :s   A5c                     d | j                   fS r   )r@   r   s    r   r*   z)SpecifierRequirement.get_candidate_lookupP   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 rJ   Tprereleases)r&   r@   rF   	specifiercontainsversion)r   r   specs      r   r,   z$SpecifierRequirement.is_satisfied_byS   sz    ~~* 	
D~~d499+/	
 zz~~HHHzz~~''}}Y..D}AAr   )r!   r-   r.   r   r   r   r   r"   r/   r   r$   r&   r(   r
   r*   r	   r0   r,   r1   r   r   r3   r3   +   s    R/ RD R
# #
# 
 6n 6 6 <c < <;# ; o  
B 
Bt 
Br   r3   c                        e Zd ZdZdedd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.
    r4   r   Nc                     |j                   J d       t        |      | _        t        d | j                  j                  D              | _        y )Nr6   c              3   2   K   | ]  }t        |        y wr   r8   r9   s     r   r<   z=SpecifierWithoutExtrasRequirement.__init__.<locals>.<genexpr>i   r=   r>   )r?   r   r@   rA   rB   rC   rD   s     r   r   z*SpecifierWithoutExtrasRequirement.__init__f   s=    yy C"CC,T2
  Qtzz?P?P QQr   )r!   r-   r.   __doc__r   r   r1   r   r   r_   r_   `   s    
R/ RD Rr   r_   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	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.rZ   matchr   Nc                      || _         || _        y r   )rZ   
_candidate)r   rZ   re   s      r   r   z"RequiresPythonRequirement.__init__o   s    "r   c                      d| j                    S )NzPython )rZ   r   s    r   r   z!RequiresPythonRequirement.__str__s   s    ())r   c                 v    dj                  | j                  j                  t        | j                              S )Nz{class_name}({specifier!r}))r   rZ   )r   r    r!   r   rZ   r   s    r   r"   z"RequiresPythonRequirement.__repr__v   s3    ,33~~..$..) 4 
 	
r   c                 .    | j                   j                  S r   )rg   r$   r   s    r   r$   z&RequiresPythonRequirement.project_name|   s    +++r   c                 .    | j                   j                  S r   )rg   r&   r   s    r   r&   zRequiresPythonRequirement.name   s    ###r   c                     t        |       S r   r   r   s    r   r(   z*RequiresPythonRequirement.format_for_error       4yr   c                     | j                   j                  | j                  j                  d      r| j                  d fS y)NTrX   NN)rZ   r[   rg   r\   r   s    r   r*   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 candidateTrX   )r&   rg   rZ   r[   r\   r   s     r   r,   z)RequiresPythonRequirement.is_satisfied_by   sC    ~~!5!55M7MM ~~&&y'8'8d&KKr   )r!   r-   r.   rb   r   r	   r   r   r   r"   r/   r   r$   r&   r(   r
   r*   r0   r,   r1   r   r   rd   rd   l   s    > ,  y  T  * *
# 
 ,n , , $c $ $# o 
L Lt Lr   rd   c                       e Zd ZdZdeddfdZ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.r&   r   Nc                     || _         y r   _name)r   r&   s     r   r   z!UnsatisfiableRequirement.__init__   s	    
r   c                      | j                    dS )Nz (unavailable)ru   r   s    r   r   z UnsatisfiableRequirement.__str__   s    **^,,r   c                 v    dj                  | j                  j                  t        | j                              S )Nz{class_name}({name!r}))r   r&   )r   r    r!   r   rv   r   s    r   r"   z!UnsatisfiableRequirement.__repr__   s2    '..~~..TZZ / 
 	
r   c                     | j                   S r   ru   r   s    r   r$   z%UnsatisfiableRequirement.project_name       zzr   c                     | j                   S r   ru   r   s    r   r&   zUnsatisfiableRequirement.name   rz   r   c                     t        |       S r   rm   r   s    r   r(   z)UnsatisfiableRequirement.format_for_error   rn   r   c                      y)Nrp   r1   r   s    r   r*   z-UnsatisfiableRequirement.get_candidate_lookup   s    r   r   c                      y)NFr1   r   s     r   r,   z(UnsatisfiableRequirement.is_satisfied_by   s    r   )r!   r-   r.   rb   r   r   r   r   r"   r/   r$   r&   r(   r
   r*   r	   r0   r,   r1   r   r   rs   rs      s    1^  - -
# 
 n   c  # o  t r   rs   N) pip._vendor.packaging.specifiersr   pip._vendor.packaging.utilsr   r   pip._internal.req.constructorsr   pip._internal.req.req_installr   baser	   r
   r   r   r   r3   r_   rd   rs   r1   r   r   <module>r      s]    9 I B < F F++ +B2B; 2Bj	R(< 	R%L %LP{ r   