o
    5e                     @   s   d dl mZ d dlmZmZ d dlmZ d dlmZ ddl	m
Z
mZmZmZ G dd deZG d	d
 d
eZG dd deZG dd deZG dd deZdS )    )SpecifierSet)NormalizedNamecanonicalize_name)install_req_drop_extras)InstallRequirement   )	CandidateCandidateLookupRequirementformat_namec                   @   s   e Zd ZdeddfddZdefddZdefdd	Zede	fd
dZ
edefddZdefddZdefddZdedefddZdS )ExplicitRequirement	candidatereturnNc                 C   
   || _ d S Nr   selfr    r   c/var/www/html/venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/requirements.py__init__      
zExplicitRequirement.__init__c                 C   s
   t | jS r   )strr   r   r   r   r   __str__   r   zExplicitRequirement.__str__c                 C   s   dj | jj| jdS )Nz{class_name}({candidate!r}))
class_namer   )format	__class____name__r   r   r   r   r   __repr__   s   zExplicitRequirement.__repr__c                 C      | j jS r   )r   project_namer   r   r   r   r!         z ExplicitRequirement.project_namec                 C   r    r   )r   namer   r   r   r   r#      r"   zExplicitRequirement.namec                 C   s
   | j  S r   )r   format_for_errorr   r   r   r   r$   !   r   z$ExplicitRequirement.format_for_errorc                 C   s
   | j d fS r   r   r   r   r   r   get_candidate_lookup$   r   z(ExplicitRequirement.get_candidate_lookupc                 C   s
   || j kS r   r   r   r   r   r   is_satisfied_by'   r   z#ExplicitRequirement.is_satisfied_by)r   
__module____qualname__r   r   r   r   r   propertyr   r!   r#   r$   r	   r%   boolr&   r   r   r   r   r   
   s    r   c                   @   s   e Zd ZdeddfddZdefddZdefdd	Zede	fd
dZ
edefddZdefddZdefddZdedefddZdS )SpecifierRequirementireqr   Nc                 C   s4   |j d u s	J d|| _tdd | jjD | _d S )NThis is a link, not a specifierc                 s       | ]}t |V  qd S r   r   .0er   r   r   	<genexpr>/       z0SpecifierRequirement.__init__.<locals>.<genexpr>)link_ireq	frozensetextras_extrasr   r,   r   r   r   r   ,   s   zSpecifierRequirement.__init__c                 C   s   t | jjS r   )r   r6   reqr   r   r   r   r   1      zSpecifierRequirement.__str__c                 C   s   dj | jjt| jjdS )Nz{class_name}({requirement!r}))r   requirement)r   r   r   r   r6   r;   r   r   r   r   r   4   s   
zSpecifierRequirement.__repr__c                 C   s   | j jsJ dt| j jjS )N'Specifier-backed ireq is always PEP 508)r6   r;   r   r#   r   r   r   r   r!   :   s   z!SpecifierRequirement.project_namec                 C   s   t | j| jS r   )r   r!   r9   r   r   r   r   r#   ?   s   zSpecifierRequirement.namec                 C   sZ   dd t | dD }t|dkrdS t|dkr|d S d|d d d	 |d  S )
Nc                 S   s   g | ]}|  qS r   )strip)r1   sr   r   r   
<listcomp>H   s    z9SpecifierRequirement.format_for_error.<locals>.<listcomp>,r    r   z, z and )r   splitlenjoin)r   partsr   r   r   r$   C   s   z%SpecifierRequirement.format_for_errorc                 C   s
   d | j fS r   )r6   r   r   r   r   r%   P   r   z)SpecifierRequirement.get_candidate_lookupr   c                 C   sN   |j | j ksJ d|j  d| j  | jjsJ d| jjj}|j|jddS )Nz6Internal issue: Candidate is not for this requirement z vs r>   Tprereleases)r#   r6   r;   	specifiercontainsversion)r   r   specr   r   r   r&   S   s   
z$SpecifierRequirement.is_satisfied_by)r   r'   r(   r   r   r   r   r   r)   r   r!   r#   r$   r	   r%   r   r*   r&   r   r   r   r   r+   +   s    r+   c                   @   s"   e Zd ZdZdeddfddZdS )!SpecifierWithoutExtrasRequirementz
    Requirement backed by an install requirement on a base package.
    Trims extras from its install requirement if there are any.
    r,   r   Nc                 C   s8   |j d u s	J dt|| _tdd | jjD | _d S )Nr-   c                 s   r.   r   r/   r0   r   r   r   r3   i   r4   z=SpecifierWithoutExtrasRequirement.__init__.<locals>.<genexpr>)r5   r   r6   r7   r8   r9   r:   r   r   r   r   f   s   
z*SpecifierWithoutExtrasRequirement.__init__)r   r'   r(   __doc__r   r   r   r   r   r   rO   `   s    rO   c                   @   s   e Zd ZdZdededdfddZdefdd	Zdefd
dZ	e
defddZe
defddZdefddZdefddZdedefddZdS )RequiresPythonRequirementz4A requirement representing Requires-Python metadata.rK   matchr   Nc                 C   s   || _ || _d S r   )rK   
_candidate)r   rK   rR   r   r   r   r   o   s   
z"RequiresPythonRequirement.__init__c                 C   s   d| j  S )NzPython )rK   r   r   r   r   r   s   r<   z!RequiresPythonRequirement.__str__c                 C      dj | jjt| jdS )Nz{class_name}({specifier!r}))r   rK   )r   r   r   r   rK   r   r   r   r   r   v      z"RequiresPythonRequirement.__repr__c                 C   r    r   )rS   r!   r   r   r   r   r!   |      z&RequiresPythonRequirement.project_namec                 C   r    r   )rS   r#   r   r   r   r   r#      rV   zRequiresPythonRequirement.namec                 C      t | S r   r   r   r   r   r   r$         z*RequiresPythonRequirement.format_for_errorc                 C   s"   | j j| jjddr| jd fS dS )NTrI   NN)rK   rL   rS   rM   r   r   r   r   r%      s   
z.RequiresPythonRequirement.get_candidate_lookupr   c                 C   s(   |j | jj ksJ d| jj|jddS )NzNot Python candidateTrI   )r#   rS   rK   rL   rM   r   r   r   r   r&      s   z)RequiresPythonRequirement.is_satisfied_by)r   r'   r(   rP   r   r   r   r   r   r   r)   r   r!   r#   r$   r	   r%   r*   r&   r   r   r   r   rQ   l   s    rQ   c                   @   s   e Zd ZdZdeddfddZdefddZdefd	d
Ze	defddZ
e	defddZdefddZdefddZdedefddZdS )UnsatisfiableRequirementz'A requirement that cannot be satisfied.r#   r   Nc                 C   r   r   _name)r   r#   r   r   r   r      r   z!UnsatisfiableRequirement.__init__c                 C   s   | j  dS )Nz (unavailable)r\   r   r   r   r   r      r<   z UnsatisfiableRequirement.__str__c                 C   rT   )Nz{class_name}({name!r}))r   r#   )r   r   r   r   r]   r   r   r   r   r      rU   z!UnsatisfiableRequirement.__repr__c                 C      | j S r   r\   r   r   r   r   r!         z%UnsatisfiableRequirement.project_namec                 C   r^   r   r\   r   r   r   r   r#      r_   zUnsatisfiableRequirement.namec                 C   rW   r   rX   r   r   r   r   r$      rY   z)UnsatisfiableRequirement.format_for_errorc                 C      dS )NrZ   r   r   r   r   r   r%         z-UnsatisfiableRequirement.get_candidate_lookupr   c                 C   r`   )NFr   r   r   r   r   r&      ra   z(UnsatisfiableRequirement.is_satisfied_by)r   r'   r(   rP   r   r   r   r   r   r)   r!   r#   r$   r	   r%   r   r*   r&   r   r   r   r   r[      s    r[   N) pip._vendor.packaging.specifiersr   pip._vendor.packaging.utilsr   r   pip._internal.req.constructorsr   pip._internal.req.req_installr   baser   r	   r
   r   r   r+   rO   rQ   r[   r   r   r   r   <module>   s    !5(