a
    sh                     @  s   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 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 )    )annotations)Any)SpecifierSet)NormalizedNamecanonicalize_name)install_req_drop_extras)InstallRequirement   )	CandidateCandidateLookupRequirementformat_namec                   @  s   e Zd ZdddddZdddd	Zddd
dZddddZdddddZeddddZ	eddddZ
ddddZddddZdddddZd S )!ExplicitRequirementr
   None	candidatereturnc                 C  s
   || _ d S Nr   selfr    r   l/var/www/html/assistant/venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/requirements.py__init__   s    zExplicitRequirement.__init__strr   c                 C  s
   t | jS r   )r   r   r   r   r   r   __str__   s    zExplicitRequirement.__str__c                 C  s   | j j d| jdS N())	__class____name__r   r   r   r   r   __repr__   s    zExplicitRequirement.__repr__intc                 C  s
   t | jS r   )hashr   r   r   r   r   __hash__   s    zExplicitRequirement.__hash__r   boolotherr   c                 C  s   t |tsdS | j|jkS NF)
isinstancer   r   r   r)   r   r   r   __eq__   s    
zExplicitRequirement.__eq__r   c                 C  s   | j jS r   )r   project_namer   r   r   r   r.       s    z ExplicitRequirement.project_namec                 C  s   | j jS r   )r   namer   r   r   r   r/   %   s    zExplicitRequirement.namec                 C  s
   | j  S r   )r   format_for_errorr   r   r   r   r0   *   s    z$ExplicitRequirement.format_for_errorr   c                 C  s
   | j d fS r   r   r   r   r   r   get_candidate_lookup-   s    z(ExplicitRequirement.get_candidate_lookupc                 C  s
   || j kS r   r   r   r   r   r   is_satisfied_by0   s    z#ExplicitRequirement.is_satisfied_byN)r"   
__module____qualname__r   r   r#   r&   r-   propertyr.   r/   r0   r1   r2   r   r   r   r   r      s   r   c                   @  s   e Zd ZdddddZedddd	Zddd
dZddddZdddddZddddZ	eddddZ
eddddZddddZddddZd dd!d"d#Zd$S )%SpecifierRequirementr   r   ireqr   c                 C  s@   |j d u sJ d|| _d | _d | _tdd | jjD | _d S )NThis is a link, not a specifierc                 s  s   | ]}t |V  qd S r   r   .0er   r   r   	<genexpr>:       z0SpecifierRequirement.__init__.<locals>.<genexpr>)link_ireq_equal_cache_hash	frozensetextras_extrasr   r8   r   r   r   r   5   s
    zSpecifierRequirement.__init__r   r   c                 C  s"   | j d ur| j S t| j| _ | j S r   rB   r   rA   r   r   r   r   _equal<   s    
zSpecifierRequirement._equalc                 C  s   t | jjS r   )r   rA   reqr   r   r   r   r   D   s    zSpecifierRequirement.__str__c                 C  s   | j j dt| jjdS r   )r!   r"   r   rA   rJ   r   r   r   r   r#   G   s    zSpecifierRequirement.__repr__objectr'   r(   c                 C  s   t |tstS | j|jkS r   )r+   r6   NotImplementedrI   r,   r   r   r   r-   J   s    
zSpecifierRequirement.__eq__r$   c                 C  s"   | j d ur| j S t| j| _ | j S r   rC   r%   rI   r   r   r   r   r&   O   s    
zSpecifierRequirement.__hash__r   c                 C  s   | j jsJ dt| j jjS )N'Specifier-backed ireq is always PEP 508)rA   rJ   r   r/   r   r   r   r   r.   V   s    z!SpecifierRequirement.project_namec                 C  s   t | j| jS r   )r   r.   rF   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)r<   sr   r   r   
<listcomp>d   r?   z9SpecifierRequirement.format_for_error.<locals>.<listcomp>,r    r	   z, z and )r   splitlenjoin)r   partsr   r   r   r0   _   s    z%SpecifierRequirement.format_for_errorr   c                 C  s
   d | j fS r   )rA   r   r   r   r   r1   l   s    z)SpecifierRequirement.get_candidate_lookupr
   r   c                 C  sN   |j | j ks$J d|j  d| j  | jjs4J d| jjj}|j|jddS )Nz6Internal issue: Candidate is not for this requirement z vs rN   Tprereleases)r/   rA   rJ   	specifiercontainsversion)r   r   specr   r   r   r2   o   s    
z$SpecifierRequirement.is_satisfied_byN)r"   r3   r4   r   r5   rI   r   r#   r-   r&   r.   r/   r0   r1   r2   r   r   r   r   r6   4   s   r6   c                   @  sP   e Zd ZdZdddddZeddd	d
ZdddddZdd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   r7   c                 C  sD   |j d u sJ dt|| _d | _d | _tdd | jjD | _d S )Nr9   c                 s  s   | ]}t |V  qd S r   r:   r;   r   r   r   r>      r?   z=SpecifierWithoutExtrasRequirement.__init__.<locals>.<genexpr>)r@   r   rA   rB   rC   rD   rE   rF   rG   r   r   r   r      s
    
z*SpecifierWithoutExtrasRequirement.__init__r   r   c                 C  s"   | j d ur| j S t| j| _ | j S r   rH   r   r   r   r   rI      s    
z(SpecifierWithoutExtrasRequirement._equalrK   r'   r(   c                 C  s   t |tstS | j|jkS r   )r+   r_   rL   rI   r,   r   r   r   r-      s    
z(SpecifierWithoutExtrasRequirement.__eq__r$   c                 C  s"   | j d ur| j S t| j| _ | j S r   rM   r   r   r   r   r&      s    
z*SpecifierWithoutExtrasRequirement.__hash__N)	r"   r3   r4   __doc__r   r5   rI   r-   r&   r   r   r   r   r_   |   s   r_   c                   @  s   e Zd ZdZddddddZdd	d
dZdd	ddZdd	ddZdddddZe	dd	ddZ
e	dd	ddZdd	ddZdd	ddZddd d!d"Zd#S )$RequiresPythonRequirementz4A requirement representing Requires-Python metadata.r   r
   r   )r[   matchr   c                 C  s    || _ t|| _d | _|| _d S r   )r[   r   _specifier_stringrC   
_candidate)r   r[   rb   r   r   r   r      s    
z"RequiresPythonRequirement.__init__r   r   c                 C  s   d| j  S )NzPython )r[   r   r   r   r   r      s    z!RequiresPythonRequirement.__str__c                 C  s   | j j dt| jdS r   )r!   r"   r   r[   r   r   r   r   r#      s    z"RequiresPythonRequirement.__repr__r$   c                 C  s(   | j d ur| j S t| j| jf| _ | j S r   )rC   r%   rc   rd   r   r   r   r   r&      s    
z"RequiresPythonRequirement.__hash__r   r'   r(   c                 C  s&   t |tsdS | j|jko$| j|jkS r*   )r+   ra   rc   rd   r,   r   r   r   r-      s
    

z RequiresPythonRequirement.__eq__r   c                 C  s   | j jS r   )rd   r.   r   r   r   r   r.      s    z&RequiresPythonRequirement.project_namec                 C  s   | j jS r   )rd   r/   r   r   r   r   r/      s    zRequiresPythonRequirement.namec                 C  s   t | S r   r   r   r   r   r   r0      s    z*RequiresPythonRequirement.format_for_errorr   c                 C  s"   | j j| jjddr| jd fS dS )NTrY   NN)r[   r\   rd   r]   r   r   r   r   r1      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 candidateTrY   )r/   rd   r[   r\   r]   r   r   r   r   r2      s    z)RequiresPythonRequirement.is_satisfied_byN)r"   r3   r4   r`   r   r   r#   r&   r-   r5   r.   r/   r0   r1   r2   r   r   r   r   ra      s   ra   c                   @  s   e Zd ZdZdddddZddd	d
ZddddZdddddZddddZe	ddddZ
e	ddddZddddZddddZdddd d!Zd"S )#UnsatisfiableRequirementz'A requirement that cannot be satisfied.r   r   )r/   r   c                 C  s
   || _ d S r   _name)r   r/   r   r   r   r      s    z!UnsatisfiableRequirement.__init__r   r   c                 C  s   | j  dS )Nz (unavailable)rh   r   r   r   r   r      s    z UnsatisfiableRequirement.__str__c                 C  s   | j j dt| jdS r   )r!   r"   r   ri   r   r   r   r   r#      s    z!UnsatisfiableRequirement.__repr__rK   r'   r(   c                 C  s   t |tstS | j|jkS r   )r+   rg   rL   ri   r,   r   r   r   r-      s    
zUnsatisfiableRequirement.__eq__r$   c                 C  s
   t | jS r   )r%   ri   r   r   r   r   r&      s    z!UnsatisfiableRequirement.__hash__c                 C  s   | j S r   rh   r   r   r   r   r.      s    z%UnsatisfiableRequirement.project_namec                 C  s   | j S r   rh   r   r   r   r   r/      s    zUnsatisfiableRequirement.namec                 C  s   t | S r   re   r   r   r   r   r0      s    z)UnsatisfiableRequirement.format_for_errorr   c                 C  s   dS )Nrf   r   r   r   r   r   r1      s    z-UnsatisfiableRequirement.get_candidate_lookupr
   r   c                 C  s   dS r*   r   r   r   r   r   r2      s    z(UnsatisfiableRequirement.is_satisfied_byN)r"   r3   r4   r`   r   r   r#   r-   r&   r5   r.   r/   r0   r1   r2   r   r   r   r   rg      s   rg   N)
__future__r   typingr   Z pip._vendor.packaging.specifiersr   pip._vendor.packaging.utilsr   r   pip._internal.req.constructorsr   Zpip._internal.req.req_installr   baser
   r   r   r   r   r6   r_   ra   rg   r   r   r   r   <module>   s   &H"6