o
    Zh                     @   s   d dl mZ d dlmZmZmZmZ 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 eed	 ee f Zd
e
dee
 defddZedd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 )    )	dataclass)	FrozenSetIterableOptionalTuple)SpecifierSet)NormalizedName)Version)Linklinks_equivalent)InstallRequirement)Hashes	Candidateprojectextrasreturnc                 C   s&   |s| S d t|}|  d| dS )N,[])joinsorted)r   r   Zextras_expr r   _/var/www/html/lang_env/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/base.pyformat_name   s   r   T)frozenc                   @   s   e Zd ZU eed< eed< ee ed< 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   c                 C   s   t t t t S N)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   selfr   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*   r,   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).0r&   r1   r   r   	<genexpr>4   s    z-Constraint.is_satisfied_by.<locals>.<genexpr>FT)prereleases)r   allr   containsversionr*   r1   r   r4   r   is_satisfied_by2   s   zConstraint.is_satisfied_byN)r   r   )__name__
__module____qualname__r   __annotations__r   r   r
   classmethodr"   r   r'   r(   r+   r0   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   rB   )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.
        rC   rD   r)   r   r   r   nameG      zRequirement.namer1   r   c                 C   s   dS NFr   r:   r   r   r   r;   P   s   zRequirement.is_satisfied_byc                 C   rB   NrC   rD   r)   r   r   r   get_candidate_lookupS      z Requirement.get_candidate_lookupc                 C   rB   rK   rD   r)   r   r   r   format_for_errorV   rM   zRequirement.format_for_errorN)r<   r=   r>   propertyr   rF   strrH   r(   r;   CandidateLookuprL   rN   r   r   r   r   rA   <   s    	rA   r&   r1   c                 C   s   |j r	t| |j S dS rJ   )source_linkr   )r&   r1   r   r   r   r2   Z   s   r2   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   rB   )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 subclassrD   r)   r   r   r   rF   a   rG   zCandidate.project_namec                 C   rB   )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.
        rS   rD   r)   r   r   r   rH   k   rI   zCandidate.namec                 C   rB   NrS   rD   r)   r   r   r   r9   t      zCandidate.versionc                 C   rB   rT   rD   r)   r   r   r   is_installedx   rU   zCandidate.is_installedc                 C   rB   rT   rD   r)   r   r   r   is_editable|   rU   zCandidate.is_editablec                 C   rB   rT   rD   r)   r   r   r   rR      rU   zCandidate.source_linkwith_requiresc                 C   rB   rT   rD   )r*   rX   r   r   r   iter_dependencies   rM   zCandidate.iter_dependenciesc                 C   rB   rT   rD   r)   r   r   r   get_install_requirement   rM   z!Candidate.get_install_requirementc                 C   rB   rK   rD   r)   r   r   r   rN      rM   zCandidate.format_for_errorN)r<   r=   r>   rO   r   rF   rP   rH   r	   r9   r(   rV   rW   r   r
   rR   r   rA   rY   r   rZ   rN   r   r   r   r   r   `   s     	N)dataclassesr   typingr   r   r   r   Z pip._vendor.packaging.specifiersr   Zpip._vendor.packaging.utilsr   Zpip._vendor.packaging.versionr	   pip._internal.models.linkr
   r   Zpip._internal.req.req_installr   pip._internal.utils.hashesr   rQ   rP   r   r   rA   r(   r2   r   r   r   r   r   <module>   s    %