U
    „}ag@  ã                   @   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   úh/var/www/html/publicvenv/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%