
    j                        U d dl Z d dlZ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	 d dl
mZmZmZmZmZ d dlZd dlmZ d dlmZ d dlmZ d d	lmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z& d d
l'm(Z( d dl)m*Z* d dl+m,Z, d dl-m.Z.m/Z/m0Z0 d dl1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7 d dl8m9Z9m:Z: d dl;m<Z< d dl=m>Z> d dl?m@Z@ d dlAmBZB d dlCmDZDmEZEmFZF d dlGmHZH d dlImJZJ erd dl
mKZK d dl
mLZL d dl
mMZM d dl
mNZN d dl
mOZO d dl
mPZP d dl
mQZQ d dlRmSZSmTZTmUZUmVZVmWZWmXZX d dl8mYZY d d lZm[Z[ d d!l\m]Z] d d"l^m_Z_ d d#l`maZa d d$l-mbZbmcZc d d%ldmeZe d dlmZ d d&lmfZf  eQd'eY(          Zg ed)          Zhd*e6d+e6d,gd-Zid.ejd/<   dDd6Zk	 elZmn# en$ r eoZmY nw xY w G d7 d8          Zp G d9 d:ep          Zq G d; d<ep          Zrd d=l
mZ er( G d> d?e7eeseKf                   Zt G d@ dAe7er          ZudS  dB             Zt dC             ZudS )E    N)Mapping)datetimetimezone)import_module)TYPE_CHECKINGListDictcastoverload)check_uwsgi_thread_support)MetricsBatcher)SpanBatcher)AnnotatedValue
ContextVarcapture_internal_exceptionscurrent_stacktraceenv_to_boolformat_timestampget_sdk_nameget_type_nameget_default_releasehandle_in_apploggerget_before_send_logget_before_send_metrichas_logs_enabledhas_metrics_enabled)	serialize)trace)has_span_streaming_enabled)HttpTransportCoremake_transportAsyncHttpTransport)SPANDATADEFAULT_MAX_VALUE_LENGTHDEFAULT_OPTIONSINSTRUMENTERVERSIONClientConstructor)_DEFAULT_INTEGRATIONSsetup_integrations)DedupeIntegration)SessionFlusher)Envelope)setup_continuous_profiler)has_profiling_enabledProfilesetup_profiler)EventScrubber)Monitor)Any)Callable)Optional)Sequence)Type)Union)TypeVar)EventHintSDKInfoLogMetricEventDataCategory)Integration)Scope)Session)SpotlightClient)StreamedSpan)	TransportItem
LogBatcher)DsnI)boundclient_init_debugzsentry.pythonzpypi:sentry-sdk)nameversion)rO   rP   packagesr>   SDK_INFOargsOptional[str]kwargsr5   returnDict[str, Any]c                     | r=t          | d         t          t          f          s| d         | d         }| dd          } nd }t          |           dk    rt	          d          t          t                    }t          | i |}||                    d          ||d<   |                                D ] \  }}||vrt	          d|          |||<   !|d         "t          j
                            d          |d<   |d         t                      |d<   |d         $t          j
                            d	          pd
|d<   |d         3t          t          j
                            d          d          pd|d<   |d         +t          t          d          rt          j                    |d<   |d         t           j        |d<   |d         ,	 t          j                    }n# t&          $ r d }Y nw xY w||d<   |d         du r|d         d|d<   |d         #t)          |d         dn|d                   |d<   |d         r4t          |d         t*                    st-          j        d           d |d<   |d         3t          t          j
                            d          d          pd|d<   |d         t1          j        dt4          d            |S )!Nr      z+Only single positional argument is expecteddsnzUnknown option 
SENTRY_DSNreleaseenvironmentSENTRY_ENVIRONMENT
productiondebugSENTRY_DEBUGT)strictFserver_namegethostnameinstrumenterproject_rootenable_tracingtraces_sample_rate      ?event_scrubbersend_default_pii)rk   socket_optionszxIgnoring socket_options because of unexpected format. See urllib3.HTTPConnection.socket_options for the expected format.
keep_aliveSENTRY_KEEP_ALIVEzVThe `enable_tracing` parameter is deprecated. Please use `traces_sample_rate` instead.   
stacklevel)
isinstancebytesstrlen	TypeErrordictr&   getitemsosenvironr   r   hasattrsocketrd   r'   SENTRYgetcwd	Exceptionr3   listr   warningwarningswarnDeprecationWarning)rS   rU   rZ   rvoptionskeyvaluerf   s           \/DATA/AppData/hermes/projects/honcho/.venv/lib/python3.11/site-packages/sentry_sdk/client.py_get_optionsr   \   s4    DGeS\22 d1go#AwABBx
4yy1}}EFFF	o		BD#F##G
7;;u--5mmoo  
Ub==)3389993	%yJNN<005		)}+--9	- JNN+?@@PL=	'{!"*.."@"@NNNWRW7	- WV]%C%C ".00=	.!)0>	.!	 9;;LL 	  	  	 LLL	  *>	
t##+?(@(H#& 	
#,./7R@R=S 
  
  
 

 $Jr2B/CT$J$J $ G	
 	
 	
  $	,
':;;DIIIRU 	< 

'd	
 	
 	
 	
 Is   G& &G54G5c                   (   e Zd ZU dZdZded<   d2d3dZd4dZd5dZe	d6d            Z
e	d7d            ZdefdZdefdZd8dZd9dZd:dZd;dZd5d Zered!edd"fd#            Zed<d&            Z	 	 	 	 d=d(Zd5d)Zd5d*Zd5d+Zd5d,Zd>d-Zd?d1ZdS )@
BaseClientzp
    .. versionadded:: 2.0.0

    The basic definition of a client that is used for sending data to Sentry.
    NzOptional[SpotlightClient]	spotlightr   Optional[Dict[str, Any]]rV   c                 z    ||nt           | _        d | _        d | _        d | _        d | _        d | _        i | _        d S N)r&   r   	transportmonitorlog_batchermetrics_batcherspan_batcherintegrations)selfr   s     r   __init__zBaseClient.__init__   sK    *GG 	 15,037;?5968    rS   r5   rU   c                 
    di iS Nr    r   rS   rU   s      r   __getstate__zBaseClient.__getstate__   s    2r   c                     d S r   r   r   s      r   __setstate__zBaseClient.__setstate__       r   rT   c                     d S r   r   r   s    r   rZ   zBaseClient.dsn       tr   Optional[Dsn]c                     d S r   r   r   s    r   
parsed_dsnzBaseClient.parsed_dsn   r   r   c                     dS )NFr   r   s    r   should_send_default_piiz"BaseClient.should_send_default_pii   s    ur   c                     dS )u
        .. versionadded:: 2.0.0

        Returns whether the client is active (able to send data to Sentry)
        Fr   r   s    r   	is_activezBaseClient.is_active   s	     ur   c                     d S r   r   r   s      r   capture_eventzBaseClient.capture_event       tr   logr?   scoperC   c                     d S r   r   r   r   r   s      r   _capture_logzBaseClient._capture_log   r   r   metricr@   c                     d S r   r   r   r   r   s      r   _capture_metriczBaseClient._capture_metric   r   r   spanrF   c                     d S r   r   r   r   r   s      r   _capture_spanzBaseClient._capture_span   r   r   c                     d S r   r   r   s      r   capture_sessionzBaseClient.capture_session   r   r   name_or_classOptional[Integration]c                     d S r   r   r   r   s     r   get_integrationzBaseClient.get_integration       RURUr   type[I]Optional[I]c                     d S r   r   r   s     r   r   zBaseClient.get_integration       NQcr   Union[str, type[Integration]]c                     d S r   r   r   s     r   r   zBaseClient.get_integration   s	     tr   c                     d S r   r   r   s      r   closezBaseClient.close   r   r   c                     d S r   r   r   s      r   flushzBaseClient.flush   r   r   c                 
   K   d S r   r   r   s      r   close_asynczBaseClient.close_async        tr   c                 
   K   d S r   r   r   s      r   flush_asynczBaseClient.flush_async  r   r   c                     | S r   r   r   s    r   	__enter__zBaseClient.__enter__      r   exc_type	exc_valuetbc                     d S r   r   r   r   r   r   s       r   __exit__zBaseClient.__exit__  r   r   r   )r   r   rV   N)rS   r5   rU   r5   rV   r5   rS   r5   rU   r5   rV   NrV   rT   rV   r   )rS   r5   rU   r5   rV   rT   )r   r?   r   rC   rV   N)r   r@   r   rC   rV   N)r   rF   r   rC   rV   Nr   r   rV   r   )r   r   rV   r   )rV   r   r   r5   r   r5   r   r5   rV   N)__name__
__module____qualname____doc__r   __annotations__r   r   r   propertyrZ   r   boolr   r   r   r   r   r   r   r   r   rt   r   r   r   r   r   r   r   r   r   r   r   r      s,          .2I*111
9 
9 
9 
9 
9          X    X    4                     R	UU9PUUU 
U	QQQ 
Q<	    
                    r   r   c                       e Zd ZdZdS )NonRecordingClientz
    .. versionadded:: 2.0.0

    A client that does not send any events to Sentry. This is used as a fallback when the Sentry SDK is not yet initialized.
    N)r   r   r   r   r   r   r   r   r     s          	Dr   r   c            	       `    e Zd ZdZdP fdZdQdZdRd
Z	 	 	 	 dSdZdTdZde	fdZ
de	fdZedUd            ZedVd            Z	 	 	 	 	 	 	 	 dWdZddddde	fdZ	 dXddddddde	fdZddddde	fdZ	 	 	 	 	 	 dYd"Z	 	 dZ	 	 	 	 	 	 	 d[d$Zd%d&d'edd(ddfd)Zd\d,Zd]d/Zd^d2Z	 	 	 	 d_d3Zered4edd5fd6            Zed`d9            Z	 	 	 	 dad;Zde	fd<Zedbd>            ZdTd?Z dTd@Z!	 	 dZ	 	 	 	 	 dcdEZ"	 	 dZ	 	 	 	 	 dcdFZ#	 	 dZ	 	 	 	 	 dcdGZ$	 	 dZ	 	 	 	 	 dcdHZ%dddIZ&dedMZ'dddNZ(dedOZ) xZ*S )f_ClientaI  
    The client is internally responsible for capturing the events and
    forwarding them to sentry through the configured transport.  It takes
    the client options as keyword arguments and optionally the DSN as first
    argument.

    Alias of :py:class:`sentry_sdk.Client`. (Was created for better intelisense support)
    rS   r5   rU   rV   Nc                     t          t          |                               t          |i |           |                                  d S )Nr   )superr   r   get_options
_init_impl)r   rS   rU   	__class__s      r   r   z_Client.__init__#  sG    gt%%k4.J6.J.J%KKKr   c                     d| j         iS r   r   r   s    r   r   z_Client.__getstate__'  s    4<((r   statec                 H    |d         | _         |                                  d S r   )r   r   )r   r   s     r   r   z_Client.__setstate__*  s$    Y'r   functions_to_traceSequence[Dict[str, str]]c                 ^   |D ]}d}|d         }|                     dd          \  }}	 t          |          }t          ||          }t          ||t	          |                     t          j        d|           z# t          $ r 	 |                     dd          \  }}t          |          }t          ||          }	t          |	|          }t          |	j	        |                   }
t	          |          }|
t          t          fv rt          |          }t          |	||           t          |||	           t          j        d|           n-# t          $ r }t          j        d||           Y d}~nd}~ww xY wY }t          $ r!}t          j        d||           Y d}~d}~ww xY wdS )z
        Instruments the functions given in the list `functions_to_trace` with the `@sentry_sdk.tracing.trace` decorator.
        Nqualified_name.rY   zEnabled tracing for %szWCan not enable tracing for '%s'. (%s) Please check your `functions_to_trace` parameter.)rsplitr   getattrsetattrr   r   r`   module_not_found_errortype__dict__staticmethodclassmethodr   r   )r   r   function
class_namefunction_qualnamemodule_namefunction_name
module_objfunction_obj	class_objfunction_typetraced_functiones                r   _setup_instrumentationz_Client._setup_instrumentation.  s#    + ,	 ,	HJ ()9 :):)A)A#q)I)I&K' +;77
&z=AA
M53F3FGGG57HIIII)    /:.@.@a.H.H+K!.{!;!;J '
J ? ?I#*9m#D#DL$();M)J$K$KM&+L&9&9O${(CCC*6*G*GI}oFFFJ
I>>>L!9;LMMMM    Nq)           m%       O,	 ,	sI   AA==
F*CEF*
E:E50F*5E::F* 	F*	F%%F*c                     t                               d          }d/ fd}	 	 d0dt          dd	d
ddt          dd f
 fd}	 t                                j        d                    t           j                   _        d  _         j        r& j        d         rt           j                   _        ddl
m}  | j                   _         j        8 j        d         s+d }d j        d<   | j        d<   | j        d<   | j        d<   t          |           _        d  _        t!           j                  rddlm}  |||           _        d  _        t)           j                  rt+          ||           _        d  _        t/           j                  rt1          ||           _        d} j        d         |vr"t3          d                    |                     j        d                             d d          rEt7          j        d!           t:          j         j        d"<   d#t>          vrt?          j         d#           tC           j        d$          j        d%          j        d&          j        d'          j        (           _"        tG          tI           j"        %                                                    }|tL          d)<   t7          j        d*|           tO           j                  rB	 tQ           j                   nv# tR          $ r}	t7          j        d+|	           Y d }	~	nRd }	~	ww xY w	 tU           j        tL          |,           n,# tR          $ r}	t7          j        d-|	           Y d }	~	nd }	~	ww xY wt                               |           n# t                               |           w xY w +                     j                            d.g                       j        sC j        s< j        s5 j        s.tO           j                  stY           j        tZ                    rt]                       d S d S )1NFenveloper.   rV   c                     j         j                             |            j        j                            |            d S d S r   )r   capture_enveloper   )r  r   s    r   _capture_envelopez-_Client._init_impl.<locals>._capture_envelopee  sM    ~)//999~)//99999 *)r   rY   reasondata_categoryrA   itemzOptional[Item]quantityc                 V    j          j                             | |||           d S d S )N)r  r  r  r  )r   record_lost_event)r  r  r  r  r   s       r   _record_lost_eventz._Client._init_impl.<locals>._record_lost_eventk  sJ     ~)00!"/%	 1      *)r   r`   enable_backpressure_handlingr   )setup_spotlightrZ   c                      dS )Nri   r   )_args_kwargss     r   <lambda>z$_Client._init_impl.<locals>.<lambda>  s    s r   Trk   error_samplertraces_samplerprofiles_sampler)capture_funcrI   )r%  record_lost_func)alwaysneversmallmediummax_request_body_sizez:Invalid value for max_request_body_size. Must be one of {}_experimentsotel_powered_performancezA[OTel] Enabling experimental OTel-powered performance monitoring.re   zJsentry_sdk.integrations.opentelemetry.integration.OpenTelemetryIntegrationr   default_integrationsauto_enabling_integrationsdisabled_integrations)with_defaultswith_auto_enabling_integrationsr0  r   rO   zSetting SDK name to '%s'zCan not set up profiler. (%s))sdk_infor%  z(Can not set up continuous profiler. (%s)r   )r  r.   rV   N)NrY   )/_client_init_debugrx   rt   intsetr   r"   r   r   r4   sentry_sdk.spotlightr  r   r-   session_flusherr   r   sentry_sdk._log_batcherrJ   r   r   r   r   r    r   
ValueErrorformatr   r`   r'   OTELr*   appendr+   r   r   r   keysrR   r0   r2   r   r/   r  rr   r!   r   )
r   	old_debugr  r  r  
sample_allrJ   r+  sdk_namer  s
   `         r   r   z_Client._init_implb  s;   &**511		: 	: 	: 	: 	: 	: &*		 		.	 #	 		
 	 	 	 	 	 	b	.""4<#8999+DL99DNDL~ ;< >? ;#*4>#:#:DL =<<<<<,_T\::DN~)$,u2E)::
37/00:_-1;-.3=/0#1?P#Q#Q#QD #D-- >>>>>>#-:!2%7$ $ $ 
 $(D "4<00 '5!2%7( ( ($
 !%D)$,77 $/!2%7% % %!
 %K!|34<QQQ PWW-    |N+//0JERR W   0</@^,`01 1 *0d   !3^,"l+AB0401 '+l3J&K! ! !D $D):)?)?)A)A$B$BCCH'HVL3X>>>$T\22 PE"4<0000  E E EL!@!DDDDDDDDEP-!)%6    
 ! P P PL!KQOOOOOOOOP ""9----""9----##DL$4$45I2$N$NOOO L
	)
	) #
	)  	
	)
 %T\22
	) $.*;<<
	) '(((((
	) 
	)sa    J?N&  L N& 
L>L94N& 9L>>N& M N& 
N)N>N& NN& &Oc                     dS )r   Tr   r   s    r   r   z_Client.is_active  s	     tr   c                 :    | j                             d          pdS )z
        .. versionadded:: 2.0.0

        Returns whether the client should send default PII (Personally Identifiable Information) data to Sentry.
        rk   F)r   rx   r   s    r   r   z_Client.should_send_default_pii  s      | 233<u<r   rT   c                     | j         d         S )z%Returns the configured DSN as string.rZ   r   r   s    r   rZ   z_Client.dsn  s     |E""r   r   c                 ,    | j         r| j         j        ndS )z)Returns the configured parsed DSN object.N)r   r   r   s    r   r   z_Client.parsed_dsn   s     -1NDt~((Dr   eventr<   hintr=   r   Optional[Scope]Optional[Event]c                 P   d }d }|                     d          !t          j        t          j                  |d<   |                     d          dk    }|t          t          t          t          t          t          f                  |                     dg                               }|                    ||| j                  }|K| j        rB| j                            d|rdnd           |r | j                            dd|d	z   
           d S |}|t          t          t          t          t          t          f                  |                     dg                               z
  }	|                    dd          }
|rM| j        F|	dk    r| j                            dd|	
           |
dk    r| j                            dd|

           |
|	z   }|dk    r||z   }|j        dk    rZ|                     di           }t#          |t$                    s|                     dg           ng }t          |          |j        z   }|s| j        d         rd|vrd|vr|d|vrxt'                      5  dt)          | j                             dd          | j                             dt*                              dddgi|d<   d d d            n# 1 swxY w Y   dD ]S}|                     |          <| j        |         /t          | j        |                                                   ||<   T|                     d          Bt/          t0                    }t3          | j                                                  |d<   ||d<   |                     d          d|d<   t9          || j        d         | j        d          | j        d!                   }|$| j        d"         }|r|                    |           ||j        r|                     dg           }t#          |t>                    r|D ]}|                     d#d           }|                     d$i           }|rQ||j        v rHt@          j!        |v r:t%          |t@          j!                 d%|j        |         i          |t@          j!        <   |)t%          |                     dg           d%|i          |d<   |+t%          |                     ddg i          d%|i          |d<   |wt          d&tE          t          d'|          | j                             d(          | j                             d          | j                             d)          *                    }| j        d+         }|||                     d          dk    rd }t'                      5   |||pi           }d d d            n# 1 swxY w Y   |_tG          j$        d,           | j        r| j                            d+d           |                     d          rtK          j&                     |}| j        d-         }|R|O|                     d          dk    r5d }t          t          t          t          t          t          f                  |                     dg                               }t'                      5   |||pi           }d d d            n# 1 swxY w Y   |XtG          j$        d.           | j        r<| j                            d+d/           | j                            d+d|d	z   0           nP|t          |                     dg                     z
  }	|	dk    r$| j        | j                            d+d|	0           |}|S )1N	timestampr   transactionspansevent_processorerrorr  r   rY   )r  r  _dropped_spansr   buffer_overflowbreadcrumbsvaluesattach_stacktrace	exception
stacktracethreadsinclude_local_variablesTmax_value_length)rY  rZ  F)rW  crashedcurrent)r\   r]   rc   distsdkr   platformpythonin_app_excludein_app_includerf   rj   span_iddataru   r<   rW   r+  custom_repr)r+  rZ  re  before_sendzbefore send dropped eventbefore_send_transactionz%before send transaction dropped event)r  r  )r  r  r  )'rx   r   nowr   utcru   r
   r   r	   rt   objectapply_to_eventr   r   r  pop_n_breadcrumbs_truncatedrr   r   r   r   r%   striprw   rR   sortedr   r>  r   scrub_event_gen_ai_original_message_countr   r$   GEN_AI_REQUEST_MESSAGESr   r   infor,   reset_last_seen)r   rF  rG  r   previous_total_spansprevious_total_breadcrumbsis_transactionspans_beforeevent_spans_deltaspan_recorder_dropped_spansdropped_spansrS  rT  r   r3  rj   rM  r   rc  	span_datarf  	new_eventrg  s                           r   _prepare_eventz_Client._prepare_event  s'	    156:"99[!!)!)hl!;!;E+6**m;tDc6k):$;UYYwPR=S=STTUUL))%t|DDF ~> 
N44)8F'S}}G 5    & 88-*0%1A%5 9   
 tE&T$sF{+,eii.D.DEE* * K 05yy9I1/M/M' 
$."<??N44)+ 5    /22N44)&,!< 5    "={!JMq  '3m'C$-11#iir:: &k>BBKOOHb111  KK%"@@ +
 	01	 5((E))&&,..  *<8<8H8H$=t9" 9" 261A1A$68P2" 2"	+ + + (-'+ $i               $ C 	< 	<Cyy~~%$,s*;*G c!23399;;c
99U#H~~H'-d.?.D.D.F.F'G'GH^$#E%L99Z  ( (E*L)*L)*L(	
 
 !\*:;N 2**5111!E=BYYwPR=S=SE%&& !  D"hhy$77G $ 4 4I#u'KKK$<	IIFT%h&FG"E$H$QRG G	("BC  ++		'2&&0D(E E'N &1#1		-(B8823$ $E-  )511*.,*:*:;R*S*S%)\%5%56H%I%I $ 0 0 ? ?	   E l=1#!		&!!]22I,.. ; ;'Ktzr::	; ; ; ; ; ; ; ; ; ; ; ; ; ; ; 7888> N44%W 5    99[)) 8%5777E"&,/H"I#/!		&!!]22ItDc6k):$;UYYwPR=S=STTUUL,.. G G33E4:2FF	G G G G G G G G G G G G G G G CDDD> N44,M 5    N44,&,!-!1 5    +Sw1K1K-L-LL??t~'AN44,F[ 5    Es7   .AKKK;WWW[//[36[3c                 &   |                     d          }|dS |d         }t          |d                   }|d         j        d|}| j        d         D ]:}t	          |t
                    r||k    s||k    r dS 't          ||          r dS ;dS )Nexc_infoFr   r   ignore_errorsT)rx   r   r   r   rr   rt   
issubclass)r   rF  rG  r  rO  error_type_nameerror_full_nameignored_errors           r   _is_ignored_errorz_Client._is_ignored_error  s    88J''5'44%-a[%;%;%;__M!\/: 	  	 M ---   O33}7W7W44 8X e]33  44  ur   c                     |                     d          dk    }|rdS |d uo|j         }|rdS |                     ||          }|rdS dS )Nr   rL  TF)rx   _should_capturer  )r   rF  rG  r   rw  ignoring_prevents_recursionignored_by_config_options          r   r  z_Client._should_capture  sr     6**m; 	4&+4&7&U@U<U#& 	5#'#9#9%#F#F # 	5tr   c                 N   | j                             dd           }t          |          r3t                      5   |||          }d d d            n# 1 swxY w Y   n| j         d         }	 |dk     ot	          j                    |k    }nt# t
          $ r t          j        d           d}Y nRt          $ rF t          |          rdnd\  }}t          j        d|d	|d
t          |          d           d}Y nw xY w|r%| j
        r| j
                            dd           dS dS )Nr"  sample_rateri   zMThe provided error_sampler raised an error. Defaulting to sampling the event.F)r"  returned)r  containszThe provided  z an invalid value of zJ. The value should be a float or a bool. Defaulting to sampling the event.rO  rP  T)r   rx   callabler   random	NameErrorr   r   rv   reprr   r  )r   rF  rG  r"  r  not_in_sample_rate	parameterverbs           r   _should_sample_errorz_Client._should_sample_error  s   
 (($??M"" 	6,.. 9 9+mE4889 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ,}5K	'!,s!2!Uv}+7U 	' 	' 	'N_   "' 	' 	' 	' M**1--0 It
 NN99dddD$5$5$5$57   "'	'  	~ W00g0VVV5ts*   AAA,B
 
 C;,AC;:C;sessionrD   c                    d}d}d }|                     d          pi                      d          }|rjd}|D ]e}t          |t                    r	|j        pi }|                     d          }t          |t                    r|                     d          du rd} nf|                     d          }	|j        y|                     d          pi                      d	          }
t          |
t                    r|
ni }|                                D ]!\  }}|                                d
k    r|} n"|	                    |rdnd |	||j
        |p|z              d S )NFrV  rT  T	mechanismhandleduserrequestheadersz
user-agentr[  )statusr  
user_agenterrors)rx   rr   r   r   r   r  rw   ry   lowerupdater  )r   r  rF  r[  erroredr  
exceptionsrO  r  r  r  headers_dictkvs                 r   _update_session_from_eventz"_Client._update_session_from_event.  s   
 
ii,,277AA
 	G#  e^44 .!K-2E!IIk22	i11 immI6N6NRW6W6W"GEyy  %yy++1r66yAAG&0$&?&?G77RL$**,,  17799,,!"JE - 	 '199T!>W%78	 	 	
 	
 	
 	
 	
r   Optional[Hint]c                 D   t          |pd          }|                     |||          sdS |                    dd          }|                    d          }|t	          j                    j        x|d<   }|                     |||          }|dS |r|j        nd}|r| 	                    ||           |                    d          dk    }|                    d          dk    }	|s|	s| 
                    ||          sdS |                    d          }
|                    d	i                               d
          pi }|                    di           }|d         t          t          j        t          j                            d}|r||d
<   t!          |          }|rYt#          |t$                    r.|                    |                    || j                             |                    |           n-|	r|                    |           n|                    |           |
pdD ])}|                    |                                           *d}| j        r| j                            |           |}| j        | j                            |           |}|S )a  Captures an event.

        :param event: A ready-made event that can be directly sent to Sentry.

        :param hint: Contains metadata about the event that can be read from `before_send`, such as the original exception object or a HTTP request object.

        :param scope: An optional :py:class:`sentry_sdk.Scope` to apply to events.

        :returns: An event ID. May be `None` if there is no DSN set or of if the SDK decided to discard the event for other reasons. In such situations setting `debug=True` on `init()` may help.
        r   Nprofileevent_idr   rL  check_inattachmentscontextsr   dynamic_sampling_context)r  sent_at)r  )rw   r  rl  rx   uuiduuid4hexr  _sessionr  r  r   r   rh  r   ri  r.   rr   r1   add_profileto_jsonr   add_transactionadd_checkin	add_eventadd_itemto_envelope_itemr   r  r   )r   rF  rG  r   r  r  	event_optr  rw  
is_checkinr  trace_contextr  r  r  
attachmentreturn_values                    r   r   z_Client.capture_eventS  s     DJB''##E477 	4))It,,99Z((+/:<<+;;E*''tU;;	4 %*3%..t 	<++GU;;;"v..-?]]6**j8
 		 --eT::	
 4hh}--!j"5599'BBHb#0#4#45OQS#T#T  "*-'X\(B(BCC(
 (

 $ 	87GGG,,, 	*'7++ O$$W__Y%M%MNNN$$Y//// 	*  ++++y)))%+ 	= 	=Jj99;;<<<<> 	$N++H555#L>%N++H555#Lr   	telemetryz*Optional[Union[Log, Metric, StreamedSpan]]tyrC   c                 R   |d S |                     |           d }|dk    rt          | j                  }n|dk    rt          | j                  }| ||i           }|d S d }|dk    r| j        }n|dk    r| j        }n|dk    r| j        }||                    |           d S d S )Nr   r   r   )apply_to_telemetryr   r   r   r   r   r   add)r   r  r  r   rf  batchers         r   _capture_telemetryz_Client._capture_telemetry  s     F  +++;;-dl;;KK8^^0>>K"#Ir22IF;;&GG8^^*GG6\\'GKK	""""" r   r   Optional[Log]c                 4    |                      |d|           d S )Nr   r  r   s      r   r   z_Client._capture_log  s     UE22222r   r   Optional[Metric]c                 4    |                      |d|           d S )Nr   r  r   s      r   r   z_Client._capture_metric  s     %88888r   r   Optional[StreamedSpan]c                 4    |                      |d|           d S )Nr   r  r   s      r   r   z_Client._capture_span  s     fe44444r   c                 t    |j         st          j        d           d S | j                            |           d S )Nz3Discarded session update because of missing release)r\   r   rs  r8  add_session)r   r  s     r   r   z_Client.capture_session  sB      	6KMNNNNN ,,W55555r   r   r   c                     d S r   r   r   s     r   r   z_Client.get_integration  r   r   r   r   c                     d S r   r   r   s     r   r   z_Client.get_integration  r   r   Union[str, Type[Integration]]c                     t          |t                    r|}n|j        |j        }nt          d          | j                            |          S )zReturns the integration for this client by name or class.
        If the client does not have that integration then `None` is returned.
        NzIntegration has no name)rr   rt   
identifierr:  r   rx   )r   r   integration_names      r   r   z_Client.get_integration  s[     mS)) 	8,%1,76777 $$%5666r   c                 6    t          | j        t                    S )z(Check if the current transport is async.)rr   r   r#   r   s    r   _has_async_transportz_Client._has_async_transport  s    $.*<===r   tuple[Any, ...]c                 X    t          d | j        | j        | j        fD                       S )Nc              3      K   | ]}||V  	d S r   r   ).0bs     r   	<genexpr>z$_Client._batchers.<locals>.<genexpr>  s0       
 
} }}}
 
r   )tupler   r   r   r   s    r   	_batchersz_Client._batchers  s@     
 
&(<d>OP
 
 
 
 
 	
r   c                     | j                                          | j        D ]}|                                 | j        r| j                                         dS dS )z0Kill all client components in the correct order.N)r8  killr  r   r   r  s     r   _close_componentsz_Client._close_components   se    !!### 	 	AFFHHHH< 	 L	  	 r   c                 t    | j                                          | j        D ]}|                                 dS )zFlush all client components.N)r8  r   r  r  s     r   _flush_componentsz_Client._flush_components  sA    ""$$$ 	 	AGGIIII	 	r   timeoutOptional[float]callback&Optional[Callable[[int, float], None]]c                 ,   | j         |                                 r+t          j        dd           |                                  n|                     ||           |                                  | j                                          d| _         dS dS )z
        Close the client and shut down the transport. Arguments have the same
        semantics as :py:meth:`Client.flush`.
        Nz@close() used with AsyncHttpTransport. Use close_async() instead.ro   rp   r  r  )r   r  r   r   r  r   r  r  r   r  r  s      r   r   z_Client.close  s     >%((** ?V     &&((((

7X
>>>""$$$N!!!!DNNN &%r   c                 &  K   | j         |                                 st          j        d           dS |                     ||           d{V  |                                  | j                                         }|| d{V  d| _         dS dS )z
        Asynchronously close the client and shut down the transport. Arguments have the same
        semantics as :py:meth:`Client.flush_async`.
        NzRclose_async() used with non-async transport, aborting. Please use close() instead.r  )r   r  r   r`   r   r  r  )r   r  r  	kill_tasks       r   r   z_Client.close_async$  s       >%,,.. h   ""7X"FFFFFFFFF""$$$++--I$!DNNN &%r   c                     | j         m|                                 rt          j        dd           dS || j        d         }|                                  | j                             ||           dS dS )a#  
        Wait for the current events to be sent.

        :param timeout: Wait for at most `timeout` seconds. If no `timeout` is provided, the `shutdown_timeout` option value is used.

        :param callback: Is invoked with the number of pending events and the configured timeout.
        Nz@flush() used with AsyncHttpTransport. Use flush_async() instead.ro   rp   shutdown_timeoutr  )r   r  r   r   r   r  r   r  s      r   r   z_Client.flush:  s     >%((** V     ,'9:""$$$N  8 DDDDD &%r   c                   K   | j         u|                                 st          j        d           dS || j        d         }|                                  | j                             ||          }|| d{V  dS dS dS )a2  
        Asynchronously wait for the current events to be sent.

        :param timeout: Wait for at most `timeout` seconds. If no `timeout` is provided, the `shutdown_timeout` option value is used.

        :param callback: Is invoked with the number of pending events and the configured timeout.
        NzRflush_async() used with non-async transport, aborting. Please use flush() instead.r  r  )r   r  r   r`   r   r  r   )r   r  r  
flush_tasks       r   r   z_Client.flush_asyncS  s       >%,,.. h   ,'9:""$$$--g-QQJ%           &% &%r   c                     | S r   r   r   s    r   r   z_Client.__enter__l  r   r   r   r   r   c                 .    |                                   d S r   )r   r   s       r   r   z_Client.__exit__o  s    

r   c                 
   K   | S r   r   r   s    r   
__aenter__z_Client.__aenter__r  s      r   c                 >   K   |                                   d {V  d S r   )r   r   s       r   	__aexit__z_Client.__aexit__u  s0                 r   r   )rV   r5   )r   r5   rV   N)r   r   rV   N)rV   Nr   r   )rF  r<   rG  r=   r   rH  rV   rI  r   )r  rD   rF  r<   rV   N)NN)rF  r<   rG  r  r   rH  rV   rT   )r   r  r   rC   rV   N)r   r  r   rC   rV   N)r   r  r   rC   rV   N)r  rD   rV   Nr   )r   r  rV   r   )rV   r  )r  r  r  r  rV   N)rV   r   r   )+r   r   r   r   r   r   r   r  r   r   r   r   r   rZ   r   r  r  r  r  r  r   rt   r  r   r   r   r   r   r   r   r  r  r  r  r   r   r   r   r   r   r  r  __classcell__)r   s   @r   r   r     s#             ) ) ) )   2"<2	2 2 2 2hG) G) G) G)R4    = = = = = # # # X# E E E XENN N !	N
 
N N N N`w f     2 $(	   !	
 
   *-- - 
	- - - -^#
#
 #
 
	#
 #
 #
 #
P "&#'	RR R !	R
 
R R R Rh!#?!# !# 	!#
 
!# !# !# !#F3 3 3 39 9 9 95 5 5 566 
6 6 6 6  R	UU9PUUU 
U	QQQ 
Q767 
!7 7 7 7 >d > > > > 
 
 
 X
           &*=A""" ;" 
	" " " "0 &*=A""" ;" 
	" " " "0 &*=AE"E ;E 
	E E E E6 &*=A!"! ;! 
	! ! ! !2         ! ! ! ! ! ! ! !r   r   )r   c                       e Zd ZdS )r   Nr   r   r   r   r   r   r   r             r   r   c                       e Zd ZdS )ClientNr  r   r   r   r  r    r   r   r  c                      t           S r   )r   r   r   r   r!  r!    s    < r   c                      t           S r   )r   r   r   r   r!  r!    s    g r   )rS   rT   rU   r5   rV   rW   )vrz   r  r  r}   collections.abcr   r   r   	importlibr   typingr   r   r	   r
   r   r   sentry_sdk._compatr   sentry_sdk._metrics_batcherr   sentry_sdk._span_batcherr   sentry_sdk.utilsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   sentry_sdk.serializerr   sentry_sdk.tracingr   sentry_sdk.tracing_utilsr    sentry_sdk.transportr!   r"   r#   sentry_sdk.constsr$   r%   r&   r'   r(   r)   sentry_sdk.integrationsr*   r+   sentry_sdk.integrations.deduper,   sentry_sdk.sessionsr-   sentry_sdk.enveloper.   'sentry_sdk.profiler.continuous_profilerr/   (sentry_sdk.profiler.transaction_profilerr0   r1   r2   sentry_sdk.scrubberr3   sentry_sdk.monitorr4   r5   r6   r7   r8   r9   r:   r;   sentry_sdk._typesr<   r=   r>   r?   r@   rA   rB   sentry_sdk.scoperC   sentry_sdk.sessionrD   r7  rE   sentry_sdk.tracesrF   rG   rH   r9  rJ   rK   rL   r4  rR   r   r   ModuleNotFoundErrorr   r   ImportErrorr   r   r   rt   r   r  r   r   r   <module>r     s/   					    # # # # # # ' ' ' ' ' ' ' ' # # # # # # < < < < < < < < < < < < < <  9 9 9 9 9 9 6 6 6 6 6 6 0 0 0 0 0 0                                 " , + + + + + $ $ $ $ $ $ ? ? ? ? ? ?         
                N M M M M M M M < < < < < < . . . . . . ( ( ( ( ( ( M M M M M M         
 . - - - - - & & & & & & (VVVVVVVVVVVVVVVV333333&&&&&&******444444......44444444222222::::::$$$$$$;'''AZ 344  +@@A )   K K K K\)0 ) ) )()
Z Z Z Z Z Z Z Zz	 	 	 	 	 	 	 	]! ]! ]! ]! ]!j ]! ]! ]!@ !           !    'c3h       "G      (''**Koo  FFFs   .E1 1E;:E;