
    iB                         % S SK r S SKJr  S SKJrJr  SSKJrJrJ	r	  SSK
Jr  SSKJr  \" S\" 5       /\" 5       /S	S
9r\\S'   \	" \5      r\	\S'   SS\S\4S jjr " S S\5      rg)    N)ABC)AnyList   )DISPATCHER_SPAN_DECORATED_ATTR
DispatcherManager)NullEventHandler)NullSpanHandlerrootF)nameevent_handlersspan_handlers	propagateroot_dispatcherroot_managerr   returnc                 2   U [         R                  ;   a  [         R                  U    $ SR                  U R                  S5      SS 5      nU[         R                  ;   a  UnOSn[	        U [
        R                  U[         S9n[         R                  U5        U$ )z@Module method that should be used for creating a new Dispatcher..Nr   )r   	root_nameparent_namemanager)r   dispatchersjoinsplitr   r   r   add_dispatcher)r   candidate_parent_namer   new_dispatchers       ^/home/james-whalen/.local/lib/python3.13/site-packages/llama_index_instrumentation/__init__.pyget_dispatcherr!      s    |'''''--HHTZZ_Sb%9: 8 88+!&&	N /    c                   8   ^  \ rS rSrSrS\SS4U 4S jjrSrU =r$ )DispatcherSpanMixin,   a  
Apply the `dispatcher.span` decorator to implementations of abstract methods, as well
as any methods previously decorated (in any base class) that are being overridden by
a subclass. For example, if class `A` has abstract method `f`, and class `B` inherits
from `A` and provides an implementation of `f`, then `B.f` will be decorated by the mixin.
Furthermore, if `B` has a non-abstract method `g` that is decorated by `dispatcher.span`
and new class `C` inherits from `B` and overrides `g`, then `C.g` will also be decorated
by the mixin. Note that users can still manually apply `dispatcher.span` to the methods
in their custom subclasses without creating duplicate spans because the `dispatcher.span`
decorator should be idempotent.
kwargsr   Nc                   > [         TU ]  " S0 UD6  / n/ n[        R                  " U 5       H  nX@L a  M	  UR                  R                  5        Ht  u  pV[        U5      (       d  M  [        US5      (       a$  UR                  (       a  UR                  U5        ML  [        U[        5      (       d  Mc  UR                  U5        Mv     M     [        U R                  5      nU R                  R                  5        H`  u  pV[        U5      (       a"  [        US5      (       a  UR                  (       a  M9  XR;   d  XS;   d  ME  [        XUR                  U5      5        Mb     g )N__isabstractmethod__ )super__init_subclass__inspectgetmro__dict__itemscallablehasattrr(   appendr   r!   
__module__setattrspan)	clsr&   abstract_methodsdecorated_methodsbase_clsattrmethod
dispatcher	__class__s	           r    r+   %DispatcherSpanMixin.__init_subclass__9   s   !+F+&(')s+H ( 1 1 7 7 9''F$:;;33$++D1V%CDD%,,T2 !: , $CNN3
LL..0LDV$$6#9:://'4+D:??6#:; 1r"   r)   )	__name__r3   __qualname____firstlineno____doc__r   r+   __static_attributes____classcell__)r=   s   @r    r$   r$   ,   s     
< < < <r"   r$   )r   )r,   abcr   typingr   r   r<   r   r   r	   r   r
   r   r   r   __annotations__r   strr!   r$   r)   r"   r    <module>rI      sy       
 - *(	$&'"$%	   0g 0 * *'<# '<r"   