o
    cd                     @   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	ed
ee defddZG dd dZG dd dZdedddef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	Candidateprojectextrasreturnc                 C   s,   |s| S t dd |D }d| d|S )Nc                 s   s    | ]}t |V  qd S N)r	   ).0e r   U/opt/certbot/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/base.py	<genexpr>   s    zformat_name.<locals>.<genexpr>z{}[{}],)sortedformatjoin)r   r   canonical_extrasr   r   r   format_name   s   r   c                   @   s   e Zd Zdededee ddfddZeddd	Z	ed
e
dd fddZdefddZde
dd fddZdddefddZdS )
Constraint	specifierhasheslinksr   Nc                 C   s   || _ || _|| _d S r   )r!   r"   r#   )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.emptyireqc                 C   s.   |j r	t|j gnt }t|j|jdd|S NF)trust_internet)linkr&   r    r!   r"   )r'   r)   r#   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   __bool__'   s   zConstraint.__bool__otherc                 C   sR   t |tstS | j|j@ }| j|jdd@ }| j}|jr#||jg}t|||S r*   )	
isinstancer   NotImplementedr!   r"   r#   r,   unionr    )r$   r1   r!   r"   r#   r   r   r   __and__*   s   
zConstraint.__and__	candidater   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,   r6   r   r   r   6   s    z-Constraint.is_satisfied_by.<locals>.<genexpr>FT)prereleases)r#   allr!   containsversionr$   r6   r   r8   r   is_satisfied_by4   s   zConstraint.is_satisfied_by)r   r    )__name__
__module____qualname__r   r   r   r   r%   classmethodr(   r   r-   r.   r0   r5   r>   r   r   r   r   r       s"    

r    c                   @   s^   e Zd ZedefddZedefddZdddefdd	Z	de
fd
dZdefddZdS )Requirementr   c                 C      t d)zThe "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 overrideNotImplementedErrorr/   r   r   r   project_name?      zRequirement.project_namec                 C   rD   )zThe 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.
        rE   rF   r/   r   r   r   nameI      zRequirement.namer6   r   c                 C   s   dS NFr   r=   r   r   r   r>   R   s   zRequirement.is_satisfied_byc                 C   rD   NrE   rF   r/   r   r   r   get_candidate_lookupU      z Requirement.get_candidate_lookupc                 C   rD   rM   rF   r/   r   r   r   format_for_errorX   rO   zRequirement.format_for_errorN)r?   r@   rA   propertyr   rH   strrJ   r.   r>   CandidateLookuprN   rP   r   r   r   r   rC   >   s    	rC   r,   r6   c                 C   s   |j r	t| |j S dS rL   )source_linkr   )r,   r6   r   r   r   r7   \   s   r7   c                   @   s   e Zd ZedefddZedefddZedefddZ	ede
fdd	Zede
fd
dZedee fddZde
deee  fddZdee fddZdefddZdS )r   r   c                 C   rD   )zThe "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 subclassrF   r/   r   r   r   rH   c   rI   zCandidate.project_namec                 C   rD   )zThe 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.
        rU   rF   r/   r   r   r   rJ   m   rK   zCandidate.namec                 C   rD   NrU   rF   r/   r   r   r   r<   v      zCandidate.versionc                 C   rD   rV   rF   r/   r   r   r   is_installedz   rW   zCandidate.is_installedc                 C   rD   rV   rF   r/   r   r   r   is_editable~   rW   zCandidate.is_editablec                 C   rD   rV   rF   r/   r   r   r   rT      rW   zCandidate.source_linkwith_requiresc                 C   rD   rV   rF   )r$   rZ   r   r   r   iter_dependencies   rO   zCandidate.iter_dependenciesc                 C   rD   rV   rF   r/   r   r   r   get_install_requirement   rO   z!Candidate.get_install_requirementc                 C   rD   rM   rF   r/   r   r   r   rP      rO   zCandidate.format_for_errorN)r?   r@   rA   rQ   r   rH   rR   rJ   CandidateVersionr<   r.   rX   rY   r   r   rT   r   rC   r[   r   r\   rP   r   r   r   r   r   b   s     	N)typingr   r   r   r   r    pip._vendor.packaging.specifiersr   pip._vendor.packaging.utilsr   r	   pip._vendor.packaging.versionr
   r   pip._internal.models.linkr   r   pip._internal.req.req_installr   pip._internal.utils.hashesr   rS   r]   rR   r   r    rC   r.   r7   r   r   r   r   r   <module>   s    (