o
    ñ‘Oj*  ã                   @   sX   d dl 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¡ZG dd„ dƒZdS )é    N)ÚOrderedDict)ÚDictÚList)Úcanonicalize_name)ÚInstallRequirementc                   @   s°   e Zd Zddeddfdd„Zdefdd„Zdefd	d
„Zdeddfdd„Z	deddfdd„Z
dedefdd„Zdedefdd„Zedee fdd„ƒZedee fdd„ƒZdS )ÚRequirementSetTÚcheck_supported_wheelsÚreturnNc                 C   s   t ƒ | _|| _g | _dS )zCreate a RequirementSet.N)r   Úrequirementsr   Úunnamed_requirements)Úselfr   © r   ú_/var/www/html/pharmsmart-cdr-gen/venv/lib/python3.10/site-packages/pip/_internal/req/req_set.pyÚ__init__   s   
zRequirementSet.__init__c                 C   s4   t dd„ | j ¡ D ƒdd„ d�}d dd„ |D ƒ¡S )Nc                 s   s   � | ]}|j s|V  qd S ©N)Ú
comes_from©Ú.0Úreqr   r   r   Ú	<genexpr>   ó   € z)RequirementSet.__str__.<locals>.<genexpr>c                 S   ó   t | jpdƒS ©NÚ ©r   Úname©r   r   r   r   Ú<lambda>   ó    z(RequirementSet.__str__.<locals>.<lambda>©Úkeyú c                 s   ó   � | ]}t |jƒV  qd S r   ©Ústrr   r   r   r   r   r      r   )Úsortedr
   ÚvaluesÚjoin)r   r
   r   r   r   Ú__str__   s
   þzRequirementSet.__str__c                 C   sB   t | j ¡ dd„ d�}d}|j| jjt|ƒd dd„ |D ƒ¡d�S )	Nc                 S   r   r   r   r   r   r   r   r      r   z)RequirementSet.__repr__.<locals>.<lambda>r   z4<{classname} object; {count} requirement(s): {reqs}>z, c                 s   r"   r   r#   r   r   r   r   r   &   r   z*RequirementSet.__repr__.<locals>.<genexpr>)Ú	classnameÚcountÚreqs)r%   r
   r&   ÚformatÚ	__class__Ú__name__Úlenr'   )r   r
   Úformat_stringr   r   r   Ú__repr__   s   þýzRequirementSet.__repr__Úinstall_reqc                 C   s   |j rJ ‚| j |¡ d S r   )r   r   Úappend)r   r2   r   r   r   Úadd_unnamed_requirement)   s   
z&RequirementSet.add_unnamed_requirementc                 C   s"   |j sJ ‚t|j ƒ}|| j|< d S r   )r   r   r
   )r   r2   Úproject_namer   r   r   Úadd_named_requirement-   s   

z$RequirementSet.add_named_requirementr   c                 C   s    t |ƒ}|| jv o| j| j S r   )r   r
   Ú
constraint©r   r   r5   r   r   r   Úhas_requirement3   s   
þzRequirementSet.has_requirementc                 C   s*   t |ƒ}|| jv r| j| S td|›�ƒ‚)NzNo project with the name )r   r
   ÚKeyErrorr8   r   r   r   Úget_requirement;   s   

zRequirementSet.get_requirementc                 C   s   | j t| j ¡ ƒ S r   )r   Úlistr
   r&   ©r   r   r   r   Úall_requirementsC   s   zRequirementSet.all_requirementsc                 C   s   dd„ | j D ƒS )zâReturn the list of requirements that need to be installed.

        TODO remove this property together with the legacy resolver, since the new
             resolver only returns requirements that need to be installed.
        c                 S   s   g | ]
}|j s|js|‘qS r   )r7   Úsatisfied_by)r   r2   r   r   r   Ú
<listcomp>N   s    ýýÿz:RequirementSet.requirements_to_install.<locals>.<listcomp>)r>   r=   r   r   r   Úrequirements_to_installG   s   þz&RequirementSet.requirements_to_install)T)r.   Ú
__module__Ú__qualname__Úboolr   r$   r(   r1   r   r4   r6   r9   r;   Úpropertyr   r>   rA   r   r   r   r   r      s    r   )ÚloggingÚcollectionsr   Útypingr   r   Úpip._vendor.packaging.utilsr   Úpip._internal.req.req_installr   Ú	getLoggerr.   Úloggerr   r   r   r   r   Ú<module>   s    
