
    !<i                        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
mZmZ  ee          Z G d d          Z G d d	e          ZddZ	 dddZddZdS )    )annotations)	getLogger)
Collection)InvalidRequirementRequirement)DistributionPackageNotFoundErrorversionc                  d    e Zd ZU dZdZded<   dZded<   dZded<   dZded<   	 	 	 	 ddd	Z	d
 Z
dS )DependencyConflicta  Represents a dependency conflict in OpenTelemetry instrumentation.

    This class is used to track conflicts between required dependencies and the
    actual installed packages. It supports two scenarios:

    1. Standard conflicts where all dependencies are required
    2. Either/or conflicts where only one of a set of dependencies is required

    Attributes:
        required: The required dependency specification that conflicts with what's installed.
        found: The actual dependency that was found installed (if any).
        required_any: Collection of dependency specifications where any one would satisfy
            the requirement (for either/or scenarios).
        found_any: Collection of actual dependencies found for either/or scenarios.
    N
str | NonerequiredfoundCollection[str]required_any	found_anyc                >    || _         || _        || _        || _        d S N)r   r   r   r   )selfr   r   r   r   s        /Users/kimhansen/Desktop/03 Workspace/ceo-agents/chl-effectiveness/mcp-servers/whoop/.venv/lib/python3.11/site-packages/opentelemetry/instrumentation/dependencies.py__init__zDependencyConflict.__init__6   s%     !
("    c                x    | j         s!| j        s| j        rd| j         d| j         dS d| j          d| j         dS )Nz5DependencyConflict: requested any of the following: "z" but found: ""z DependencyConflict: requested: ")r   r   r   r   r   s    r   __str__zDependencyConflict.__str__C   s_    } 	~$"3 	~t~ 	~}4K\}}lplz}}}}\$-\\tz\\\\r   )NNNN)r   r   r   r   r   r   r   r   )__name__
__module____qualname____doc__r   __annotations__r   r   r   r   r    r   r   r   r      s             HE$(L((((!%I%%%%  $ (,%)# # # # #] ] ] ] ]r   r   c                  (    e Zd ZU ded<   ddZd ZdS )DependencyConflictErrorr   conflictc                    || _         d S r   )r%   )r   r%   s     r   r   z DependencyConflictError.__init__L   s     r   c                *    t          | j                  S r   )strr%   r   s    r   r   zDependencyConflictError.__str__O   s    4=!!!r   N)r%   r   )r   r   r   r!   r   r   r"   r   r   r$   r$   I   sE             ! ! ! !" " " " "r   r$   distr   returnDependencyConflict | Nonec                ^   g }g }d}d}||i}d}||i}| j         r| j         D ]}}||vr||vr||vrt          |          }	|	j                            |          r|                    |	           |	j                            |          r|                    |	           ~t          ||          S )Nextrainstrumentszinstruments-any)requiresr   markerevaluateappendget_dependency_conflicts)
r)   instrumentation_depsinstrumentation_any_depsr-   r.   instruments_markerinstruments_anyinstruments_any_markerdepreqs
             r   get_dist_dependency_conflictsr;   S   s     !EK-'O#_5} 5= 
	5 
	5CC#%%/*D*Dc""Cz""#566 1$++C000z""#9:: 5(//444#6  r   NdepsCollection[str | Requirement]deps_any$Collection[str | Requirement] | Nonec                   | D ]}t          |t                    r|}nU	 t          |          }nD# t          $ r7}t                              d||           t          |          cY d }~c S d }~ww xY w	 t          |j                  }n!# t          $ r t          |          cY c S w xY w|j	        
                    |          st          ||j         d|           c S |rt          |          S d S )N<error parsing dependency, reporting as a conflict: "%s" - %s )
isinstancer   r   loggerwarningr   r
   namer	   	specifiercontains_get_dependency_conflicts_any)r<   r>   r9   r:   excdist_versions         r   r3   r3   n   sT     I Ic;'' 	/CC/!#&&% / / /R  
 *#........../	+"38,,LL# 	+ 	+ 	+%c*******	+ }%%l33 	I%cch+G+G+G+GHHHHH	I  7,X6664s,   .
A/*A*"A/*A/3BB&%B&c                v   | sd S d}g }g }| D ]}t          |t                    r|}nU	 t          |          }nD# t          $ r7}t                              d||           t          |          cY d }~c S d }~ww xY w	 t          |j                  }n2# t          $ r% |	                    t          |                     Y w xY w|j                            |          rd} nC|	                    t          |                     |	                    |j         d|            |rt          ||          S d S )NTrA   FrB   )r   r   )rC   r   r   rD   rE   r   r
   rF   r	   r2   r(   rG   rH   )r>   is_dependency_conflictr   r   r9   r:   rJ   rK   s           r   rI   rI      s     t!$&L!#I 7 7c;'' 	/CC/!#&&% / / /R  
 *#........../	"38,,LL# 	 	 	C)))H	 =!!,// 	%*"ECHH%%%CH55|556666 
!%
 
 
 	
 4s-   9
A:*A5-A:5A:>B,CC)r)   r   r*   r+   r   )r<   r=   r>   r?   r*   r+   )r>   r=   r*   r+   )
__future__r   loggingr   typingr   packaging.requirementsr   r   &opentelemetry.util._importlib_metadatar   r	   r
   r   rD   r   	Exceptionr$   r;   r3   rI   r"   r   r   <module>rT      sE   # " " " " "             B B B B B B B B          
8		'] '] '] '] '] '] '] ']T" " " " "i " " "   @          H) ) ) ) ) )r   