o
    Ëý°jO  ã                   @   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deddfdd„Zdefdd„Zdefdd	„Zede	fd
d„ƒZ
edefdd„ƒZdefdd„Zdefdd„Zdedefdd„ZdS )ÚExplicitRequirementÚ	candidateÚreturnNc                 C   ó
   || _ d S ©N©r   ©Úselfr   © r   ú£/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/requirements.pyÚ__init__
   ó   
zExplicitRequirement.__init__c                 C   s
   t | jƒS r   )Ústrr   ©r   r   r   r   Ú__str__   r   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   ó   | j jS r   )r   Úproject_namer   r   r   r   r       ó   z ExplicitRequirement.project_namec                 C   r   r   )r   Únamer   r   r   r   r"      r!   zExplicitRequirement.namec                 C   s
   | j  ¡ S r   )r   Úformat_for_errorr   r   r   r   r#       r   z$ExplicitRequirement.format_for_errorc                 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_by&   r   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deddfdd„Zdefdd„Zdefdd	„Zede	fd
d„ƒZ
edefdd„ƒZdefdd„Zdefdd„Zdedefdd„ZdS )ÚSpecifierRequirementÚireqr   Nc                 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__c                 C   s   t | jjƒS r   )r   r-   Úreqr   r   r   r   r   0   ó   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-   r1   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-   r1   r   r"   r   r   r   r   r    9   s   z!SpecifierRequirement.project_namec                 C   s   t | j| jƒS r   )r
   r    r0   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   s    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   r   z)SpecifierRequirement.get_candidate_lookupr   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 r4   T©Úprereleases)r"   r-   r1   Ú	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dededdfdd„Zdefdd	„Zdefd
d„Z	e
defdd„ƒZe
defdd„ƒZdefdd„Zdefdd„Zdedefdd„ZdS )ÚRequiresPythonRequirementz4A requirement representing Requires-Python metadata.rB   Úmatchr   Nc                 C   s   || _ || _d S r   )rB   Ú
_candidate)r   rB   rG   r   r   r   r   c   s   
z"RequiresPythonRequirement.__init__c                 C   s   d| j › �S )NzPython )rB   r   r   r   r   r   g   r2   z!RequiresPythonRequirement.__str__c                 C   ó   dj | jjt| jƒd�S )Nz{class_name}({specifier!r}))r   rB   )r   r   r   r   rB   r   r   r   r   r   j   ó   þz"RequiresPythonRequirement.__repr__c                 C   r   r   )rH   r    r   r   r   r   r    p   ó   z&RequiresPythonRequirement.project_namec                 C   r   r   )rH   r"   r   r   r   r   r"   t   rK   zRequiresPythonRequirement.namec                 C   ó   t | ƒS r   ©r   r   r   r   r   r#   x   ó   z*RequiresPythonRequirement.format_for_errorc                 C   s"   | j j| jjdd�r| jd fS dS )NTr@   ©NN)rB   rC   rH   rD   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"   rH   rB   rC   rD   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   rF   `   s    rF   c                   @   s�   e Zd ZdZdeddfdd„Zdefdd„Zdefd	d
„Ze	defdd„ƒZ
e	defdd„ƒZdefdd„Zdefdd„Zdedefdd„ZdS )ÚUnsatisfiableRequirementz'A requirement that cannot be satisfied.r"   r   Nc                 C   r   r   ©Ú_name)r   r"   r   r   r   r   ‹   r   z!UnsatisfiableRequirement.__init__c                 C   s   | j › d�S )Nz (unavailable)rR   r   r   r   r   r   Ž   r2   z UnsatisfiableRequirement.__str__c                 C   rI   )Nz{class_name}({name!r}))r   r"   )r   r   r   r   rS   r   r   r   r   r   ‘   rJ   z!UnsatisfiableRequirement.__repr__c                 C   ó   | j S r   rR   r   r   r   r   r    —   ó   z%UnsatisfiableRequirement.project_namec                 C   rT   r   rR   r   r   r   r   r"   ›   rU   zUnsatisfiableRequirement.namec                 C   rL   r   rM   r   r   r   r   r#   Ÿ   rN   z)UnsatisfiableRequirement.format_for_errorc                 C   ó   dS )NrO   r   r   r   r   r   r$   ¢   ó   z-UnsatisfiableRequirement.get_candidate_lookupr   c                 C   rV   )NFr   r   r   r   r   r%   ¥   rW   z(UnsatisfiableRequirement.is_satisfied_by)r   r&   r'   rP   r   r   r   r   r   r(   r    r"   r#   r   r$   r   r)   r%   r   r   r   r   rQ   ˆ   s    rQ   N)Ú pip._vendor.packaging.specifiersr   Úpip._vendor.packaging.utilsr   r   Úpip._internal.req.req_installr   Úbaser   r   r	   r
   r   r*   rF   rQ   r   r   r   r   Ú<module>   s    !6(