a
    ˆÀàgQ  ã                   @   s˜   d dl mZ d dlmZ ddlmZmZ erTd dlmZ d dl	m
Z
 ddl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 )é    )Úcanonicalize_name)ÚMYPY_CHECK_RUNNINGé   )ÚRequirementÚformat_name)ÚSpecifierSet)ÚInstallRequirement)Ú	CandidateÚCandidateLookupc                   @   sT   e Zd Zdd„ Zdd„ Zdd„ Zedd„ ƒZed	d
„ ƒZdd„ Z	dd„ Z
dd„ ZdS )ÚExplicitRequirementc                 C   s
   || _ d S ©N©Ú	candidate©Úselfr   © r   úi/var/www/sistema_ama/venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/requirements.pyÚ__init__   s    zExplicitRequirement.__init__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_by3   s    z#ExplicitRequirement.is_satisfied_byN©r   Ú
__module__Ú__qualname__r   r   r   Úpropertyr   r   r   r   r    r   r   r   r   r      s   

r   c                   @   sT   e Zd Zdd„ Zdd„ Zdd„ Zedd„ ƒZed	d
„ ƒZdd„ Z	dd„ Z
dd„ ZdS )ÚSpecifierRequirementc                 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   Úireqr   r   r   r   9   s    zSpecifierRequirement.__init__c                 C   s   t | jjƒS r   )r   r'   Úreqr   r   r   r   r   ?   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   C   s    
þzSpecifierRequirement.__repr__c                 C   s   t | jjjƒS r   )r   r'   r,   r   r   r   r   r   r   J   s    z!SpecifierRequirement.project_namec                 C   s   t | j| jƒS r   )r   r   r*   r   r   r   r   r   O   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>[   ó    z9SpecifierRequirement.format_for_error.<locals>.<listcomp>ú,r   Ú r   z, éÿÿÿÿz and )r   ÚsplitÚlenÚjoin)r   Úpartsr   r   r   r   T   s    z%SpecifierRequirement.format_for_errorc                 C   s
   d | j fS r   )r'   r   r   r   r   r   c   s    z)SpecifierRequirement.get_candidate_lookupc                 C   s:   |j | j ks J d |j | j ¡ƒ‚| jjj}|j|jdd�S )Nz?Internal issue: Candidate is not for this requirement  {} vs {}T©Úprereleases)r   r   r'   r,   Ú	specifierÚcontainsÚversion)r   r   Úspecr   r   r   r    g   s    ÿÿ
z$SpecifierRequirement.is_satisfied_byNr!   r   r   r   r   r%   8   s   

r%   c                   @   sX   e Zd ZdZdd„ Zdd„ Zdd„ Zedd	„ ƒZed
d„ ƒZ	dd„ Z
dd„ Zdd„ ZdS )ÚRequiresPythonRequirementz9A requirement representing Requires-Python metadata.
    c                 C   s   || _ || _d S r   )r<   Ú
_candidate)r   r<   Úmatchr   r   r   r   v   s    z"RequiresPythonRequirement.__init__c                 C   s   d  | j¡S )Nz	Python {})r   r<   r   r   r   r   r   {   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      s    þz"RequiresPythonRequirement.__repr__c                 C   s   | j jS r   )rA   r   r   r   r   r   r   †   s    z&RequiresPythonRequirement.project_namec                 C   s   | j jS r   )rA   r   r   r   r   r   r   ‹   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 )NTr:   ©NN)r<   r=   rA   r>   r   r   r   r   r   ”   s    
z.RequiresPythonRequirement.get_candidate_lookupc                 C   s(   |j | jj ksJ dƒ‚| jj|jdd�S )NzNot Python candidateTr:   )r   rA   r<   r=   r>   r   r   r   r   r    š   s    z)RequiresPythonRequirement.is_satisfied_byN©r   r"   r#   Ú__doc__r   r   r   r$   r   r   r   r   r    r   r   r   r   r@   s   s   

r@   c                   @   sX   e Zd ZdZdd„ Zdd„ Zdd„ Zedd	„ ƒZed
d„ ƒZ	dd„ Z
dd„ Zdd„ ZdS )ÚUnsatisfiableRequirementz,A requirement that cannot be satisfied.
    c                 C   s
   || _ d S r   ©Ú_name)r   r   r   r   r   r   ¦   s    z!UnsatisfiableRequirement.__init__c                 C   s   d  | j¡S )Nz{} (unavailable))r   rI   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   rI   r   r   r   r   r   ®   s    þz!UnsatisfiableRequirement.__repr__c                 C   s   | j S r   rH   r   r   r   r   r   µ   s    z%UnsatisfiableRequirement.project_namec                 C   s   | j S r   rH   r   r   r   r   r   º   s    zUnsatisfiableRequirement.namec                 C   s   t | ƒS r   rC   r   r   r   r   r   ¿   s    z)UnsatisfiableRequirement.format_for_errorc                 C   s   dS )NrD   r   r   r   r   r   r   Ã   s    z-UnsatisfiableRequirement.get_candidate_lookupc                 C   s   dS )NFr   r   r   r   r   r    Ç   s    z(UnsatisfiableRequirement.is_satisfied_byNrE   r   r   r   r   rG   £   s   

rG   N)Úpip._vendor.packaging.utilsr   Úpip._internal.utils.typingr   Úbaser   r   Ú pip._vendor.packaging.specifiersr   Úpip._internal.req.req_installr   r	   r
   r   r%   r@   rG   r   r   r   r   Ú<module>   s   );0