
    lh                         d dl Z d dlZd dlmZ d dlmZmZ d dlmZm	Z	m
Z
 	 d dlZd dlmZ d dlmZmZ erd dlmZ d d	lmZ d d
lmZ d Zd Zd Z G d de      Zy# e$ r	  ed      w xY w)    N)OP)IntegrationDidNotEnable)event_from_exceptionloggerreraise)Taskzasyncio not available)castTYPE_CHECKING)Any)	Coroutine)ExcInfoc                 B    t        | dd       xs t        | dd       xs dS )N__qualname____name__zcoroutine without __name__)getattr)coros    q/var/www/pru.catia.catastroantioquia-mas.com/tasa/lib/python3.12/site-packages/sentry_sdk/integrations/asyncio.pyget_namer      s.     	nd+ 	(4T*	('    c                      d 	 t        j                         } | j                         fd}| j                  |       y # t        $ r t        j                  d       Y y w xY w)Nc                    fd}d }r |  |       fi |}|,t         |       fd| i|}|j                  r|j                  d= 	 t        d|      j                  t	               d       |S # t
        $ r Y |S w xY w)Nc                  d  K   d } t        j                         5  t        j                  t        j                  t              t        j                        5  	  d {   } d d d        d d d        | S 7 # t        $ r t        t                 Y /w xY w# 1 sw Y   4xY w# 1 sw Y   | S xY ww)N)opnameorigin)
sentry_sdkisolation_scope
start_spanr   FUNCTIONr   AsyncioIntegrationr   	Exceptionr   _capture_exception)resultr   s    r   _task_with_sentry_span_creationzTpatch_asyncio.<locals>._sentry_task_factory.<locals>._task_with_sentry_span_creation*   s     //1 	;#..;;%d^188 ;
;+/ZF;	; 	 &0( ;#%7%9:;; ;	; sd   B0>B#BA8A6 A8$B#,
B06A88BBBBB 	B##B-(B0loopzasyncio.Task[Any]z (Sentry-wrapped))r	   _source_tracebackr
   set_namer   AttributeError)r&   r   kwargsr%   taskorig_task_factorys    `   r   _sentry_task_factoryz+patch_asyncio.<locals>._sentry_task_factory'   s    " D !(9;?E | ;=SDSFS))..r2($/88~&&78 K	 " K	s   
'A3 3	B ?B zThere is no running asyncio loop so there is nothing Sentry can patch. Please make sure you call sentry_sdk.init() within a running asyncio loop for the AsyncioIntegration to work. See https://docs.sentry.io/platforms/python/integrations/asyncio/)asyncioget_running_loopget_task_factoryset_task_factoryRuntimeErrorr   warning)r&   r.   r-   s     @r   patch_asyncior5       sd    @
'') 1131	f 	23 
P	

s   :A   A! A!c                      t        j                         } t        j                         }|j	                  t
              }|5t        | |j                  ddd      \  }}t        j                  ||       | S )Nr/   F)typehandled)client_options	mechanism)hint)	sysexc_infor   
get_clientget_integrationr!   r   optionscapture_event)r=   clientintegrationeventr;   s        r   r#   r#   f   si    ||~H""$F(();<K*!>>(U;
t
 	  T2Or   c                   *    e Zd ZdZde Zed        Zy)r!   r/   zauto.function.c                      t                y )N)r5    r   r   
setup_oncezAsyncioIntegration.setup_once|   s	     	r   N)r   
__module__r   
identifierr   staticmethodrH   rG   r   r   r!   r!   x   s%    Jj\*F r   r!   )r<   r   sentry_sdk.constsr   sentry_sdk.integrationsr   r   sentry_sdk.utilsr   r   r   r/   asyncio.tasksr	   ImportErrortypingr
   r   r   collections.abcr   sentry_sdk._typesr   r   r5   r#   r!   rG   r   r   <module>rT      sn    
    = B B0" '))C
L$ [  0
.
//0s   
A A+