U
    ƒIÀd`  ã                   @   s|   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	 d dl
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)ÚLegacySpecifier)Úcanonicalize_name)ÚLegacyVersion)ÚInstallRequirement)Ú
deprecatedc                   @   s´   e Zd Zdeddœdd„Zedœdd„Zedœd	d
„Zeddœdd„Z	eddœdd„Z
eedœdd„Zeedœdd„Zeee dœdd„ƒZeee dœdd„ƒZddœdd„ZdS )ÚRequirementSetTN)Úcheck_supported_wheelsÚreturnc                 C   s   t ƒ | _|| _g | _dS )zCreate a RequirementSet.N)r   Úrequirementsr   Úunnamed_requirements)Úselfr   © r   úR/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/pip/_internal/req/req_set.pyÚ__init__   s    zRequirementSet.__init__)r   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>   s      z)RequirementSet.__str__.<locals>.<genexpr>c                 S   s   t | jp
dƒS ©NÚ ©r   Úname©r   r   r   r   Ú<lambda>   ó    z(RequirementSet.__str__.<locals>.<lambda>©Úkeyú c                 s   s   | ]}t |jƒV  qd S r   ©Ústrr   r   r   r   r   r      s     )Ú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   s   t | jp
dƒS r   r   r   r   r   r   r   "   r   z)RequirementSet.__repr__.<locals>.<lambda>r    z4<{classname} object; {count} requirement(s): {reqs}>z, c                 s   s   | ]}t |jƒV  qd S r   r#   r   r   r   r   r   )   s     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_reqr   c                 C   s   |j r
t‚| j |¡ d S r   )r   ÚAssertionErrorr   Úappend)r   r2   r   r   r   Úadd_unnamed_requirement,   s    
z&RequirementSet.add_unnamed_requirementc                 C   s"   |j s
t‚t|j ƒ}|| j|< d S r   )r   r3   r   r   )r   r2   Úproject_namer   r   r   Úadd_named_requirement0   s    

z$RequirementSet.add_named_requirement)r   r   c                 C   s    t |ƒ}|| jko| j| j S r   )r   r   Ú
constraint©r   r   r6   r   r   r   Úhas_requirement6   s    
þzRequirementSet.has_requirementc                 C   s.   t |ƒ}|| jkr| j| S td|›�ƒ‚d S )NzNo project with the name )r   r   ÚKeyErrorr9   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_requirementsF   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   )r8   Úsatisfied_by)r   r2   r   r   r   Ú
<listcomp>Q   s    þz:RequirementSet.requirements_to_install.<locals>.<listcomp>)r?   r>   r   r   r   Úrequirements_to_installJ   s    þz&RequirementSet.requirements_to_installc                 C   s’   | j D ]†}| ¡ j}t|tƒr<td|› d|› d�dddd� | ¡  ¡ D ]B}tdd	„ |jD ƒƒrHtd
|› d|› d|› d|› d�	dddd� qHqd S )Nz*pip has selected the non standard version z of zL. In the future this version will be ignored as it isn't standard compliant.zkset or update constraints to select another version or contact the package author to fix the version numberi/  z23.3)ÚreasonÚreplacementÚissueÚgone_inc                 s   s   | ]}t |tƒV  qd S r   )Ú
isinstancer   )r   Úspecr   r   r   r   i   s     zERequirementSet.warn_legacy_versions_and_specifiers.<locals>.<genexpr>zpip has selected r"   z- which has non standard dependency specifier z . In the future this version of z0 will be ignored as it isn't standard compliant.)	rB   Úget_distÚversionrG   r   r	   Úiter_dependenciesÚanyÚ	specifier)r   r   rJ   Údepr   r   r   Ú#warn_legacy_versions_and_specifiersW   s"    


õôz2RequirementSet.warn_legacy_versions_and_specifiers)T)r.   Ú
__module__Ú__qualname__Úboolr   r$   r(   r1   r   r5   r7   r:   r<   Úpropertyr   r?   rB   rO   r   r   r   r   r
      s   r
   )ÚloggingÚcollectionsr   Útypingr   r   Z pip._vendor.packaging.specifiersr   Zpip._vendor.packaging.utilsr   Zpip._vendor.packaging.versionr   Zpip._internal.req.req_installr   Úpip._internal.utils.deprecationr	   Ú	getLoggerr.   Úloggerr
   r   r   r   r   Ú<module>   s   
