U
    Qe@                     @   s   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 )    )SpecifierSet)NormalizedNamecanonicalize_name)install_req_drop_extras)InstallRequirement   )	CandidateCandidateLookupRequirementformat_namec                   @   s   e Zd ZeddddZedddZeddd	Zee	dd
dZ
eedddZedddZedddZeedddZdS )ExplicitRequirementN	candidatereturnc                 C   s
   || _ d S Nr   selfr    r   f/var/www/html/htmlvenv/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/requirements.py__init__   s    zExplicitRequirement.__init__r   c                 C   s
   t | jS r   )strr   r   r   r   r   __str__   s    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__c                 C   s   | j jS r   )r   project_namer   r   r   r   r!      s    z ExplicitRequirement.project_namec                 C   s   | j jS r   )r   namer   r   r   r   r"      s    zExplicitRequirement.namec                 C   s
   | j  S r   )r   format_for_errorr   r   r   r   r#      s    z$ExplicitRequirement.format_for_errorc                 C   s
   | j d fS r   r   r   r   r   r   get_candidate_lookup!   s    z(ExplicitRequirement.get_candidate_lookupc                 C   s
   || j kS r   r   r   r   r   r   is_satisfied_by$   s    z#ExplicitRequirement.is_satisfied_by)r   
__module____qualname__r   r   r   r   r    propertyr   r!   r"   r#   r	   r$   boolr%   r   r   r   r   r   
   s   r   c                   @   s   e Zd ZeddddZedddZeddd	Zee	dd
dZ
eedddZedddZedddZeedddZdS )SpecifierRequirementNireqr   c                 C   s4   |j d kstd|| _tdd | jjD | _d S )NThis is a link, not a specifierc                 s   s   | ]}t |V  qd S r   r   .0er   r   r   	<genexpr>,   s     z0SpecifierRequirement.__init__.<locals>.<genexpr>)linkAssertionError_ireq	frozensetextras_extrasr   r,   r   r   r   r   )   s    zSpecifierRequirement.__init__r   c                 C   s   t | jjS r   )r   r5   reqr   r   r   r   r   .   s    zSpecifierRequirement.__str__c                 C   s   | j j dt| jjdS r   )r   r   r   r5   r:   r   r   r   r   r    1   s    zSpecifierRequirement.__repr__c                 C   s   | j jstdt| j jjS )N'Specifier-backed ireq is always PEP 508)r5   r:   r4   r   r"   r   r   r   r   r!   4   s    z!SpecifierRequirement.project_namec                 C   s   t | j| jS r   )r   r!   r8   r   r   r   r   r"   9   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)r0   sr   r   r   
<listcomp>B   s     z9SpecifierRequirement.format_for_error.<locals>.<listcomp>,r    r   z, z and )r   splitlenjoin)r   partsr   r   r   r#   =   s    z%SpecifierRequirement.format_for_errorc                 C   s
   d | j fS r   )r5   r   r   r   r   r$   J   s    z)SpecifierRequirement.get_candidate_lookupr   c                 C   sN   |j | j ks$td|j  d| j  | jjs4td| jjj}|j|jddS )Nz6Internal issue: Candidate is not for this requirement z vs r;   Tprereleases)r"   r4   r5   r:   	specifiercontainsversion)r   r   specr   r   r   r%   M   s    
z$SpecifierRequirement.is_satisfied_by)r   r&   r'   r   r   r   r   r    r(   r   r!   r"   r#   r	   r$   r   r)   r%   r   r   r   r   r*   (   s   r*   c                   @   s    e Zd ZdZed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.
    Nr+   c                 C   s8   |j d kstdt|| _tdd | jjD | _d S )Nr-   c                 s   s   | ]}t |V  qd S r   r.   r/   r   r   r   r2   c   s     z=SpecifierWithoutExtrasRequirement.__init__.<locals>.<genexpr>)r3   r4   r   r5   r6   r7   r8   r9   r   r   r   r   `   s    
z*SpecifierWithoutExtrasRequirement.__init__)r   r&   r'   __doc__r   r   r   r   r   r   rL   Z   s   rL   c                   @   s   e Zd ZdZeeddddZedddZedd	d
Z	e
edddZe
edddZedddZedddZeedddZdS )RequiresPythonRequirementz4A requirement representing Requires-Python metadata.N)rH   matchr   c                 C   s   || _ || _d S r   )rH   
_candidate)r   rH   rO   r   r   r   r   i   s    z"RequiresPythonRequirement.__init__r   c                 C   s   d| j  S )NzPython )rH   r   r   r   r   r   m   s    z!RequiresPythonRequirement.__str__c                 C   s   | j j dt| jdS r   )r   r   r   rH   r   r   r   r   r    p   s    z"RequiresPythonRequirement.__repr__c                 C   s   | j jS r   )rP   r!   r   r   r   r   r!   s   s    z&RequiresPythonRequirement.project_namec                 C   s   | j jS r   )rP   r"   r   r   r   r   r"   w   s    zRequiresPythonRequirement.namec                 C   s   t | S r   r   r   r   r   r   r#   {   s    z*RequiresPythonRequirement.format_for_errorc                 C   s"   | j j| jjddr| jd fS dS )NTrF   NN)rH   rI   rP   rJ   r   r   r   r   r$   ~   s    
z.RequiresPythonRequirement.get_candidate_lookupr   c                 C   s(   |j | jj kstd| jj|jddS )NzNot Python candidateTrF   )r"   rP   r4   rH   rI   rJ   r   r   r   r   r%      s    z)RequiresPythonRequirement.is_satisfied_by)r   r&   r'   rM   r   r   r   r   r   r    r(   r   r!   r"   r#   r	   r$   r)   r%   r   r   r   r   rN   f   s   rN   c                   @   s   e Zd ZdZeddddZedddZedd	d
Ze	edddZ
e	edddZedddZedddZeedddZdS )UnsatisfiableRequirementz'A requirement that cannot be satisfied.N)r"   r   c                 C   s
   || _ d S r   _name)r   r"   r   r   r   r      s    z!UnsatisfiableRequirement.__init__r   c                 C   s   | j  dS )Nz (unavailable)rT   r   r   r   r   r      s    z UnsatisfiableRequirement.__str__c                 C   s   | j j dt| jdS r   )r   r   r   rU   r   r   r   r   r       s    z!UnsatisfiableRequirement.__repr__c                 C   s   | j S r   rT   r   r   r   r   r!      s    z%UnsatisfiableRequirement.project_namec                 C   s   | j S r   rT   r   r   r   r   r"      s    zUnsatisfiableRequirement.namec                 C   s   t | S r   rQ   r   r   r   r   r#      s    z)UnsatisfiableRequirement.format_for_errorc                 C   s   dS )NrR   r   r   r   r   r   r$      s    z-UnsatisfiableRequirement.get_candidate_lookupr   c                 C   s   dS )NFr   r   r   r   r   r%      s    z(UnsatisfiableRequirement.is_satisfied_by)r   r&   r'   rM   r   r   r   r   r    r(   r!   r"   r#   r	   r$   r   r)   r%   r   r   r   r   rS      s   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   r*   rL   rN   rS   r   r   r   r   <module>   s   2%