ó
    Ð]j  ã                  óP  • S SK Jr  S SKrS SKJr  S SKJr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Jr  \R(                  q\R(                  qSS
 jr\" [*        5      SS j5       r\" [,        5      SS j5       r        SS jrSS jrSS jrg! \ a    SS jr Nf = f)é    )ÚannotationsN)Úasdict)ÚpartialÚwraps)ÚAnyÚCallable)ÚContextCarrierÚattach_contextÚget_contexté   )Úwarn_at_user_stacklevel)ÚProcessPoolExecutorÚThreadPoolExecutorc                 óž   • [         R                  [        L a  [        [         l        [        R                  [
        L a  [        [        l        gg)z‹Monkey-patch `submit()` methods of `ThreadPoolExecutor` and `ProcessPoolExecutor`
to carry over OTEL context across threads and processes.
N)r   ÚsubmitÚsubmit_t_origÚsubmit_tr   Úsubmit_p_origÚsubmit_p© ó    Úe/home/mande/repo/quber/.venv/lib/python3.13/site-packages/logfire/_internal/integrations/executors.pyÚinstrument_executorsr      s7   € ô
 ×$Ñ$¬Ò5Ü(0ÔÔ%Ü×%Ñ%¬Ò6Ü)1ÔÕ&ð 7r   c               óT   • [        U/UQ70 UD6n[        5       n[        U [        XASS9$ )z[A wrapper around ThreadPoolExecutor.submit() that carries over OTEL context across threads.N©ÚcarrierÚfuncÚparent_config)r   r   r   Ú_run_with_context©ÚsÚfnÚargsÚkwargsr   s        r   r   r      s2   € ô �RÐ)˜$Ò) &Ñ)ˆÜ“-ˆÜ˜QÔ 1¸7Ð[_Ñ`Ð`r   c               ód   • [        U/UQ70 UD6n[        5       n[        U [        XA[	        5       S9$ )z^A wrapper around ProcessPoolExecutor.submit() that carries over OTEL context across processes.r   )r   r   r   r   Úserialize_configr    s        r   r   r   %   s5   € ô �RÐ)˜$Ò) &Ñ)ˆÜ“-ˆÜ˜QÔ 1¸7Ô[kÓ[mÑnÐnr   c                óx   • Ub  [        U5        [        U 5         U" 5       sSSS5        $ ! , (       d  f       g= f)z’A wrapper around a function that restores OTEL context from a carrier and then calls the function.

This gets run from within a process / thread.
N)Údeserialize_configr
   r   s      r   r   r   ,   s+   € ð Ñ$Ü˜}Ô-ä˜GÕ$Ù“6÷ %×$×$ús   š+«
9c                 ó   • g )Nr   r   r   r   r   r   ;   s   € Ør   c                 ó–   • SSK Jn    [        U 5      n[        R                  " U5        U$ ! [
         a    [        S[        5         gf = f)zÉSerialize the global config for transmission to child processes.

Returns None if the config cannot be pickled, in which case a warning is emitted.
See: https://github.com/pydantic/logfire/issues/1556
r   )ÚGLOBAL_CONFIGa  The Logfire configuration cannot be pickled and will not be automatically sent to child processes. You will need to manually call logfire.configure() in each child process. This typically happens when using local functions as callbacks (e.g., exception_callback).N)Úconfigr+   r   ÚpickleÚdumpsÚ	Exceptionr   ÚUserWarning)r+   Úconfig_dicts     r   r&   r&   ?   sP   € õ 'ðô ˜]Ó+ˆä�Š�[Ô!ØÐøÜó Üð7ô ô	
ñ ðús   ˆ"+ «AÁAc                óP   • SSK JnJn  U c  gUR                  (       d	  U" S0 U D6  gg)z<Deserialize a config dict and apply it to the global config.r   )r+   Ú	configureNr   )r,   r+   r3   Ú_initialized)r,   r+   r3   s      r   r(   r(   Z   s&   € ç1à�~Øà×%×%ÙÑ�FÓð &r   )ÚreturnÚNone)r!   r   r"   úCallable[..., Any]r#   r   r$   r   )r!   r   r"   r7   r#   r   r$   r   )r   r	   r   zCallable[[], Any]r   údict[str, Any] | Noner5   r   )r5   r8   )r,   r8   r5   r6   )Ú
__future__r   r-   Údataclassesr   Ú	functoolsr   r   Útypingr   r   Úlogfire.propagater	   r
   r   Ú
stack_infor   Úconcurrent.futuresr   r   r   r   r   r   r   r   r   ÚImportErrorr&   r(   r   r   r   Ú<module>rA      s¿   ðÝ "ã Ý ß $ß  ç IÑ Iå 0ð0÷ Kà&×-Ñ-€MØ'×.Ñ.€Mô2ñ Œ=Óóaó ðañ Œ=Óóoó ðoðØðØ'8ðØI^ðà	ôô&õ6øðC ó öðús   ²AB ÂB%Â$B%