o
    8j                     @  s   d dl mZ d dlmZ d dlmZ d dl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"ddZeddG dd dZG dd dZd#ddZG d d dZd!S )$    )annotations)Iterable)	dataclass)Optional)SpecifierSet)NormalizedName)Version)Linklinks_equivalent)InstallRequirement)Hashes	Candidateprojectr   extrasfrozenset[NormalizedName]returnstrc                 C  s&   |s| S d t|}|  d| dS )N,[])joinsorted)r   r   extras_expr r   /opt/pipey-apps/247c6e86-d9cc-49a2-98d3-9f311455f2db/.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/base.pyformat_name   s   r   T)frozenc                   @  sr   e Zd ZU ded< ded< ded< ded< edd
dZedddZd ddZd!ddZd"ddZ	d#ddZ
dS )$
Constraintr   	specifierr   hasheszdict[str, list[str]]hash_optionszfrozenset[Link]linksr   c                 C  s   t t t i t S N)r   r   r   	frozenset)clsr   r   r   empty    s   zConstraint.emptyireqr   c                 C  sD   |j r	t|j gnt }dd |j D }t|j|jdd||S )Nc                 S     i | ]	\}}|t |qS r   list.0algvr   r   r   
<dictcomp>'       z(Constraint.from_ireq.<locals>.<dictcomp>Ftrust_internet)linkr#   r    itemsr   r   r   )r$   r&   r!   r    r   r   r   	from_ireq$   s   
zConstraint.from_ireqboolc                 C  s   t | jpt | jpt | jS r"   )r5   r   r   r!   selfr   r   r   __bool__/   s   zConstraint.__bool__otherc                   s   t  tstS j j@ }j jdd@ }js$dd  j D }n  js2dd j D }n fddj  j @ D }j} j	rQ|
 j	g}t||||S )NFr0   c                 S  r'   r   r(   r*   r   r   r   r.   8   r/   z&Constraint.__and__.<locals>.<dictcomp>c                 S  r'   r   r(   r*   r   r   r   r.   :   r/   c                   s(   i | ]   fd dj   D qS )c                   s   g | ]}|j   v r|qS r   r    )r+   r-   )r,   r7   r   r   
<listcomp>=   s    z1Constraint.__and__.<locals>.<dictcomp>.<listcomp>r:   )r+   r9   r7   )r,   r   r.   <   s    )
isinstancer   NotImplementedr   r   r    r3   keysr!   r2   unionr   )r7   r9   r   r   r    r!   r   r<   r   __and__2   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+   r2   rB   r   r   	<genexpr>G   s    z-Constraint.is_satisfied_by.<locals>.<genexpr>FT)prereleases)r!   allr   containsversionr7   rB   r   rE   r   is_satisfied_byE   s   zConstraint.is_satisfied_byr   c                 C  s6   t | j}| jr|dddd | jD  d7 }|S )Nz (from z, c                 s  s    | ]}t |V  qd S r"   )r   rD   r   r   r   rF   Q   s    z.Constraint.format_for_error.<locals>.<genexpr>))r   r   r!   r   )r7   sr   r   r   format_for_errorN   s   
"zConstraint.format_for_errorN)r   r   )r&   r   r   r   r   r5   )r9   r   r   r   rB   r   r   r5   r   r   )__name__
__module____qualname____annotations__classmethodr%   r4   r8   rA   rL   rO   r   r   r   r   r      s   
 



	r   c                   @  sF   e Zd ZedddZedddZdddZdddZdddZdS )Requirementr   r   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NotImplementedErrorr6   r   r   r   project_nameV      zRequirement.project_namer   c                 C  rY   )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.
        rZ   r[   r6   r   r   r   name`      zRequirement.namerB   r   r5   c                 C  s   dS NFr   rK   r   r   r   rL   i   s   zRequirement.is_satisfied_byCandidateLookupc                 C  rY   NrZ   r[   r6   r   r   r   get_candidate_lookupl      z Requirement.get_candidate_lookupc                 C  rY   rc   r[   r6   r   r   r   rO   o   re   zRequirement.format_for_errorNr   r   rR   rQ   )r   rb   )	rS   rT   rU   propertyr]   r_   rL   rd   rO   r   r   r   r   rX   U   s    	

rX   r2   r	   rB   r5   c                 C  s   |j r	t| |j S dS ra   )source_linkr
   )r2   rB   r   r   r   rC   s   s   rC   c                   @  s~   e Zd ZedddZedddZedd	d
Zed ddZed ddZed!ddZ	d"ddZ
d#ddZdddZdS )$r   r   r   c                 C  rY   )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 subclassr[   r6   r   r   r   r]   z   r^   zCandidate.project_namer   c                 C  rY   )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.
        ri   r[   r6   r   r   r   r_      r`   zCandidate.namer   c                 C  rY   Nri   r[   r6   r   r   r   rJ         zCandidate.versionr5   c                 C  rY   rj   r[   r6   r   r   r   is_installed   rk   zCandidate.is_installedc                 C  rY   rj   r[   r6   r   r   r   is_editable   rk   zCandidate.is_editableLink | Nonec                 C  rY   rj   r[   r6   r   r   r   rh      rk   zCandidate.source_linkwith_requiresIterable[Requirement | None]c                 C  rY   rj   r[   )r7   ro   r   r   r   iter_dependencies   re   zCandidate.iter_dependenciesInstallRequirement | Nonec                 C  rY   rj   r[   r6   r   r   r   get_install_requirement   re   z!Candidate.get_install_requirementc                 C  rY   rc   r[   r6   r   r   r   rO      re   zCandidate.format_for_errorNrf   rR   )r   r   rP   )r   rn   )ro   r5   r   rp   )r   rr   )rS   rT   rU   rg   r]   r_   rJ   rl   rm   rh   rq   rs   rO   r   r   r   r   r   y   s     	

N)r   r   r   r   r   r   )r2   r	   rB   r   r   r5   )
__future__r   collections.abcr   dataclassesr   typingr    pip._vendor.packaging.specifiersr   pip._vendor.packaging.utilsr   pip._vendor.packaging.versionr   pip._internal.models.linkr	   r
   pip._internal.req.req_installr   pip._internal.utils.hashesr   tuplerb   r   r   rX   rC   r   r   r   r   r   <module>   s"    
;
