U
    +|j-  ã                   @   sÎ   d dl mZmZmZmZmZ d dlmZ d dlm	Z	m
Z
 d dlmZmZ d dlmZmZ d dlmZ d dlmZ eed ee f Zeeef Zd	d
„ ZG dd„ dƒZG dd„ dƒZdd„ ZG dd„ dƒZdS )é    )Ú	FrozenSetÚIterableÚOptionalÚTupleÚUnion)ÚSpecifierSet)ÚNormalizedNameÚcanonicalize_name)ÚLegacyVersionÚVersion)ÚLinkÚlinks_equivalent)ÚInstallRequirement)ÚHashesÚ	Candidatec                 C   s,   |s| S t dd„ |D ƒƒ}d | d |¡¡S )Nc                 s   s   | ]}t |ƒV  qd S ©N)r	   )Ú.0Úe© r   úpC:\Users\snmko\Desktop\web_content\django_cbt\venv\Lib\site-packages\pip/_internal/resolution/resolvelib/base.pyÚ	<genexpr>   s     zformat_name.<locals>.<genexpr>z{}[{}]ú,)ÚsortedÚformatÚjoin)ÚprojectÚextrasÚcanonical_extrasr   r   r   Úformat_name   s    r   c                   @   sL   e Zd Zdd„ Zedd„ ƒZedd„ ƒZdd„ Zd	d
„ Zdd„ Z	dd„ Z
dS )Ú
Constraintc                 C   s   || _ || _|| _d S r   )Ú	specifierÚhashesÚlinks)Úselfr    r!   r"   r   r   r   Ú__init__   s    zConstraint.__init__c                 C   s   t tƒ tƒ tƒ ƒS r   )r   r   r   Ú	frozenset)Úclsr   r   r   Úempty   s    zConstraint.emptyc                 C   s.   |j rt|j gƒntƒ }t|j|jdd�|ƒS ©NF)Útrust_internet)Úlinkr%   r   r    r!   )r&   Úireqr"   r   r   r   Ú	from_ireq#   s    zConstraint.from_ireqc                 C   s   t | jƒpt | jƒpt | jƒS r   )Úboolr    r!   r"   ©r#   r   r   r   Ú__nonzero__)   s    zConstraint.__nonzero__c                 C   s   |   ¡ S r   )r/   r.   r   r   r   Ú__bool__-   s    zConstraint.__bool__c                 C   sR   t |tƒstS | j|j@ }| j|jdd�@ }| j}|jrF| |jg¡}t|||ƒS r(   )	Ú
isinstancer   ÚNotImplementedr    r!   r"   r*   Úunionr   )r#   Úotherr    r!   r"   r   r   r   Ú__and__1   s    
zConstraint.__and__c                    s4   | j r"t‡ fdd„| j D ƒƒs"dS | jjˆ jdd�S )Nc                 3   s   | ]}t |ˆ ƒV  qd S r   )Ú_match_link)r   r*   ©Ú	candidater   r   r   ?   s     z-Constraint.is_satisfied_by.<locals>.<genexpr>FT)Úprereleases)r"   Úallr    ÚcontainsÚversion©r#   r8   r   r7   r   Úis_satisfied_by<   s    zConstraint.is_satisfied_byN)Ú__name__Ú
__module__Ú__qualname__r$   Úclassmethodr'   r,   r/   r0   r5   r>   r   r   r   r   r      s   

r   c                   @   s<   e Zd Zedd„ ƒZedd„ ƒZdd„ Zdd„ Zd	d
„ ZdS )ÚRequirementc                 C   s   t dƒ‚dS )zòThe "project name" of a requirement.

        This is different from ``name`` if this requirement contains extras,
        in which case ``name`` would contain the ``[...]`` part, while this
        refers to the name of the project.
        úSubclass should overrideN©ÚNotImplementedErrorr.   r   r   r   Úproject_nameH   s    	zRequirement.project_namec                 C   s   t dƒ‚dS )zÚThe name identifying this requirement in the resolver.

        This is different from ``project_name`` if this requirement contains
        extras, where ``project_name`` would not contain the ``[...]`` part.
        rD   NrE   r.   r   r   r   ÚnameS   s    zRequirement.namec                 C   s   dS ©NFr   r=   r   r   r   r>   ]   s    zRequirement.is_satisfied_byc                 C   s   t dƒ‚d S ©NrD   rE   r.   r   r   r   Úget_candidate_lookupa   s    z Requirement.get_candidate_lookupc                 C   s   t dƒ‚d S rJ   rE   r.   r   r   r   Úformat_for_errore   s    zRequirement.format_for_errorN)	r?   r@   rA   ÚpropertyrG   rH   r>   rK   rL   r   r   r   r   rC   G   s   


	rC   c                 C   s   |j rt| |j ƒS dS rI   )Úsource_linkr   )r*   r8   r   r   r   r6   j   s    r6   c                   @   sl   e Zd Zedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZed	d
„ ƒZedd„ ƒZ	dd„ Z
dd„ Zdd„ ZdS )r   c                 C   s   t dƒ‚dS )zðThe "project name" of the candidate.

        This is different from ``name`` if this candidate contains extras,
        in which case ``name`` would contain the ``[...]`` part, while this
        refers to the name of the project.
        úOverride in subclassNrE   r.   r   r   r   rG   r   s    	zCandidate.project_namec                 C   s   t dƒ‚dS )zÖThe name identifying this candidate in the resolver.

        This is different from ``project_name`` if this candidate contains
        extras, where ``project_name`` would not contain the ``[...]`` part.
        rO   NrE   r.   r   r   r   rH   }   s    zCandidate.namec                 C   s   t dƒ‚d S ©NrO   rE   r.   r   r   r   r<   ‡   s    zCandidate.versionc                 C   s   t dƒ‚d S rP   rE   r.   r   r   r   Úis_installedŒ   s    zCandidate.is_installedc                 C   s   t dƒ‚d S rP   rE   r.   r   r   r   Úis_editable‘   s    zCandidate.is_editablec                 C   s   t dƒ‚d S rP   rE   r.   r   r   r   rN   –   s    zCandidate.source_linkc                 C   s   t dƒ‚d S rP   rE   )r#   Úwith_requiresr   r   r   Úiter_dependencies›   s    zCandidate.iter_dependenciesc                 C   s   t dƒ‚d S rP   rE   r.   r   r   r   Úget_install_requirementŸ   s    z!Candidate.get_install_requirementc                 C   s   t dƒ‚d S rJ   rE   r.   r   r   r   rL   £   s    zCandidate.format_for_errorN)r?   r@   rA   rM   rG   rH   r<   rQ   rR   rN   rT   rU   rL   r   r   r   r   r   q   s   


	



N)Útypingr   r   r   r   r   Z pip._vendor.packaging.specifiersr   Úpip._vendor.packaging.utilsr   r	   Zpip._vendor.packaging.versionr
   r   Úpip._internal.models.linkr   r   Zpip._internal.req.req_installr   Úpip._internal.utils.hashesr   ÚCandidateLookupÚCandidateVersionr   r   rC   r6   r   r   r   r   r   Ú<module>   s   0#