o
    
j6h                     @   s   d dl Z d dlmZ d dlmZmZmZ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IterableListOptionalTuple)canonicalize_name)InstallationError)Wheel)InstallRequirement)compatibility_tagsc                   @   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dedee deee  deee ee f 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dS )RequirementSetTcheck_supported_wheelsreturnNc                 C   s   t  | _|| _g | _dS )zCreate a RequirementSet.N)r   requirementsr   unnamed_requirements)selfr    r   h/var/www/html/chefvision.cloud.itp360.com/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   r8   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   r8   project_namer   r   r   add_named_requirement0   s   

z$RequirementSet.add_named_requirementparent_req_nameextras_requestedc           	      C   s  | |std|j|j g dfS |jr3|jjr3t|jj}t	
 }| jr3||s3td|j|jr>|du s>J d|jsK| | |gdfS z| |j}W n ty^   d}Y nw |du o||o||j o||j|jko||jo||jo||jj|jjk}|rtd|||j|s| | |g|fS |js|jsg |fS |jo|jo|jj|jjk }|rtd|jd|_|jrd|_ttt|jt|jB |_td	||j |g|fS )
a&  Add install_req as a requirement to install.

        :param parent_req_name: The name of the requirement that needed this
            added. The name is used because when multiple unnamed requirements
            resolve to the same name, we could otherwise end up with dependency
            links that point outside the Requirements set. parent_req must
            already be added. Note that None implies that this is a user
            supplied requirement, vs an inferred one.
        :param extras_requested: an iterable of extras used to evaluate the
            environment markers.
        :return: Additional requirements to scan. That is either [] if
            the requirement is not applicable, or [install_req] if the
            requirement is applicable and has just been added.
        z6Ignoring %s: markers '%s' don't match your environmentNz-{} is not a supported wheel on this platform.z+a user supplied req shouldn't have a parentz7Double requirement given: {} (already in {}, name={!r})zhCould not satisfy constraints for '{}': installation from path or url cannot be constrained to a versionFTzSetting %s extras to: %s)match_markersloggerinfor!   markerslinkis_wheelr
   filenamer   get_supportedr   	supportedr	   r2   user_suppliedr:   get_requirementKeyError
constraintextrasr   	specifierr<   pathtupler+   setdebug)	r   r8   r=   r>   wheeltagsexisting_reqhas_conflicting_requirementdoes_not_satisfy_constraintr   r   r   add_requirement6   s   




	


zRequirementSet.add_requirementr!   c                 C   s    t |}|| jv o| j| j S r   )r   r   rK   r   r!   r;   r   r   r   has_requirement   s   
zRequirementSet.has_requirementc                 C   s*   t |}|| jv r| j| S td|)NzNo project with the name )r   r   rJ   rX   r   r   r   rI      s   

zRequirementSet.get_requirementc                 C   s   | j t| j  S r   )r   listr   r,   )r   r   r   r   all_requirements   s   zRequirementSet.all_requirements)T)NN)r4   
__module____qualname__boolr   r*   r.   r7   r   r:   r<   r   r   r   r   rW   rY   rI   propertyr[   r   r   r   r   r      s*    	

ur   )loggingcollectionsr   typingr   r   r   r   r   pip._vendor.packaging.utilsr   pip._internal.exceptionsr	   pip._internal.models.wheelr
   pip._internal.req.req_installr   pip._internal.utilsr   	getLoggerr4   r@   r   r   r   r   r   <module>   s    
