
    Vi                        S SK Jr  S SKJr  S SKJr  S SKJrJr  S SK	J
r
JrJr  \" \5      r " S S5      r " S S	\5      r    SS
 jr S     SS jjr    SS jrg)    )annotations)	getLogger)
Collection)InvalidRequirementRequirement)DistributionPackageNotFoundErrorversionc                  |    \ rS rSr% SrSrS\S'   SrS\S'   SrS\S'   Sr	S\S	'       S       SS
 jjr
S rSrg)DependencyConflict   a  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                4    Xl         X l        X0l        X@l        g N)r   r   r   r   )selfr   r   r   r   s        }/home/james-whalen/.local/share/pipx/venvs/semgrep/lib/python3.13/site-packages/opentelemetry/instrumentation/dependencies.py__init__DependencyConflict.__init__6   s     !
("    c                    U R                   (       d?  U R                  (       d  U R                  (       a  SU R                   SU R                   S3$ SU R                    SU R                   S3$ )Nz5DependencyConflict: requested any of the following: "z" but found: ""z DependencyConflict: requested: ")r   r   r   r   r   s    r   __str__DependencyConflict.__str__C   s[    }}$"3"3t~~J4K\K\J]]klplzlzk{{|}}1$--tzzlZ[\\r   )r   r   r   r   )NNNN)r   r   r   r   r   r   r   r   )__name__
__module____qualname____firstlineno____doc__r   __annotations__r   r   r   r   r   __static_attributes__ r   r   r   r      sp       HjE:$(L/(!%I%  $ (,%)## # &	#
 ##]r   r   c                  0    \ rS rSr% S\S'   SS jrS rSrg)	DependencyConflictErrorI   r   conflictc                    Xl         g r   r+   )r   r+   s     r   r    DependencyConflictError.__init__L   s     r   c                ,    [        U R                  5      $ r   )strr+   r   s    r   r   DependencyConflictError.__str__O   s    4==!!r   r-   N)r+   r   )r    r!   r"   r#   r%   r   r   r&   r'   r   r   r)   r)   I   s      !"r   r)   c                   / n/ nSnSnX40nSnX60nU R                   (       a  U R                    H  nX8;  a  M
  XH;  a  Xh;  a  M  [        U5      n	U	R                  R                  U5      (       a  UR	                  U	5        U	R                  R                  U5      (       d  Mt  UR	                  U	5        M     [        X5      $ )Nextrainstrumentszinstruments-any)requiresr   markerevaluateappendget_dependency_conflicts)
distinstrumentation_depsinstrumentation_any_depsr3   r4   instruments_markerinstruments_anyinstruments_any_markerdepreqs
             r   get_dist_dependency_conflictsrB   S   s     !EK-'O#5}}==C%/*Dc"Czz""#566$++C0zz""#9::(//4 ! $ r   Nc                   U  Hy  n[        U[        5      (       a  UnO [        U5      n [        UR                  5      nUR                  R                  U5      (       a  M_  [        X#R                   SU 35      s  $    U(       a  [        U5      $ g ! [         a.  n[        R	                  SUU5        [        U5      s S nAs  $ S nAff = f! [         a    [        U5      s s  $ f = f)N<error parsing dependency, reporting as a conflict: "%s" - %s )
isinstancer   r   loggerwarningr   r
   namer	   	specifiercontains_get_dependency_conflicts_any)depsdeps_anyr@   rA   excdist_versions         r   r9   r9   n   s     c;''C/!#&	+"388,L }}%%l33%chhZq+GHH) . ,X66' & /R
 *#../ $ 	+%c**	+s.   BC
C!C>CCC('C(c                R   U (       d  g Sn/ n/ nU  H  n[        U[        5      (       a  UnO [        U5      n [        UR                  5      nUR                  R                  U5      (       a  Sn  O>UR                  [        U5      5        UR                  UR                   SU 35        M     U(       a
  [        UUS9$ g ! [         a.  n[        R	                  SUU5        [        U5      s S nAs  $ S nAff = f! [         a    UR                  [        U5      5         GM  f = f)NTrD   FrE   )r   r   )rF   r   r   rG   rH   r   r
   rI   r	   r8   r0   rJ   rK   )rN   is_dependency_conflictr   r   r@   rA   rO   rP   s           r   rL   rL      s    !$&L!#Ic;''C/!#&	"388,L
 ==!!,//%*"CH%CHH:Q|n565 8 !%
 	
 7 & /R
 *#../ $ 	C)	s.   CC=
C:!C5-C:5C:=$D&%D&)r:   r   returnDependencyConflict | Noner   )rM   Collection[str | Requirement]rN   z$Collection[str | Requirement] | NonerS   rT   )rN   rU   rS   rT   )
__future__r   loggingr   typingr   packaging.requirementsr   r   &opentelemetry.util._importlib_metadatar   r	   r
   r    rG   r   	Exceptionr)   rB   r9   rL   r'   r   r   <module>r\      s    #   B  
8	'] ']T"i "
@   	   H)+))r   