a
    hbòfO  ã                   @   s„   d dl mZ d dlmZ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dS )é    )ÚSpecifierSet)ÚNormalizedNameÚcanonicalize_name)Ú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   úm/home/httpd/docs/test/DocsMgr/lib/python3.9/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   dj | jj| jd�S )Nz{class_name}({candidate!r}))Ú
class_namer   )ÚformatÚ	__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   s(   |j d u sJ dƒ‚|| _t|jƒ| _d S )NzThis is a link, not a specifier)ÚlinkÚ_ireqÚ	frozensetÚextrasÚ_extras)r   r)   r   r   r   r   +   s    zSpecifierRequirement.__init__r   c                 C   s   t | jjƒS r   )r   r+   Úreqr   r   r   r   r   0   s    zSpecifierRequirement.__str__c                 C   s   dj | jjt| jjƒd�S )Nz{class_name}({requirement!r}))r   Úrequirement)r   r   r   r   r+   r/   r   r   r   r   r   3   s    
þzSpecifierRequirement.__repr__c                 C   s   | j jsJ dƒ‚t| j jjƒS )Nú'Specifier-backed ireq is always PEP 508)r+   r/   r   r    r   r   r   r   r   9   s    z!SpecifierRequirement.project_namec                 C   s   t | j| jƒS r   )r
   r   r.   r   r   r   r   r    >   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)Ú.0Úsr   r   r   Ú
<listcomp>H   ó    z9SpecifierRequirement.format_for_error.<locals>.<listcomp>ú,r   Ú r   z, éÿÿÿÿz and )r   ÚsplitÚlenÚjoin)r   Úpartsr   r   r   r!   B   s    z%SpecifierRequirement.format_for_errorc                 C   s
   d | j fS r   )r+   r   r   r   r   r"   P   s    z)SpecifierRequirement.get_candidate_lookupr   c                 C   sN   |j | j ks$J d|j › d| j › �ƒ‚| jjs4J dƒ‚| jjj}|j|jdd�S )Nz6Internal issue: Candidate is not for this requirement z vs r1   T©Úprereleases)r    r+   r/   Ú	specifierÚcontainsÚversion)r   r   Úspecr   r   r   r#   S   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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)r@   Úmatchr   c                 C   s   || _ || _d S r   )r@   Ú
_candidate)r   r@   rE   r   r   r   r   c   s    z"RequiresPythonRequirement.__init__r   c                 C   s   d| j › �S )NzPython )r@   r   r   r   r   r   g   s    z!RequiresPythonRequirement.__str__c                 C   s   dj | jjt| jƒd�S )Nz{class_name}({specifier!r}))r   r@   )r   r   r   r   r@   r   r   r   r   r   j   s    þz"RequiresPythonRequirement.__repr__c                 C   s   | j jS r   )rF   r   r   r   r   r   r   p   s    z&RequiresPythonRequirement.project_namec                 C   s   | j jS r   )rF   r    r   r   r   r   r    t   s    zRequiresPythonRequirement.namec                 C   s   t | ƒS r   ©r   r   r   r   r   r!   x   s    z*RequiresPythonRequirement.format_for_errorc                 C   s"   | j j| jjdd�r| jd fS dS )NTr>   ©NN)r@   rA   rF   rB   r   r   r   r   r"   {   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 candidateTr>   )r    rF   r@   rA   rB   r   r   r   r   r#   €   s    z)RequiresPythonRequirement.is_satisfied_by)r   r$   r%   Ú__doc__r   r   r   r   r   r   r&   r   r   r    r!   r   r"   r'   r#   r   r   r   r   rD   `   s   rD   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)rK   r   r   r   r   r   Ž   s    z UnsatisfiableRequirement.__str__c                 C   s   dj | jjt| jƒd�S )Nz{class_name}({name!r}))r   r    )r   r   r   r   rL   r   r   r   r   r   ‘   s    þz!UnsatisfiableRequirement.__repr__c                 C   s   | j S r   rK   r   r   r   r   r   —   s    z%UnsatisfiableRequirement.project_namec                 C   s   | j S r   rK   r   r   r   r   r    ›   s    zUnsatisfiableRequirement.namec                 C   s   t | ƒS r   rG   r   r   r   r   r!   Ÿ   s    z)UnsatisfiableRequirement.format_for_errorc                 C   s   dS )NrH   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%   rI   r   r   r   r   r   r&   r   r    r!   r   r"   r   r'   r#   r   r   r   r   rJ   ˆ   s   rJ   N)Z pip._vendor.packaging.specifiersr   Úpip._vendor.packaging.utilsr   r   Zpip._internal.req.req_installr   Úbaser   r   r	   r
   r   r(   rD   rJ   r   r   r   r   Ú<module>   s   !6(