
    i                        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y)    )annotations)Iterable)	dataclass)Optional)SpecifierSet)NormalizedName)Version)Linklinks_equivalent)InstallRequirement)Hashes	Candidatec                N    |s| S dj                  t        |            }|  d| dS )N,[])joinsorted)projectextrasextras_exprs      [/root/searxng-venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/base.pyformat_namer      s/    ((6&>*KYa}A&&    T)frozenc                  z    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
y)
Constraintr   	specifierr   hasheszdict[str, list[str]]hash_optionszfrozenset[Link]linksc                N    t        t               t               i t                     S N)r   r   r   	frozenset)clss    r   emptyzConstraint.empty    s    ,.&(B	DDr   c                "   |j                   rt        |j                   g      n	t               }|j                  j                         D ci c]  \  }}|t	        |       }}}t        |j                  |j                  d      ||      S c c}}w NF)trust_internet)linkr$   r    itemslistr   r   r   )r%   ireqr!   algvr    s         r   	from_ireqzConstraint.from_ireq$   sx    *.))	499+&373D3D3J3J3LMaT!WMMNNKKuK-	
 	
 Ns   
Bc                    t        | j                        xs, t        | j                        xs t        | j                        S r#   )boolr   r   r!   selfs    r   __bool__zConstraint.__bool__/   s-    DNN#LtDKK'8LD<LLr   c                @   t        |t              st        S | j                  |j                  z  }| j                  |j	                  d      z  }| j
                  s7|j
                  j                         D ci c]  \  }}|t        |       }}}n|j
                  s7| j
                  j                         D ci c]  \  }}|t        |       }}}nr| j
                  j                         |j
                  j                         z  D ci c]2  }||j
                  |   D cg c]  }|| j
                  |   v s| c}4 }}}| j                  }|j                  r|j                  |j                  g      }t        ||||      S c c}}w c c}}w c c}w c c}}w r(   )
isinstancer   NotImplementedr   r   r    r+   r,   keysr!   r*   unionr   )r4   otherr   r   r.   r/   r    r!   s           r   __and__zConstraint.__and__2   sg   %!34!!NNU__4	u||5|AA  7<7I7I7O7O7QRVS!CaLRLR##7;7H7H7N7N7PQVS!CaLQLQ  ,,113e6H6H6M6M6OO !3!3C!8XAAARARSVAW<WaXXL  

::KK-E)V\5AA SQ Ys*   8F	;FF$F;F?FFc                    | j                   rt        fd| j                   D              sy| j                  j                  j                  d      S )Nc              3  6   K   | ]  }t        |        y wr#   )_match_link).0r*   	candidates     r   	<genexpr>z-Constraint.is_satisfied_by.<locals>.<genexpr>G   s     !V4+dI">!Vs   FT)prereleases)r!   allr   containsversionr4   rA   s    `r   is_satisfied_byzConstraint.is_satisfied_byE   s@    ::c!V4::!VV ~~&&y'8'8d&KKr   c                    t        | j                        }| j                  r)|ddj                  d | j                  D               dz  }|S )Nz (from z, c              3  2   K   | ]  }t        |        y wr#   )str)r@   r*   s     r   rB   z.Constraint.format_for_error.<locals>.<genexpr>Q   s     $F4SY$Fs   ))rK   r   r!   r   )r4   ss     r   format_for_errorzConstraint.format_for_errorN   sC    ::7499$F4::$FFGqIIAr   N)returnr   )r-   r   rO   r   rO   r2   )r;   r   rO   r   rA   r   rO   r2   rO   rK   )__name__
__module____qualname____annotations__classmethodr&   r0   r5   r<   rH   rN    r   r   r   r      sX    N&&E E 
 
MB&Lr   r   c                  H    e Zd Zedd       Zedd       Zd	dZd
dZddZy)Requirementc                    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NotImplementedErrorr3   s    r   project_namezRequirement.project_nameV   s     ""<==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.
        r\   r]   r3   s    r   namezRequirement.name`   s     ""<==r   c                     yNFrX   rG   s     r   rH   zRequirement.is_satisfied_byi   s    r   c                    t        d      Nr\   r]   r3   s    r   get_candidate_lookupz Requirement.get_candidate_lookupl       !"<==r   c                    t        d      re   r]   r3   s    r   rN   zRequirement.format_for_erroro   rg   r   NrO   r   rR   rQ   )rO   CandidateLookup)	rS   rT   rU   propertyr_   ra   rH   rf   rN   rX   r   r   rZ   rZ   U   s7    > > > >>>r   rZ   c                H    |j                   rt        | |j                         S yrc   )source_linkr   )r*   rA   s     r   r?   r?   s   s!    i&;&;<<r   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y
)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 subclassr]   r3   s    r   r_   zCandidate.project_namez   s     ""899r   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.
        rp   r]   r3   s    r   ra   zCandidate.name   s     ""899r   c                    t        d      Nrp   r]   r3   s    r   rF   zCandidate.version       !"899r   c                    t        d      rs   r]   r3   s    r   is_installedzCandidate.is_installed   rt   r   c                    t        d      rs   r]   r3   s    r   is_editablezCandidate.is_editable   rt   r   c                    t        d      rs   r]   r3   s    r   rm   zCandidate.source_link   rt   r   c                    t        d      rs   r]   )r4   with_requiress     r   iter_dependencieszCandidate.iter_dependencies       !"899r   c                    t        d      rs   r]   r3   s    r   get_install_requirementz!Candidate.get_install_requirement   r}   r   c                    t        d      re   r]   r3   s    r   rN   zCandidate.format_for_error   rg   r   Nri   rR   )rO   r	   rP   )rO   zLink | None)r{   r2   rO   zIterable[Requirement | None])rO   zInstallRequirement | None)rS   rT   rU   rk   r_   ra   rF   rv   rx   rm   r|   r   rN   rX   r   r   r   r   y   s    : : : : : : : : : : : :::>r   N)r   r   r   zfrozenset[NormalizedName]rO   rK   )r*   r
   rA   r   rO   r2   )
__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   tuplerj   r   r   rZ   r?   r   rX   r   r   <module>r      sz    " $ !  9 6 1 < < --x8J/KKL' $8 8 8v> ><+> +>r   