U
    +|jŸ  ã                   @   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                   @   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   úxC:\Users\snmko\Desktop\web_content\django_cbt\venv\Lib\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_by-   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 kstdƒ‚|| _t|jƒ| _d S )NzThis is a link, not a specifier)ÚlinkÚAssertionErrorÚ_ireqÚ	frozensetÚextrasÚ_extras)r   Úireqr   r   r   r   3   s    zSpecifierRequirement.__init__c                 C   s   t | jjƒS r   )r   r(   Úreqr   r   r   r   r   9   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   =   s    
þzSpecifierRequirement.__repr__c                 C   s   | j jstdƒ‚t| j jjƒS )Nú'Specifier-backed ireq is always PEP 508)r(   r-   r'   r   r   r   r   r   r   r   D   s    z!SpecifierRequirement.project_namec                 C   s   t | j| jƒS r   )r
   r   r+   r   r   r   r   r   J   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>V   s     z9SpecifierRequirement.format_for_error.<locals>.<listcomp>ú,r   Ú r   z, éÿÿÿÿz and )r   ÚsplitÚlenÚjoin)r   Úpartsr   r   r   r   O   s    z%SpecifierRequirement.format_for_errorc                 C   s
   d | j fS r   )r(   r   r   r   r   r   ^   s    z)SpecifierRequirement.get_candidate_lookupc                 C   sN   |j | j ks$td|j › d| j › �ƒ‚| jjs4tdƒ‚| jjj}|j|jdd�S )Nz6Internal issue: Candidate is not for this requirement z vs r/   T©Úprereleases)r   r'   r(   r-   Ú	specifierÚcontainsÚversion)r   r   Úspecr   r   r   r    b   s    ÿ
z$SpecifierRequirement.is_satisfied_byNr!   r   r   r   r   r%   2   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 )ÚRequiresPythonRequirementz4A requirement representing Requires-Python metadata.c                 C   s   || _ || _d S r   )r=   Ú
_candidate)r   r=   Úmatchr   r   r   r   s   s    z"RequiresPythonRequirement.__init__c                 C   s   d| j › �S )NzPython )r=   r   r   r   r   r   x   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   )rB   r   r   r   r   r   r   ƒ   s    z&RequiresPythonRequirement.project_namec                 C   s   | j jS r   )rB   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>   rB   r?   r   r   r   r   r   ‘   s    
z.RequiresPythonRequirement.get_candidate_lookupc                 C   s(   |j | jj kstdƒ‚| jj|jdd�S )NzNot Python candidateTr;   )r   rB   r'   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   rA   p   s   

rA   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   | j › d�S )Nz (unavailable)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   rJ   r   r   r   r   r   «   s    þz!UnsatisfiableRequirement.__repr__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   rD   r   r   r   r   r   ¼   s    z)UnsatisfiableRequirement.format_for_errorc                 C   s   dS )NrE   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_byNrF   r   r   r   r   rH       s   

rH   N)Z pip._vendor.packaging.specifiersr   Úpip._vendor.packaging.utilsr   r   Zpip._internal.req.req_installr   Úbaser   r   r	   r
   r   r%   rA   rH   r   r   r   r   Ú<module>   s   )>0