
    yj                    0   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Z ed           G d d                      Z G d d          Zd!dZ G d d          ZdS )"    )annotations)Iterable)	dataclass)Optional)SpecifierSet)NormalizedName)Version)Linklinks_equivalent)InstallRequirement)Hashes	Candidateprojectr   extrasfrozenset[NormalizedName]returnstrc                ^    |s| S d                     t          |                    }|  d| dS )N,[])joinsorted)r   r   extras_exprs      i/usr/local/lib/hermes-agent/venv/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/base.pyformat_namer      s=     ((6&>>**K&&&&&&    T)frozenc                      e Zd ZU ded<   ded<   ded<   ded<   edd
            Zedd            ZddZddZddZ	ddZ
dS )
Constraintr   	specifierr   hasheszdict[str, list[str]]hash_optionszfrozenset[Link]linksr   c                n    t          t                      t                      i t                                S N)r    r   r   	frozenset)clss    r   emptyzConstraint.empty    s"    ,..&((B	DDDr   ireqr   c                    |j         rt          |j         g          nt                      }d |j                                        D             }t	          |j        |                    d          ||          S )Nc                4    i | ]\  }}|t          |          S  list.0algvs      r   
<dictcomp>z(Constraint.from_ireq.<locals>.<dictcomp>'   s$    MMMaT!WWMMMr   Ftrust_internet)linkr'   r#   itemsr    r!   r"   )r(   r*   r$   r#   s       r   	from_ireqzConstraint.from_ireq$   ss    *.)D	49+&&&MM43D3J3J3L3LMMMNKKuK--	
 
 	
r   boolc                z    t          | j                  p't          | j                  pt          | j                  S r&   )r:   r!   r"   r$   selfs    r   __bool__zConstraint.__bool__/   s0    DN##LtDK'8'8LD<L<LLr   otherc                :    t          t                    st          S  j        j        z  } j                            d          z  } j        s$d j                                        D             }nkj        s$d  j                                        D             }n@ fd j                                        j                                        z  D             } j        }j	        r|
                    j	        g          }t          ||||          S )NFr5   c                4    i | ]\  }}|t          |          S r-   r.   r0   s      r   r4   z&Constraint.__and__.<locals>.<dictcomp>8   s$    RRRVS!CaRRRr   c                4    i | ]\  }}|t          |          S r-   r.   r0   s      r   r4   z&Constraint.__and__.<locals>.<dictcomp>:   s$    QQQVS!CaQQQr   c                H    i | ]fd j                  D             S )c                2    g | ]}|j                  v |S r-   r#   )r1   r3   r2   r=   s     r   
<listcomp>z1Constraint.__and__.<locals>.<dictcomp>.<listcomp>=   s,    XXXAAARSVAW<W<Wa<W<W<Wr   rE   )r1   r2   r?   r=   s    @r   r4   z&Constraint.__and__.<locals>.<dictcomp><   sL        XXXXX!3C!8XXX  r   )
isinstancer   NotImplementedr!   r"   r#   r8   keysr$   r7   unionr    )r=   r?   r!   r"   r#   r$   s   ``    r   __and__zConstraint.__and__2   s/   %!344 	"!!NU_4	u||5|AAA  	RRu7I7O7O7Q7QRRRLL# 	QQt7H7N7N7P7PQQQLL    ,1133e6H6M6M6O6OO  L 
: 	.KK--E)V\5AAAr   	candidater   c                    | j         r"t          fd| j         D                       sdS | j                            j        d          S )Nc              3  8   K   | ]}t          |          V  d S r&   )_match_link)r1   r7   rL   s     r   	<genexpr>z-Constraint.is_satisfied_by.<locals>.<genexpr>G   s-      !V!V4+dI">">!V!V!V!V!V!Vr   FT)prereleases)r$   allr!   containsversionr=   rL   s    `r   is_satisfied_byzConstraint.is_satisfied_byE   sX    : 	c!V!V!V!V4:!V!V!VVV 	5 ~&&y'8d&KKKr   r   c                    t          | j                  }| j        r+|dd                    d | j        D                        dz  }|S )Nz (from z, c              3  4   K   | ]}t          |          V  d S r&   )r   )r1   r7   s     r   rP   z.Constraint.format_for_error.<locals>.<genexpr>Q   s(      $F$F4SYY$F$F$F$F$F$Fr   ))r   r!   r$   r   )r=   ss     r   format_for_errorzConstraint.format_for_errorN   sT    : 	JI499$F$F4:$F$F$FFFIIIIAr   N)r   r    )r*   r   r   r    r   r:   )r?   r   r   r    rL   r   r   r:   r   r   )__name__
__module____qualname____annotations__classmethodr)   r9   r>   rK   rV   r[   r-   r   r   r    r       s         NNN&&&&E E E [E 
 
 
 [
M M M MB B B B&L L L L     r   r    c                  V    e Zd Zedd            Zedd            Zdd	ZddZddZdS )Requirementr   r   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<   s    r   project_namezRequirement.project_nameV   s     ""<===r   r   c                     t          d          )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.
        rg   rh   r<   s    r   namezRequirement.name`   s     ""<===r   rL   r   r:   c                    dS NFr-   rU   s     r   rV   zRequirement.is_satisfied_byi   s    ur   CandidateLookupc                     t          d          Nrg   rh   r<   s    r   get_candidate_lookupz Requirement.get_candidate_lookupl       !"<===r   c                     t          d          rq   rh   r<   s    r   r[   zRequirement.format_for_erroro   rs   r   Nr   r   r^   r]   )r   ro   )	r_   r`   ra   propertyrj   rl   rV   rr   r[   r-   r   r   re   re   U   s        > > > X> > > > X>   > > > >> > > > > >r   re   r7   r
   rL   r:   c                >    |j         rt          | |j                   S dS rn   )source_linkr   )r7   rL   s     r   rO   rO   s   s%     =i&;<<<5r   c                      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   r   r   c                     t          d          )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 subclassrh   r<   s    r   rj   zCandidate.project_namez   s     ""8999r   r   c                     t          d          )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.
        r{   rh   r<   s    r   rl   zCandidate.name   s     ""8999r   r	   c                     t          d          Nr{   rh   r<   s    r   rT   zCandidate.version       !"8999r   r:   c                     t          d          r~   rh   r<   s    r   is_installedzCandidate.is_installed   r   r   c                     t          d          r~   rh   r<   s    r   is_editablezCandidate.is_editable   r   r   Link | Nonec                     t          d          r~   rh   r<   s    r   rx   zCandidate.source_link   r   r   with_requiresIterable[Requirement | None]c                     t          d          r~   rh   )r=   r   s     r   iter_dependencieszCandidate.iter_dependencies       !"8999r   InstallRequirement | Nonec                     t          d          r~   rh   r<   s    r   get_install_requirementz!Candidate.get_install_requirement   r   r   c                     t          d          rq   rh   r<   s    r   r[   zCandidate.format_for_error   rs   r   Nru   r^   )r   r	   r\   )r   r   )r   r:   r   r   )r   r   )r_   r`   ra   rv   rj   rl   rT   r   r   rx   r   r   r[   r-   r   r   r   r   y   s       : : : X: : : : X: : : : X: : : : X: : : : X: : : : X:: : : :: : : :> > > > > >r   N)r   r   r   r   r   r   )r7   r
   rL   r   r   r:   )
__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   tuplero   r   r    re   rO   r   r-   r   r   <module>r      s   " " " " " " $ $ $ $ $ $ ! ! ! ! ! !       9 9 9 9 9 9 6 6 6 6 6 6 1 1 1 1 1 1 < < < < < < < < < < < < < < - - - - - --x8J/KKL' ' ' ' $8 8 8 8 8 8 8 8v> > > > > > > ><   +> +> +> +> +> +> +> +> +> +>r   