o
    h                     @  s   d dl 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 ddlmZmZmZmZ G d	d
 d
eZG dd deZG dd deZG dd deZG dd deZdS )    )annotations)Any)SpecifierSet)NormalizedNamecanonicalize_name)install_req_drop_extras)InstallRequirement   )	CandidateCandidateLookupRequirementformat_namec                   @  sx   e Zd Zd!ddZd"dd	Zd"d
dZd#ddZd$ddZed%ddZ	ed"ddZ
d"ddZd&ddZd'ddZd S )(ExplicitRequirement	candidater
   returnNonec                 C  
   || _ d S Nr   selfr    r   c/var/www/html/venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/requirements.py__init__      
zExplicitRequirement.__init__strc                 C  
   t | jS r   )r   r   r   r   r   r   __str__   r   zExplicitRequirement.__str__c                 C  s   | j j d| jdS N())	__class____name__r   r   r   r   r   __repr__   s   zExplicitRequirement.__repr__intc                 C  r   r   )hashr   r   r   r   r   __hash__   r   zExplicitRequirement.__hash__otherr   boolc                 C  s   t |tsdS | j|jkS NF)
isinstancer   r   r   r(   r   r   r   __eq__      
zExplicitRequirement.__eq__r   c                 C     | j jS r   )r   project_namer   r   r   r   r0          z ExplicitRequirement.project_namec                 C  r/   r   )r   namer   r   r   r   r2   %   r1   zExplicitRequirement.namec                 C  s
   | j  S r   )r   format_for_errorr   r   r   r   r3   *   r   z$ExplicitRequirement.format_for_errorr   c                 C  s
   | j d fS r   r   r   r   r   r   get_candidate_lookup-   r   z(ExplicitRequirement.get_candidate_lookupc                 C  s
   || j kS r   r   r   r   r   r   is_satisfied_by0   r   z#ExplicitRequirement.is_satisfied_byN)r   r
   r   r   r   r   r   r%   r(   r   r   r)   r   r   r   r   r   r
   r   r)   )r#   
__module____qualname__r   r   r$   r'   r-   propertyr0   r2   r3   r4   r5   r   r   r   r   r      s    






r   c                   @  s   e Zd Zd%ddZed&dd	Zd&d
dZd&ddZd'ddZd(ddZ	ed)ddZ
ed&ddZd&ddZd*ddZd+d"d#Zd$S ),SpecifierRequirementireqr   r   r   c                 C  s@   |j d u s	J d|| _d | _d | _tdd | jjD | _d S )NThis is a link, not a specifierc                 s      | ]}t |V  qd S r   r   .0er   r   r   	<genexpr>:       z0SpecifierRequirement.__init__.<locals>.<genexpr>)link_ireq_equal_cache_hash	frozensetextras_extrasr   r@   r   r   r   r   5   s
   zSpecifierRequirement.__init__r   c                 C  "   | j d ur| j S t| j| _ | j S r   rK   r   rJ   r   r   r   r   _equal<      
zSpecifierRequirement._equalc                 C  s   t | jjS r   )r   rJ   reqr   r   r   r   r   D      zSpecifierRequirement.__str__c                 C  s   | j j dt| jjdS r   )r"   r#   r   rJ   rU   r   r   r   r   r$   G   s   zSpecifierRequirement.__repr__r(   objectr)   c                 C     t |tstS | j|jkS r   )r+   r?   NotImplementedrS   r,   r   r   r   r-   J   r.   zSpecifierRequirement.__eq__r%   c                 C  rQ   r   rL   r&   rS   r   r   r   r   r'   O      
zSpecifierRequirement.__hash__r   c                 C  s   | j jsJ dt| j jjS )N'Specifier-backed ireq is always PEP 508)rJ   rU   r   r2   r   r   r   r   r0   V   s   z!SpecifierRequirement.project_namec                 C  s   t | j| jS r   )r   r0   rO   r   r   r   r   r2   [   s   zSpecifierRequirement.namec                 C  sZ   dd t | dD }t|dkrdS t|dkr|d S d|d d d	 |d  S )
Nc                 S  s   g | ]}|  qS r   )strip)rE   sr   r   r   
<listcomp>d   s    z9SpecifierRequirement.format_for_error.<locals>.<listcomp>,r    r	   z, z and )r   splitlenjoin)r   partsr   r   r   r3   _   s   z%SpecifierRequirement.format_for_errorr   c                 C  s
   d | j fS r   )rJ   r   r   r   r   r4   l   r   z)SpecifierRequirement.get_candidate_lookupr   r
   c                 C  sN   |j | j ksJ d|j  d| j  | jjsJ d| jjj}|j|jddS )Nz6Internal issue: Candidate is not for this requirement z vs r\   Tprereleases)r2   rJ   rU   	specifiercontainsversion)r   r   specr   r   r   r5   o   s   
z$SpecifierRequirement.is_satisfied_byNr@   r   r   r   r6   r(   rW   r   r)   r7   r9   r:   r;   )r#   r<   r=   r   r>   rS   r   r$   r-   r'   r0   r2   r3   r4   r5   r   r   r   r   r?   4   s    






r?   c                   @  s<   e Zd ZdZdddZedd	d
ZdddZdddZdS )!SpecifierWithoutExtrasRequirementz
    Requirement backed by an install requirement on a base package.
    Trims extras from its install requirement if there are any.
    r@   r   r   r   c                 C  sD   |j d u s	J dt|| _d | _d | _tdd | jjD | _d S )NrA   c                 s  rB   r   rC   rD   r   r   r   rG      rH   z=SpecifierWithoutExtrasRequirement.__init__.<locals>.<genexpr>)rI   r   rJ   rK   rL   rM   rN   rO   rP   r   r   r   r      s
   
z*SpecifierWithoutExtrasRequirement.__init__r   c                 C  rQ   r   rR   r   r   r   r   rS      rT   z(SpecifierWithoutExtrasRequirement._equalr(   rW   r)   c                 C  rX   r   )r+   ro   rY   rS   r,   r   r   r   r-      r.   z(SpecifierWithoutExtrasRequirement.__eq__r%   c                 C  rQ   r   rZ   r   r   r   r   r'      r[   z*SpecifierWithoutExtrasRequirement.__hash__Nrm   r6   rn   r7   )	r#   r<   r=   __doc__r   r>   rS   r-   r'   r   r   r   r   ro   |   s    

ro   c                   @  s|   e Zd ZdZd%dd	Zd&ddZd&ddZd'ddZd(ddZe	d)ddZ
e	d&ddZd&ddZd*dd Zd+d"d#Zd$S ),RequiresPythonRequirementz4A requirement representing Requires-Python metadata.ri   r   matchr
   r   r   c                 C  s    || _ t|| _d | _|| _d S r   )ri   r   _specifier_stringrL   
_candidate)r   ri   rr   r   r   r   r      s   

z"RequiresPythonRequirement.__init__r   c                 C  s   d| j  S )NzPython )ri   r   r   r   r   r      rV   z!RequiresPythonRequirement.__str__c                 C     | j j dt| jdS r   )r"   r#   r   ri   r   r   r   r   r$         z"RequiresPythonRequirement.__repr__r%   c                 C  s(   | j d ur| j S t| j| jf| _ | j S r   )rL   r&   rs   rt   r   r   r   r   r'      s   
z"RequiresPythonRequirement.__hash__r(   r   r)   c                 C  s&   t |tsdS | j|jko| j|jkS r*   )r+   rq   rs   rt   r,   r   r   r   r-      s
   

z RequiresPythonRequirement.__eq__r   c                 C  r/   r   )rt   r0   r   r   r   r   r0         z&RequiresPythonRequirement.project_namec                 C  r/   r   )rt   r2   r   r   r   r   r2      rw   zRequiresPythonRequirement.namec                 C     t | S r   r   r   r   r   r   r3         z*RequiresPythonRequirement.format_for_errorr   c                 C  s"   | j j| jjddr| jd fS dS )NTrg   NN)ri   rj   rt   rk   r   r   r   r   r4      s   
z.RequiresPythonRequirement.get_candidate_lookupr   c                 C  s(   |j | jj ksJ d| jj|jddS )NzNot Python candidateTrg   )r2   rt   ri   rj   rk   r   r   r   r   r5      s   z)RequiresPythonRequirement.is_satisfied_byN)ri   r   rr   r
   r   r   r6   r7   r8   r9   r:   r;   )r#   r<   r=   rp   r   r   r$   r'   r-   r>   r0   r2   r3   r4   r5   r   r   r   r   rq      s    






rq   c                   @  s|   e Zd ZdZd#ddZd$d	d
Zd$ddZd%ddZd&ddZe	d'ddZ
e	d$ddZd$ddZd(ddZd)d d!Zd"S )*UnsatisfiableRequirementz'A requirement that cannot be satisfied.r2   r   r   r   c                 C  r   r   _name)r   r2   r   r   r   r      r   z!UnsatisfiableRequirement.__init__r   c                 C  s   | j  dS )Nz (unavailable)r}   r   r   r   r   r      rV   z UnsatisfiableRequirement.__str__c                 C  ru   r   )r"   r#   r   r~   r   r   r   r   r$      rv   z!UnsatisfiableRequirement.__repr__r(   rW   r)   c                 C  rX   r   )r+   r|   rY   r~   r,   r   r   r   r-      r.   zUnsatisfiableRequirement.__eq__r%   c                 C  r   r   )r&   r~   r   r   r   r   r'      r   z!UnsatisfiableRequirement.__hash__c                 C     | j S r   r}   r   r   r   r   r0         z%UnsatisfiableRequirement.project_namec                 C  r   r   r}   r   r   r   r   r2      r   zUnsatisfiableRequirement.namec                 C  rx   r   ry   r   r   r   r   r3      rz   z)UnsatisfiableRequirement.format_for_errorr   c                 C     dS )Nr{   r   r   r   r   r   r4         z-UnsatisfiableRequirement.get_candidate_lookupr   r
   c                 C  r   r*   r   r   r   r   r   r5      r   z(UnsatisfiableRequirement.is_satisfied_byN)r2   r   r   r   r6   rn   r7   r9   r:   r;   )r#   r<   r=   rp   r   r   r$   r-   r'   r>   r0   r2   r3   r4   r5   r   r   r   r   r|      s    






r|   N)
__future__r   typingr    pip._vendor.packaging.specifiersr   pip._vendor.packaging.utilsr   r   pip._internal.req.constructorsr   pip._internal.req.req_installr   baser
   r   r   r   r   r?   ro   rq   r|   r   r   r   r   <module>   s    &H"6