a
    <Bì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                   @  s¦   e Zd Zdddœdd„Zddœdd	„Zddœd
d„Zddœdd„Zdddœdd„Zeddœdd„ƒZ	eddœdd„ƒZ
ddœdd„Zddœdd„Zdddœdd„Zd S )!ÚExplicitRequirementr
   ÚNone©Ú	candidateÚreturnc                 C  s
   || _ d S ©N©r   ©Úselfr   © r   úo/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/requirements.pyÚ__init__   s    zExplicitRequirement.__init__Ústr©r   c                 C  s
   t | jƒS r   )r   r   ©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__Úintc                 C  s
   t | jƒS r   )Úhashr   r   r   r   r   Ú__hash__   s    zExplicitRequirement.__hash__r   Úbool©Úotherr   c                 C  s   t |tƒsdS | j|jkS ©NF)Ú
isinstancer   r   ©r   r)   r   r   r   Ú__eq__   s    
zExplicitRequirement.__eq__r   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   r0   *   s    z$ExplicitRequirement.format_for_errorr   c                 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_by0   s    z#ExplicitRequirement.is_satisfied_byN)r"   Ú
__module__Ú__qualname__r   r   r#   r&   r-   Úpropertyr.   r/   r0   r1   r2   r   r   r   r   r      s   r   c                   @  s¸   e Zd Zdddœdd„Zeddœdd	„ƒZddœd
d„Zddœdd„Zdddœdd„Zddœdd„Z	eddœdd„ƒZ
eddœdd„ƒZddœdd„Zddœdd„Zd dd!œd"d#„Zd$S )%ÚSpecifierRequirementr   r   ©Úireqr   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  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   r8   r   r   r   r   5   s
    zSpecifierRequirement.__init__r   r   c                 C  s"   | j d ur| j S t| jƒ| _ | j S r   ©rB   r   rA   r   r   r   r   Ú_equal<   s    
zSpecifierRequirement._equalc                 C  s   t | jjƒS r   )r   rA   Úreqr   r   r   r   r   D   s    zSpecifierRequirement.__str__c                 C  s   | j j› dt| jjƒ›d�S r   )r!   r"   r   rA   rJ   r   r   r   r   r#   G   s    zSpecifierRequirement.__repr__Úobjectr'   r(   c                 C  s   t |tƒstS | j|jkS r   )r+   r6   ÚNotImplementedrI   r,   r   r   r   r-   J   s    
zSpecifierRequirement.__eq__r$   c                 C  s"   | j d ur| j S t| jƒ| _ | j S r   ©rC   r%   rI   r   r   r   r   r&   O   s    
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)rA   rJ   r   r/   r   r   r   r   r.   V   s    z!SpecifierRequirement.project_namec                 C  s   t | j| jƒS r   )r   r.   rF   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)r<   Úsr   r   r   Ú
<listcomp>d   r?   z9SpecifierRequirement.format_for_error.<locals>.<listcomp>ú,r   Ú r	   z, éÿÿÿÿz and )r   ÚsplitÚlenÚjoin)r   Úpartsr   r   r   r0   _   s    z%SpecifierRequirement.format_for_errorr   c                 C  s
   d | j fS r   )rA   r   r   r   r   r1   l   s    z)SpecifierRequirement.get_candidate_lookupr
   r   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 rN   T©Úprereleases)r/   rA   rJ   Ú	specifierÚcontainsÚversion)r   r   Úspecr   r   r   r2   o   s    ÿÿÿ
z$SpecifierRequirement.is_satisfied_byN)r"   r3   r4   r   r5   rI   r   r#   r-   r&   r.   r/   r0   r1   r2   r   r   r   r   r6   4   s   r6   c                   @  sP   e Zd ZdZdddœdd„Zeddœd	d
„ƒZdddœdd„Z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.
    r   r   r7   c                 C  sD   |j d u sJ dƒ‚t|ƒ| _d | _d | _tdd„ | jjD ƒƒ| _d S )Nr9   c                 s  s   | ]}t |ƒV  qd S r   r:   r;   r   r   r   r>   ‡   r?   z=SpecifierWithoutExtrasRequirement.__init__.<locals>.<genexpr>)r@   r   rA   rB   rC   rD   rE   rF   rG   r   r   r   r   ‚   s
    
z*SpecifierWithoutExtrasRequirement.__init__r   r   c                 C  s"   | j d ur| j S t| jƒ| _ | j S r   rH   r   r   r   r   rI   ‰   s    
z(SpecifierWithoutExtrasRequirement._equalrK   r'   r(   c                 C  s   t |tƒstS | j|jkS r   )r+   r_   rL   rI   r,   r   r   r   r-   ‘   s    
z(SpecifierWithoutExtrasRequirement.__eq__r$   c                 C  s"   | j d ur| j S t| jƒ| _ | j S r   rM   r   r   r   r   r&   –   s    
z*SpecifierWithoutExtrasRequirement.__hash__N)	r"   r3   r4   Ú__doc__r   r5   rI   r-   r&   r   r   r   r   r_   |   s   r_   c                   @  s¬   e Zd ZdZddddœdd„Zdd	œd
d„Zdd	œdd„Zdd	œdd„Zdddœdd„Ze	dd	œdd„ƒZ
e	dd	œdd„ƒZdd	œdd„Zdd	œdd„Zddd œd!d"„Zd#S )$ÚRequiresPythonRequirementz4A requirement representing Requires-Python metadata.r   r
   r   )r[   Úmatchr   c                 C  sB   || _ t|ƒ| _d | _|| _|j|jdd�r8|d f| _nd| _d S )NTrY   ©NN)r[   r   Ú_specifier_stringrC   Ú
_candidater\   r]   Ú_candidate_lookup)r   r[   rb   r   r   r   r   ¡   s    
z"RequiresPythonRequirement.__init__r   r   c                 C  s   d| j › �S )NzPython )r[   r   r   r   r   r   ­   s    z!RequiresPythonRequirement.__str__c                 C  s   | j j› dt| jƒ›d�S r   )r!   r"   r   r[   r   r   r   r   r#   °   s    z"RequiresPythonRequirement.__repr__r$   c                 C  s(   | j d ur| j S t| j| jfƒ| _ | j S r   )rC   r%   rd   re   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+   ra   rd   re   r,   r   r   r   r-   º   s
    

þz RequiresPythonRequirement.__eq__r   c                 C  s   | j jS r   )re   r.   r   r   r   r   r.   Â   s    z&RequiresPythonRequirement.project_namec                 C  s   | j jS r   )re   r/   r   r   r   r   r/   Æ   s    zRequiresPythonRequirement.namec                 C  s   t | ƒS r   ©r   r   r   r   r   r0   Ê   s    z*RequiresPythonRequirement.format_for_errorr   c                 C  s   | j S r   )rf   r   r   r   r   r1   Í   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 candidateTrY   )r/   re   r[   r\   r]   r   r   r   r   r2   Ð   s    z)RequiresPythonRequirement.is_satisfied_byN)r"   r3   r4   r`   r   r   r#   r&   r-   r5   r.   r/   r0   r1   r2   r   r   r   r   ra   ž   s   ra   c                   @  sª   e Zd ZdZdddœdd„Zddœd	d
„Zddœdd„Zdddœdd„Zddœdd„Ze	ddœdd„ƒZ
e	ddœdd„ƒZddœdd„Zddœdd„Zdddœd d!„Zd"S )#ÚUnsatisfiableRequirementz'A requirement that cannot be satisfied.r   r   )r/   r   c                 C  s
   || _ d S r   ©Ú_name)r   r/   r   r   r   r   Û   s    z!UnsatisfiableRequirement.__init__r   r   c                 C  s   | j › d�S )Nz (unavailable)ri   r   r   r   r   r   Þ   s    z UnsatisfiableRequirement.__str__c                 C  s   | j j› dt| jƒ›d�S r   )r!   r"   r   rj   r   r   r   r   r#   á   s    z!UnsatisfiableRequirement.__repr__rK   r'   r(   c                 C  s   t |tƒstS | j|jkS r   )r+   rh   rL   rj   r,   r   r   r   r-   ä   s    
zUnsatisfiableRequirement.__eq__r$   c                 C  s
   t | jƒS r   )r%   rj   r   r   r   r   r&   é   s    z!UnsatisfiableRequirement.__hash__c                 C  s   | j S r   ri   r   r   r   r   r.   ì   s    z%UnsatisfiableRequirement.project_namec                 C  s   | j S r   ri   r   r   r   r   r/   ð   s    zUnsatisfiableRequirement.namec                 C  s   t | ƒS r   rg   r   r   r   r   r0   ô   s    z)UnsatisfiableRequirement.format_for_errorr   c                 C  s   dS )Nrc   r   r   r   r   r   r1   ÷   s    z-UnsatisfiableRequirement.get_candidate_lookupr
   r   c                 C  s   dS r*   r   r   r   r   r   r2   ú   s    z(UnsatisfiableRequirement.is_satisfied_byN)r"   r3   r4   r`   r   r   r#   r-   r&   r5   r.   r/   r0   r1   r2   r   r   r   r   rh   Ø   s   rh   N)Ú
__future__r   Útypingr   Z pip._vendor.packaging.specifiersr   Zpip._vendor.packaging.utilsr   r   Úpip._internal.req.constructorsr   Zpip._internal.req.req_installr   Úbaser
   r   r   r   r   r6   r_   ra   rh   r   r   r   r   Ú<module>   s   &H":