o
    iE                     @  s   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	 d dl
mZ ddlmZmZmZ eeZG d	d
 d
eeeef ZG dd deeeef ZdS )    )annotations)defaultdict)Mapping)	getLogger)Any)BaseReporter   )	Candidate
ConstraintRequirementc                   @  s"   e Zd ZddddZdddZdS )PipReporterNconstraintsMapping[str, Constraint] | NonereturnNonec                 C  s&   t t| _|pi | _dddd| _d S )Nzpip is looking at multiple versions of {package_name} to determine which version is compatible with other requirements. This could take a while.zpip is still looking at multiple versions of {package_name} to determine which version is compatible with other requirements. This could take a while.zThis is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.)r         )r   intreject_count_by_package_constraints_messages_at_reject_count)selfr    r   f/home/kim/smarthome/.venv/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/reporter.py__init__   s   

zPipReporter.__init__	criterionr   	candidater	   c                 C  s   | j |j  d7  < | j |j }|| jv r%| j| }td|j|jd d}|jD ]&}|j|j}}|d7 }|rF||j d|j	 d7 }n|d7 }||
 7 }q*| jrp|j}	| j|	}
|
rp|
jrp|	 |
j }|d	| 7 }t| d
S )zReport a candidate being rejected.

        Logs both the rejection count message (if applicable) and details about
        the requirements and constraints that caused the rejection.
        r   zINFO: %s)package_namez0Will try a different candidate, due to conflict:z
     z depends on zThe user requested z%
    The user requested (constraint) N)r   namer   loggerinfoformatinformationrequirementparentversionformat_for_errorr   get	specifierdebug)r   r   r   countmessagemsgZreq_inforeqr%   r   
constraintZconstraint_textr   r   r   rejecting_candidate'   s(   



zPipReporter.rejecting_candidate)N)r   r   r   r   r   r   r   r	   r   r   )__name__
__module____qualname__r   r0   r   r   r   r   r      s    r   c                   @  sV   e Zd ZdZdddZddd	Zd ddZd!ddZd"ddZd#ddZ	d$ddZ
dS )%PipDebuggingReporterz9A reporter that does an info log for every event it sees.r   r   c                 C  s   t d d S )NzReporter.starting()r    r!   )r   r   r   r   startingL   s   zPipDebuggingReporter.startingindexr   c                 C     t d| d S )NzReporter.starting_round(%r)r6   )r   r8   r   r   r   starting_roundO      z#PipDebuggingReporter.starting_roundstater   c                 C  s   t d| t d|| d S )Nz Reporter.ending_round(%r, state)zReporter.ending_round(%r, %r))r    r!   r*   )r   r8   r<   r   r   r   ending_roundR   s   z!PipDebuggingReporter.ending_roundc                 C  r9   )NzReporter.ending(%r)r6   )r   r<   r   r   r   endingV   r;   zPipDebuggingReporter.endingr$   r   r%   Candidate | Nonec                 C     t d|| d S )Nz#Reporter.adding_requirement(%r, %r)r6   )r   r$   r%   r   r   r   adding_requirementY   s   z'PipDebuggingReporter.adding_requirementr   r   r	   c                 C  r@   )Nz$Reporter.rejecting_candidate(%r, %r)r6   )r   r   r   r   r   r   r0   ^   s   z(PipDebuggingReporter.rejecting_candidatec                 C  r9   )NzReporter.pinning(%r)r6   )r   r   r   r   r   pinninga   r;   zPipDebuggingReporter.pinningN)r   r   )r8   r   r   r   )r8   r   r<   r   r   r   )r<   r   r   r   )r$   r   r%   r?   r   r   r1   )r   r	   r   r   )r2   r3   r4   __doc__r7   r:   r=   r>   rA   r0   rB   r   r   r   r   r5   I   s    





r5   N)
__future__r   collectionsr   collections.abcr   loggingr   typingr   Z pip._vendor.resolvelib.reportersr   baser	   r
   r   r2   r    strr   r5   r   r   r   r   <module>   s    :