o
    ­—Žj/   ã                   @  s¸   d dl mZ d dlmZ 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 )é    )Úannotations)ÚAny)ÚSpecifierSet)ÚNormalizedNameÚcanonicalize_name)Úinstall_req_drop_extras)ÚInstallRequirementé   )Ú	CandidateÚCandidateLookupÚRequirementÚformat_namec                   @  sx   e Zd Zd!dd„Zd"dd	„Zd"d
d„Zd#dd„Zd$dd„Zed%dd„ƒZ	ed"dd„ƒZ
d"dd„Zd&dd„Zd'dd„Zd S )(ÚExplicitRequirementÚ	candidater
   ÚreturnÚNonec                 C  ó
   || _ d S ©N©r   ©Úselfr   © r   úm/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/requirements.pyÚ__init__   ó   
zExplicitRequirement.__init__Ústrc                 C  ó
   t | jƒS r   )r   r   ©r   r   r   r   Ú__str__   r   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__Úintc                 C  r   r   )Úhashr   r   r   r   r   Ú__hash__   r   zExplicitRequirement.__hash__Úotherr   Úboolc                 C  s   t |tƒsdS | j|jkS ©NF)Ú
isinstancer   r   ©r   r(   r   r   r   Ú__eq__   ó   
zExplicitRequirement.__eq__r   c                 C  ó   | j jS r   )r   Úproject_namer   r   r   r   r0       ó   z ExplicitRequirement.project_namec                 C  r/   r   )r   Únamer   r   r   r   r2   %   r1   zExplicitRequirement.namec                 C  s
   | j  ¡ S r   )r   Úformat_for_errorr   r   r   r   r3   *   r   z$ExplicitRequirement.format_for_errorr   c                 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_by0   r   z#ExplicitRequirement.is_satisfied_byN)r   r
   r   r   ©r   r   ©r   r%   ©r(   r   r   r)   ©r   r   ©r   r   ©r   r
   r   r)   )r#   Ú
__module__Ú__qualname__r   r   r$   r'   r-   Úpropertyr0   r2   r3   r4   r5   r   r   r   r   r      s    






r   c                   @  s†   e Zd Zd%dd„Zed&dd	„ƒZd&d
d„Zd&dd„Zd'dd„Zd(dd„Z	ed)dd„ƒZ
ed&dd„ƒZd&dd„Zd*dd„Zd+d"d#„Zd$S ),ÚSpecifierRequirementÚireqr   r   r   c                 C  s@   |j d u s	J dƒ‚|| _d | _d | _tdd„ | jjD ƒƒ| _d S )NúThis is a link, not a specifierc                 s  ó   � | ]}t |ƒV  qd S r   ©r   ©Ú.0Úer   r   r   Ú	<genexpr>:   ó   € z0SpecifierRequirement.__init__.<locals>.<genexpr>)ÚlinkÚ_ireqÚ_equal_cacheÚ_hashÚ	frozensetÚextrasÚ_extras©r   r@   r   r   r   r   5   s
   zSpecifierRequirement.__init__r   c                 C  ó"   | j d ur| j S t| jƒ| _ | j S r   ©rK   r   rJ   r   r   r   r   Ú_equal<   ó   
zSpecifierRequirement._equalc                 C  s   t | jjƒS r   )r   rJ   Úreqr   r   r   r   r   D   ó   zSpecifierRequirement.__str__c                 C  s   | j j› dt| jjƒ›d�S r   )r"   r#   r   rJ   rU   r   r   r   r   r$   G   s   zSpecifierRequirement.__repr__r(   Úobjectr)   c                 C  ó   t |tƒstS | j|jkS r   )r+   r?   ÚNotImplementedrS   r,   r   r   r   r-   J   r.   zSpecifierRequirement.__eq__r%   c                 C  rQ   r   ©rL   r&   rS   r   r   r   r   r'   O   ó   
zSpecifierRequirement.__hash__r   c                 C  s   | j jsJ dƒ‚t| j jjƒS )Nú'Specifier-backed ireq is always PEP 508)rJ   rU   r   r2   r   r   r   r   r0   V   s   z!SpecifierRequirement.project_namec                 C  s   t | j| jƒS r   )r   r0   rO   r   r   r   r   r2   [   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)rE   Úsr   r   r   Ú
<listcomp>d   s    z9SpecifierRequirement.format_for_error.<locals>.<listcomp>ú,r   Ú r	   z, éÿÿÿÿz and )r   ÚsplitÚlenÚjoin)r   Úpartsr   r   r   r3   _   s   z%SpecifierRequirement.format_for_errorr   c                 C  s
   d | j fS r   )rJ   r   r   r   r   r4   l   r   z)SpecifierRequirement.get_candidate_lookupr   r
   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 r\   T©Úprereleases)r2   rJ   rU   Ú	specifierÚcontainsÚversion)r   r   Úspecr   r   r   r5   o   s   ÿÿÿ
z$SpecifierRequirement.is_satisfied_byN©r@   r   r   r   r6   ©r(   rW   r   r)   r7   r9   r:   r;   )r#   r<   r=   r   r>   rS   r   r$   r-   r'   r0   r2   r3   r4   r5   r   r   r   r   r?   4   s    






r?   c                   @  s<   e Zd ZdZddd„Zedd	d
„ƒZddd„Z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.
    r@   r   r   r   c                 C  sD   |j d u s	J dƒ‚t|ƒ| _d | _d | _tdd„ | jjD ƒƒ| _d S )NrA   c                 s  rB   r   rC   rD   r   r   r   rG   ‡   rH   z=SpecifierWithoutExtrasRequirement.__init__.<locals>.<genexpr>)rI   r   rJ   rK   rL   rM   rN   rO   rP   r   r   r   r   ‚   s
   
z*SpecifierWithoutExtrasRequirement.__init__r   c                 C  rQ   r   rR   r   r   r   r   rS   ‰   rT   z(SpecifierWithoutExtrasRequirement._equalr(   rW   r)   c                 C  rX   r   )r+   ro   rY   rS   r,   r   r   r   r-   ‘   r.   z(SpecifierWithoutExtrasRequirement.__eq__r%   c                 C  rQ   r   rZ   r   r   r   r   r'   –   r[   z*SpecifierWithoutExtrasRequirement.__hash__Nrm   r6   rn   r7   )	r#   r<   r=   Ú__doc__r   r>   rS   r-   r'   r   r   r   r   ro   |   s    

ro   c                   @  s|   e Zd ZdZd%dd	„Zd&dd„Zd&dd„Zd'dd„Zd(dd„Ze	d)dd„ƒZ
e	d&dd„ƒZd&dd„Zd*dd „Zd+d"d#„Zd$S ),ÚRequiresPythonRequirementz4A requirement representing Requires-Python metadata.ri   r   Úmatchr
   r   r   c                 C  sD   || _ t|ƒ| _d | _|| _|j|jdd�r|d f| _d S d| _d S )NTrg   ©NN)ri   r   Ú_specifier_stringrL   Ú
_candidaterj   rk   Ú_candidate_lookup)r   ri   rr   r   r   r   r   ¡   s   

z"RequiresPythonRequirement.__init__r   c                 C  s   d| j › �S )NzPython )ri   r   r   r   r   r   ­   rV   z!RequiresPythonRequirement.__str__c                 C  ó   | j j› dt| jƒ›d�S r   )r"   r#   r   ri   r   r   r   r   r$   °   ó   z"RequiresPythonRequirement.__repr__r%   c                 C  s(   | j d ur| j S t| j| jfƒ| _ | j S r   )rL   r&   rt   ru   r   r   r   r   r'   ³   s   
z"RequiresPythonRequirement.__hash__r(   r   r)   c                 C  s&   t |tƒsdS | j|jko| j|jkS r*   )r+   rq   rt   ru   r,   r   r   r   r-   º   s
   

þz RequiresPythonRequirement.__eq__r   c                 C  r/   r   )ru   r0   r   r   r   r   r0   Â   ó   z&RequiresPythonRequirement.project_namec                 C  r/   r   )ru   r2   r   r   r   r   r2   Æ   ry   zRequiresPythonRequirement.namec                 C  ó   t | ƒS r   ©r   r   r   r   r   r3   Ê   ó   z*RequiresPythonRequirement.format_for_errorr   c                 C  ó   | j S r   )rv   r   r   r   r   r4   Í   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 candidateTrg   )r2   ru   ri   rj   rk   r   r   r   r   r5   Ð   s   z)RequiresPythonRequirement.is_satisfied_byN)ri   r   rr   r
   r   r   r6   r7   r8   r9   r:   r;   )r#   r<   r=   rp   r   r   r$   r'   r-   r>   r0   r2   r3   r4   r5   r   r   r   r   rq   ž   s    






rq   c                   @  s|   e Zd ZdZd#dd„Zd$d	d
„Zd$dd„Zd%dd„Zd&dd„Ze	d'dd„ƒZ
e	d$dd„ƒZd$dd„Zd(dd„Zd)d d!„Zd"S )*ÚUnsatisfiableRequirementz'A requirement that cannot be satisfied.r2   r   r   r   c                 C  r   r   ©Ú_name)r   r2   r   r   r   r   Û   r   z!UnsatisfiableRequirement.__init__r   c                 C  s   | j › d�S )Nz (unavailable)r   r   r   r   r   r   Þ   rV   z UnsatisfiableRequirement.__str__c                 C  rw   r   )r"   r#   r   r€   r   r   r   r   r$   á   rx   z!UnsatisfiableRequirement.__repr__r(   rW   r)   c                 C  rX   r   )r+   r~   rY   r€   r,   r   r   r   r-   ä   r.   zUnsatisfiableRequirement.__eq__r%   c                 C  r   r   )r&   r€   r   r   r   r   r'   é   r   z!UnsatisfiableRequirement.__hash__c                 C  r}   r   r   r   r   r   r   r0   ì   ó   z%UnsatisfiableRequirement.project_namec                 C  r}   r   r   r   r   r   r   r2   ð   r�   zUnsatisfiableRequirement.namec                 C  rz   r   r{   r   r   r   r   r3   ô   r|   z)UnsatisfiableRequirement.format_for_errorr   c                 C  ó   dS )Nrs   r   r   r   r   r   r4   ÷   ó   z-UnsatisfiableRequirement.get_candidate_lookupr   r
   c                 C  r‚   r*   r   r   r   r   r   r5   ú   rƒ   z(UnsatisfiableRequirement.is_satisfied_byN)r2   r   r   r   r6   rn   r7   r9   r:   r;   )r#   r<   r=   rp   r   r   r$   r-   r'   r>   r0   r2   r3   r4   r5   r   r   r   r   r~   Ø   s    






r~   N)Ú
__future__r   Útypingr   Ú pip._vendor.packaging.specifiersr   Úpip._vendor.packaging.utilsr   r   Úpip._internal.req.constructorsr   Úpip._internal.req.req_installr   Úbaser
   r   r   r   r   r?   ro   rq   r~   r   r   r   r   Ú<module>   s    &H":