0i.ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddlmZmZddlmZddlmZmZmZddlmZddlmZmZmZmZmZ ddlmZddl!Z!dd l"m#Z#dd l$m%Z%m&Z&m'Z'm(Z(dd l)m*Z*m+Z+m,Z,dd l-m.Z.e.rPdd l/m0Z0m1Z1ddl-m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;mZ>m?Z?m@Z@mAZAddlBmCZCddl)mDZDmEZEmFZFmGZGmHZHeZwewrd?Zxnd@Zx ddAZy ddBZzdCZ{dDZ|dEZ}ddFZ~ddGZdHZdIZ ddJZdKZdLZdMZdNZdOZddPZdQZdRZdSZdTZe\ZZdUZdVZdWZedXZGdYdZevZGd[d\e j(Zd]Zd^Ze d_gd`ZddaZe dbgdcZdddZdeZddfZdgZdhZdiZdjZdkZdlZddmZdnZe.re;doZe;dpZefdqZe#rdrZndsZdtZ ddulmZddvlmZdyZddzZd{Ze.re@d|Zd}Zd~ZdZdZdZdZy#e $rdZYwxYw#e $r dwZdxZYBwxYw)N) namedtuple)datetimetimezone)Decimal)partial partialmethodwraps)Real)parse_qsunquote urlencodeurlsplit urlunsplit)BaseExceptionGroup)PY37)DEFAULT_ADD_FULL_STACKDEFAULT_MAX_STACK_FRAMESDEFAULT_MAX_VALUE_LENGTH EndpointType) AnnotatedAnnotatedValueSENSITIVE_DATA_SUBSTITUTE) TYPE_CHECKING) FrameType TracebackType)AnyCallablecastContextManagerDictIteratorListNoReturnOptionaloverload ParamSpecSetTupleTypeTypeVarUnion)Hub)EventExcInfoLogHintMetricPRizsentry_sdk.errorsz^[a-zA-Z0-9/+=]*$)falsefnnooff0)truetyyeson1iF)strictc~|t|jnd}|tvry|tvry|rdSt |S)zCasts an ENV variable value to boolean using the constants defined above. In strict mode, it may return None if the value doesn't match any of the predefined values. NFT)strlowerFALSY_ENV_VALUESTRUTHY_ENV_VALUESbool)valuerA normalizeds ?/opt/hc_python/lib/python3.12/site-packages/sentry_sdk/utils.py env_to_boolrKZsF (-'8U!!#dJ%%&&4*tE{*cPtj|ddjdS)zCSerialize data into a compact JSON representation encoded as UTF-8.F),:) allow_nan separatorsutf-8)jsondumpsencode)datas rJ json_dumpsrWjs" ::de C J J7 SSrLc ttjjd5}d}tj dk(stj dk(r7t j}|xjt jzc_t jgd|t j||jdjjd}ddd|S#1swYSxYw#tt t"f$rYywxYw)Nzw+win32cygwin)gitz rev-parseHEAD) startupinfostdoutstderrstdinrrR)openospathdevnullsysplatform subprocess STARTUPINFOdwFlagsSTARTF_USESHOWWINDOWPopenPIPE communicatestripdecodeOSErrorIOErrorFileNotFoundError)nullr]revisions rJget_git_revisionrups "''//4 (DK||w&#,,(*B(446 ##z'F'FF#  0 +%?? q" ), O-), O W/ 0s/$C5B8C(C5(C2-C52C55D  D ctjjd}|r|St}|r|SdD]'}tjj|}|s%|cSy)zTry to guess a default release.SENTRY_RELEASE)HEROKU_SLUG_COMMITSOURCE_VERSION!CODEBUILD_RESOLVED_SOURCE_VERSION CIRCLE_SHA1GAE_DEPLOYMENT_IDN)rbenvirongetru)releasevars rJget_default_releasers\jjnn-.G G**..% N rLcHgd}|D]}||vsdj|cSy)zAReturn the SDK name including the name of the used web framework.)djangoflaskfastapibottlefalconquartsanic starlettelitestarstarlitechalice serverlesspyramidtornadoaiohttp aws_lambdagcpbeamasgiwsgizsentry.python.{}z sentry.python)format)installed_integrationsframework_integrations integrations rJ get_sdk_namers5 .. 0 0%,,[9 9. rLceZdZdZdZdZy)CaptureInternalExceptionc|SNrselfs rJ __enter__z"CaptureInternalException.__enter__s rLc(||t|||fy)NT)capture_internal_exception)rtyrHtbs rJ__exit__z!CaptureInternalException.__exit__s >e/ &E2 7rLN)__name__ __module__ __qualname__ __slots__rrrrLrJrrsIrLrctSr)_CAPTURE_INTERNAL_EXCEPTIONrrLrJcapture_internal_exceptionsrs &&rLcxtjjrtj d|yy)z Capture an exception that is likely caused by a bug in the SDK itself. These exceptions do not end up in Sentry and are just logged instead. zInternal error in sentry_sdkexc_infoN) sentry_sdk get_client is_activeloggererrorrs rJrrs/((* 3h G+rLc0|tz jSr)epoch total_secondsrHs rJ to_timestamprs EM ( ( **rLcb|jtj}|jdS)zFormats a timestamp in RFC 3339 format. Any datetime objects with a non-UTC timezone are converted to UTC, so that all timestamps are formatted in UTC. z%Y-%m-%dT%H:%M:%S.%fZ) astimezonerutcstrftime)rHutctimes rJformat_timestamprs, x||,G   3 44rL)+-c\ tj|}|jtjS#ttf$rfd|vrdnd}|j dr|dddz}|dt vr|dz }|dd |d dz}n|d t vr|dz }tj ||}YwxYw) N.z%Y-%m-%dT%H:%M:%S.%fz%Y-%m-%dT%H:%M:%SZz+0000iz%z) r fromisoformatAttributeError ValueErrorendswithISO_TZ_SEPARATORSstrptimerrr)rHresulttimestamp_formats rJdatetime_from_isoformatrs<''.   X\\ ** J '<'*Ul "8K  >># #2J(E 9) )  $ #2Jrs+E 2Y+ +  $ ""5*:;&x0{  !!rLceZdZdZy)BadDsnzRaised on invalid DSNs.Nrrr__doc__rrLrJrr"s!rLrc4eZdZdZdZedZddZdZy)DsnzRepresents a DSN.cDt|trt|j|_yt t |}|j dvrtd|j z|j |_|j td|j|_ |j|j dk(xrdxsd|_ n|j|_ |js td|j|_ |j|_|jj!dd } t t#|j%|_dj-|dz|_y#t(t*f$r td |jxsd d dzwxYw) N)httphttpszUnsupported scheme %rzMissing hostnamerPzMissing public key/r4zInvalid project in DSN (%r)) isinstancerdict__dict__rrCschemerhostnamehostportusername public_keypassword secret_keyrcrsplitintpop project_idr TypeErrorjoin)rrHpartsrcs rJ__init__z Dsn.__init__)sT eS ! 0DM U$ <<0 005<<?@ @ll >> !+, ,NN ::  w.63<"DI DI~~-. .....zz  a( Q!#dhhj/2DOHHTNS( I& Q6%**:JAB9OOP P Qs /'E00/Fct|j}|j|jfdvr|d|j}|S)zThe netloc part of a DSN.))rr)rrrO)rrrrrvs rJnetlocz Dsn.netlocMs6YY KK #+I I *B rLNc t|j|j|j|j|j |j |S)z*Returns the auth info object for this dsn.)rrrcrrrclient)Authrrrcrrr)rrs rJto_authz Dsn.to_authVs>;;  rLc|jd|j|jxrd|jzxsdd|j|j|j S)N://@r)rrrrrcrrs rJ__str__z Dsn.__str__csN KK OO OO 5doo 5 ; ; KK II OO   rLr) rrrrrpropertyrrrrrLrJrr&s)")H    rLrcDeZdZdZ ddZej fdZdZy)rz,Helper object that represents the auth info.Nc t||_||_||_||_||_||_||_||_yr)rrrcrrrversionr) rrrrrrrrrcs rJrz Auth.__init__rs<   $$$  rLc |jd|j|jd|jd|jd S)z'Returns the API url for storing events.rzapi/r)rrrcrrH)rtypes rJ get_api_urlzAuth.get_api_urls1 KK II II OO JJ   rLcd|jfd|jfg}|j|jd|jf|j|jd|jfddj d|DzS)z!Returns the auth header a string. sentry_keysentry_version sentry_client sentry_secretzSentry z, c30K|]\}}|d|yw)=Nr).0keyrHs rJ z!Auth.to_header..s$Qb UU%;bs)rrrappendrrrs rJ to_headerzAuth.to_headersyT__-0@$,,/O P ;; " II 4 5 ?? & II8 9499$Qb$QQQQrL)NNr) rrrrrrENVELOPEr rrrLrJrros.6 . " "  RrLrc:t|ddxs t|ddS)Nrrgetattr)clss rJ get_type_namers 3 - Oj$1OOrLc*t|dd}|dvr|Sy)Nr)Nbuiltins __builtins__r)rmods rJget_type_moduler"s! #|T *C 44 rLc |jd}|jdry dD]} |j|ryy#ttf$rY+wxYw#t $rY8wxYw)Nrz sentry_sdk.T)__traceback_hide____tracebackhide__F) f_globals startswithrKeyErrorf_locals Exception)framer! flag_names rJshould_hide_framer-s ooj) >>- ( ) ?  ~~i()?  H %      s >AAA AAc#fK|}|)t|js||j}|(yywr)r-tb_frametb_next)rtb_s rJ iter_stacksr2s1 C / .Ikk /s,11cd}d}|0t|dr$ |j|}||j }| t j |}|sgdgfStd||z }t|dz|zt|} |||D cgc]} t| jd| } } t||jd|} ||dz| D cgc]} t| jd| } } | | | fS#ttf$rd}YwxYw#ttf$rgdgfcYSwxYwcc} wcc} w#t$rgdgfcYSwxYw)N get_sourcerr4z ) max_length)hasattrr5 ImportErrorrq splitlines linecachegetlinesrpmaxminlen strip_stringrn IndexError)filenamelinenor6loadermodule context_linessource source_str lower_bound upper_boundline pre_context context_line post_contexts rJget_lines_from_filerNsM F gfl; **62J  !**,F ~ ''1F 4|a-/0Kfqj=0#f+>K {62 2 F+ C2  $F6N$8$8$@ZX  k: : F+ C:  L,667W% J ! tR<    4|sRDDD;#D1++D;#D69D;DDD.-D.1 D;;E  E c |jj} |jd} |jd}||r|dz }t |||||SgdgfS#t$rd}YKwxYw#t$rgdgfcYSwxYw#t$rd}YPwxYw)Nr __loader__r4)rCrD)f_code co_filenamer*r&rN)r+ tb_linenomax_value_lengthabs_pathrDrCrBs rJget_source_contextrVs <<++,.Q" f.vf   tR<#  4| s3AA'A; A$#A$'A87A8; B B cN t|S#t$rt|cYSwxYwr)rCr* safe_reprrs rJsafe_strrYs+ 5z   s $$c8 t|S#t$rYywxYw)Nz )reprr*rs rJrXrXs#E{ s c|r|s|S |jdr|dd}|jddd}||k(rtjj |St j |j}|s|S|j|jtjddddjtjS#t$r|cYSwxYw)Nz.pycrrr4r) rsplitrbrcbasenameremodules__file__rseplstripr*)rDrU base_modulebase_module_paths rJfilename_for_modulerf#s 6   V $}Hll3*1- & 77##H- -;;{3<<O~~.55bffa@CQGKRR FF   sAC  C 8AC CCc t|dd}|sd}d}n,|jj}|jj} |jd} | |j } |rtjj|nd} t| |xsd| |xsd| |d} |rt|||\| d<| d<| d<|r'dd l m } | t|jd | | d <| S#t $rd} YwxYw#t $rd} YwxYw) NrQrz )rArUfunctionrDrBrKrLrMr) serializeT)is_vars custom_reprvars)rrQrRco_namer&r*f_linenorbrcabspathrfrVsentry_sdk.serializerrirr)) r+rSinclude_local_variablesinclude_source_contextrTrkrQrUrhrD os_abs_pathrris rJserialize_framert;s+UHd +F <<++<<'',NN 3;bggooh/ (9AT+   BDV 9.E A=2n-r./A3  $K 6  I?   s$C$ #C5$ C21C25 DDcd}g}tj}|8t|s|jt |||||j }|8|j d|iS)NT)rqrrrTframes)re _getframer-rrtf_backreverse)rqrrrTr%rvr6s rJcurrent_stacktracerzosp  F A - # MM,C+A%5   HH - NN f rLct|ddS)Nerrnor) exc_values rJ get_errnor~s 9gt ,,rLctt|ddxst|ddxs t|}t|dd}t|tr,t |dkDr|ddj d|Dzz }|S)Nmessagerdetail __notes__r c3BK|]}t|ts|ywr)rrC)rnotes rJrz$get_error_message..s#TUTjs>SDUs)rYrrlistr>r)r}rnotess rJget_error_messagers} 9b)  9h +  I G I{D 1E%3u:>4$))#TU#TTTT NrLc i} |r|jnddd| d<||| dd<| t|} nd} | 5| djdijdijd | ||| dd <|d k(} | s||| dd <d | dd<| rd| dvrd| dd<tduxrt |t} | rd| dd<t || d<t || d<t|| d<| d} d}t}d}n |d} |d}|d}|jd}tt|ttdzDcgc]*\}}t|j|j | |||,}}}t#|tkDrt%j&d| d<| S|r|s|}n t)|||}d|i| d<| Scc}}w)z Creates a dict that goes into the events `exception.values` list and is ingestible by Sentry. See the Exception Interface documentation for more details: https://develop.sentry.dev/sdk/event-payloads/exception/ genericTr handled mechanismN exception_idmetar|numberrFr parent_idchainedr is_exception_grouprDrHrqrrrTrkr4)rSrqrrrTrkr stacktracerv)copyr~ setdefaultrrr"rrrr~zipr2rangeMAX_STACK_FRAMESrtr/rSr>rremoved_because_over_size_limitmerge_stack_frames)exc_typer}rclient_optionsrrrrF full_stackexception_valuer|is_root_exceptionrrqrrrTrk_rv new_framess rJ!single_exception_from_error_tuplerse$O% I$+OK 7C $^4)$  $//;FF R *Xu % 17 $X.$) !64= $[1/8 $V,V?;+GG/8 $V,+47J%==A $%9: / 9OH+H5OF0;OG"&!%3 "01J"K!/0H!I)*<=$((7 R%0@10D*EF GEB  KKll$;#9-#  G  6{%%)7(V(V)  %  J+FJOJ)1:(> % C s/G__suppress_context__c#hK|\}}}g}t}||t||vr|||f|j||jt||jr |j }n |j }|yt|}|}t|dd}||t||vryyyyyyw)N __traceback__) setidraddr __cause__ __context__r r)rrr}rseen_exceptionsseen_exception_idscauses rJwalk_exception_chainr s"*)R U  %9 %77Ir) )  " "9 -  " "2i= 1--!++!--}E{HI6B)  %9 %77& !7& !s B)B2,B2c#K|ywrrrs rJrr-s sc t||||||||| } | g} |}|dz }t|dxr |j} | rj|xrt|dxr|jdu} | r|j} t t | | t | dd|||d|\}}| j|ni|xrt|dxr|jdu}|rG|j}t t ||t |dd|||d|\}}| j||xr t|d }|r\t|jD]D\}}t t ||t |dd||||d |z| \}}| j|F|| fS) z Creates the list of exceptions. This can include chained exceptions and exceptions from an ExceptionGroup. See the Exception Interface documentation for more details: https://develop.sentry.dev/sdk/event-payloads/exception/ ) rr}rrrrrrFrr4rrNr)rr}rrrrrFrr exceptionszexceptions[%s]) rr7rrexceptions_from_errorr rextendr enumerater)rr}rrrrrrFrparentrshould_supress_contextexception_has_causerchild_exceptionsexception_has_contentcontextridxes rJrr2s(/ %! FJIAL  12Uy7U7U  0 ;/ 0##4/  ''E/De5/48-#)"% 0 ,\+   . /  2 =1 2%%T1  !++G/Dg!7OT:-#)$% 0 ,\+   . /#Gwy,'G 4 45FC/Da1ot4-#)#'#-% 0 ,\+   . /6 * %%rLc |\}}}tduxrt|t}|rt|||||dd|\}} n6g} t|D]&\}}}| j t ||||||(| j | S)Nr)rr}rrrrrr)rr}rrrr)rrrrrrry) rrrrrr}rrrrs rJexceptions_from_error_tuplers'Hi+47J%=/)!  J ';H'E #Hi   1%'#1')  (F rLcT t|S#t$rt|ddcYSwxYw)Nr4r)rCUnicodeDecodeErrorr[rs rJ to_stringrs1!5z !E{1R  !s ''c#Kd|vr|dd|vr)|djdxsdD]}d|vs|dd|vr;|djdxsdD]}t|tsd|vs|d!yyw)Nrthreadsvaluesr exception)r~rr)eventthreadrs rJiter_event_stacktracesrsuL!!EI&**84::Fv%\**;e{+//9?R?I)T*|y/H --@s/A;8A;+A;0 A;c#Kt|D]@}t|tr|jxsi}|j dxsdD]}|Byw)Nrvr)rrrrHr~)rrr+s rJiter_event_framesrsO,U3 j. 1#))/RJ^^H-33EK4 4sAAct|D]@}t|tr|jxsi}t |j d|||B|S)Nrv)in_app_excludein_app_include project_root)rrrrHset_in_app_in_framesr~)rrrrrs rJ handle_in_apprsO,U3 j. 1#))/RJ NN8 $))%  4 LrLc|sy|D]}|jd}||jd}t||rd|d<:t||rd|d<L|jd}|`t|rd|d<qt||s~d|d<|S)Nin_apprDTFrU)r~_module_in_list_is_external_source_is_in_project_root)rvrrrr+current_in_apprDrUs rJrrs 8,  % 8$ 6> 2"E(O  6> 2#E(O 99Z(    x (#E(O  x 6"E(O ;> MrLcft|trt|dk(r|\}}}npt|trIt |dd}|t |}|}nCt j\}}}||ur'd}|}t |}ntdt |z|||f}trtt|}|S)Nrz,Expected Exception object to report, got %s!) rtupler> BaseExceptionrr rerrrrr.)rrr}rrs rJrrs%CJ!O"')R E= ) UOT 2 >E{HI&)lln #Hi%! ;G$u+UVV)R(H* OrLc|Dchc]}|d|d|d|df}}|Dcgc]}|d|d|d|df|vr|}}|j||r|jdtnd}||t||z d}|Scc}wcc}w)zV Add the missing frames from full_stack to frames and return the merged list. rUrLrBrhmax_stack_framesN)rr~rr>)rvrrr+ frame_ids stackframerrs rJrr9sE *  . ! (O *   % $J z " ~ & x z "     $ f  -/GH  #J2B B DE A s BBct|}t|}|r-|jdtrt |d|dd}nd}ddt ||||id|fS) Nadd_full_stackrqrT)rqrTrvrr)levelr)rrr~rrzr)rrrhintrs rJevent_from_exceptionras #8,H #H -D.,,-=?UV'$23L$M+,>?    5ni    rLcT|y|sy|D]}||k(s|j|dzsyy)NFrTr')nameitemsitems rJrrs8 |  4<4??4#:6 rLc<|ytjd|du}|S)NFz [\\/](?:dist|site)-packages[\\/]research)rUexternal_sources rJrrs0 5x@L rLc2||y|j|ryy)NFTr)rUrs rJrrs&</<( rLc\|jdd|dz jdd}|dzS)zd Truncate a UTF-8-encodable string to the last full codepoint so that it fits in max_bytes. rRNrignore)errors...)rUro)string max_bytes truncateds rJ_truncate_by_bytesrs8  g&Q7>>wx>XI u rLcb t|jdS#ttf$rYywxYw)NrR)r>rUUnicodeEncodeErrorrrs rJ_get_size_in_bytesrs35<<())  2 3s ..c|s|S|t}t|}t|}|||kDr t||}n|||kDr |d|dz dz}n|St ||xs|dd|dz |ggdS)Nrrz!limitx)r>rem)rHmetadata)rrr>rr)rHr6 byte_size text_sizetruncated_values rJr?r?s  - "5)IE IZ!7,UJ?  9z#9 0*q.1E9 ) sJNJ?@  rLcPd}tjd|zdztjtjz} |j |j d}t tt|jddd}|S#tttf$rYywxYw)z Parses a version string into a tuple of integers. This uses the parsing loging from PEP 440: https://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions a # noqa: N806 v? (?: (?:(?P[0-9]+)!)? # epoch (?P[0-9]+(?:\.[0-9]+)*) # release segment (?P
                                          # pre-release
                [-_\.]?
                (?P(a|b|c|rc|alpha|beta|pre|preview))
                [-_\.]?
                (?P[0-9]+)?
            )?
            (?P                                         # post release
                (?:-(?P[0-9]+))
                |
                (?:
                    [-_\.]?
                    (?Ppost|rev|r)
                    [-_\.]?
                    (?P[0-9]+)?
                )
            )?
            (?P                                          # dev release
                [-_\.]?
                (?Pdev)
                [-_\.]?
                (?P[0-9]+)?
            )?
        )
        (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
    z^\s*z\s*$rrNr)
rcompileVERBOSE
IGNORECASEmatch	groupdictrmaprr^rrr)rVERSION_PATTERNpatternr
release_tuples     rJ
parse_versionrsO>jj/!G+


R]]"G
--(224Y?c#w}}S'9"1'=>?

z>2sA
BB%$B%c	ddl}ddlm}tt	j
d|jddDcgc]
}t|c}}|ddr#tjdk\r|d	k\s	|d
dryy
		ddl}ddlm
}t|j}|tj!dy|dr|dkry
ycc}w#t$rYWwxYw#t$rYywxYw)z
    Returns whether gevent/eventlet have patched the stdlib in a way where thread locals are now more "correct" than contextvars.
    rN)is_object_patchedz	a|b|rc|\.r]	threadinglocalrr)	contextvars
ContextVarFT)is_monkey_patchedzYInternal error in Sentry SDK: Could not parse Greenlet version from greenlet.__version__.r)rr4)gevent
gevent.monkeyrrrr^__version__rreversion_infor8greenleteventlet.patcherrrrr)rrpart
version_tuplerrgreenlet_versions       rJ_is_contextvars_brokenr 	s

3#%88L&:L:L#Mbq#QR#Q4SY#QR

['2!!V+
0H%m\B3&
6()=)=>#LLk
X&+;f+DM
S$

"

s:4CC1C=6C4
CC	CC	C#"C#c Gfdd}|S)Nc.eZdZdfd	ZddZdZdZy)1_make_threadlocal_contextvars..ContextVarNcR||_||_|_|_yr)_name_default_local_original_local)rrdefaultrs   rJrz:_make_threadlocal_contextvars..ContextVar.__init__Bs$DJ#DM'DK#(7D rLcLt|jd|xs|jS)NrH)rr'r&)rr)s  rJr~z5_make_threadlocal_contextvars..ContextVar.getIs4;;1IDMMJJrLcttjd}|j}t	|j
||||j_|S)N@)rCrandomgetrandbitsr~setattrr(r'rH)rrHtokenoriginal_values    rJrz5_make_threadlocal_contextvars..ContextVar.setMsE**2./E!XXZND((%@ %DKKLrLc|t|j||j_|jj|=yr)rr(r'rHr)rr0s  rJresetz7_make_threadlocal_contextvars..ContextVar.resetUs/ '(<()_partialmethod__partialmethod__)zpartialmethod(
func_qualnameprefixsuffixpartial_methods     rJqualname_from_functionrCs6M
MM$$MM""MM
	



NFF$ WTYY
%C3yy!'7>
'%tC
nm4=NFF!&&Dt^$))
	z	"


 4&:doos+K OOc1MAM.7
s;A	AAct|Sr)rC)r>s rJtransaction_from_functionrEs
!$''rLdisable_capture_eventceZdZdZy)ServerlessTimeoutWarningz>Raised when a serverless method is about to reach its timeout.NrrrLrJrHrHsHrLrHc,eZdZdZ	ddZdZdZdZy)
TimeoutThreadzCreates a Thread which runs (sleeps) for a time duration equal to
    waiting_time and raises a custom ServerlessTimeout exception.
    Nctjj|||_||_||_||_tj|_yr)	rThreadrwaiting_timeconfigured_timeoutisolation_scope
current_scoper-_stop_event)rrMrNrOrPs     rJrzTimeoutThread.__init__sG	!!$'("4.*$??,rLc8|jjyr)rQrrs rJstopzTimeoutThread.stopsrLctj}tj}t	||j
ddd\}}tj|||S)NrFr)rr)r)rerrrroptions
capture_event)rrrrrs     rJ_capture_exceptionz TimeoutThread._capture_exceptionsR<<>&&(*!>>*u=
t
	  T2rLc|jj|j|jjryt	|j
}||j
kr|dz}|j{|jotjj|j5tjj|j5	tdj|tdj|#t$rt|j!YnwxYw	dddn#1swYnxYwddd^#1swYgxYw)Nr4zZWARNING : Function is expected to get timed out. Configured timeout duration = {} seconds.)rQwaitrMis_setrrNrOrPrscopeuse_isolation_scope	use_scoperHrr*reraiserW)rinteger_configured_timeouts  rJrunzTimeoutThread.runs.	
d//0""$%()@)@%A"&(?(??)Ca)G&+0B0B0N!!55d6J6JK%%//0B0BC<6x :'hoo*

	
%<!8!8!:;<;DCCLKKsB+*ED:DD-*D:,D--D:1	E:E	?EENN)rrrrrrSrWr`rrLrJrJrJs"
UY-
rLrJcd}	|jd}tj|}|jd}|S#t$r1}t
j
dj||Yd}~|Sd}~wwxYw)zO
    Convert a string to base64, via UTF-8. Returns None on invalid input.
    NUTF-8z"Unable to encode {orig} to base64:)orig)rUbase64	b64encoderor*rwarningr)original
base64_string
utf8_bytesbase64_byteserrs     rJ	to_base64rms
MX__W-
''
3$++G4
X;BBBQSVWWXs7=	A7&A22A7c&d}	tj|}|sJ|jd}tj|}|jd}|S#t$r1}tjdj||Yd}~|Sd}~wwxYw)zQ
    Convert a string from base64, via UTF-8. Returns None on invalid input.
    Nrcz#Unable to decode {b64} from base64:)b64)
BASE64_ALPHABETrrUre	b64decoderor*rrgr)riutf8_stringonly_valid_charsrkrjrls      rJfrom_base64rt!s
K

*00?$++G4%%l3
 ''0
188]8KS	
	

sAA	B&BB
Components)rrrcqueryfragmentc	t|}t|jd}|rL|jj	d}t|dkDrtdtd|d}n|j}n|j}|r(tt|Dcic]	}|tc}}	n|j}	t|j||	|j|j}
|r|
St|
Scc}w)zL
    Removes the authority and query parameter values from a given URL.
    T)keep_blank_valuesrr4rOrrrrvrcrw)rrrvrr^r>rrr
rurrcrwr)urlremove_authorityremove_query_valuesr^
parsed_urlquery_paramsnetloc_partsrrquery_string
componentss           rJsanitize_urlr:s
#JJ,,EL!((..s3|q ))R F &&F""N#s55NO
"''  
__$$J
*%%!Os
C0	ParsedUrlr{rvrwc	t|d|d}tt|j|jd|j
d}t
||j|jS)z
    Splits a URL into a url (including path), query and fragment. If sanitize is True, the query
    parameters will be sanitized to remove sensitive data. The autority (username and password)
    in the URL will always be removed.
    T)r|r}r^rrzr)	rrrurrrcrrvrw)r{sanitizer~base_urls    rJ	parse_urlrisndJ$$$$	
H$$rLc	4t|ttfrtj|r1t
j
dj||t|yt|}|dks|dkDr't
j
dj||yy)	z
    Checks the given sample rate to make sure it is valid type and value (a
    boolean or a number between 0 and 1, inclusive).
    z|{source} Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got {rate} of type {type}.)rFrater	Frr4zW{source} Given sample rate is invalid. Sample rate must be between 0 and 1. Got {rate}.)rFrT)
rr
rmathisnanrrgrr	float)rrFs  rJis_valid_sample_ratersdT7O,

40@
K
R
RDtDz
R
	

;Dax4!8ellD
m
	

rLcj|y|D]+}|s
|ddk7r|dz
}tj||}|s+yy)NFr$Tr)r
regex_listsubstring_matchingitem_matchermatcheds     rJmatch_regex_listrsI"!l2&6#&=CL))L$/
#rLc|duxrL|jduxr<|jjduxr"|jjj|vS)zB
    Determines whether the given URL matches the Sentry DSN.
    N)	transport
parsed_dsnr)rr{s  rJ
is_sentry_urlrs^	d	6D(	6''t3	6
''..#5	rLc#K	ddlm}t}|jD]_}|jj	dd}|"t|}|j:||vs?||jf|j|ay#t$rM	ddl	}n#t$rYYywxYw|jD]%}t|j|jf'YywxYww)Nr)rName)	importlibrr
distributionsr~_normalize_module_namerrr8
pkg_resourcesworking_setr)ryieldeddistrnormalized_namerinfos       rJ_generate_installed_modulesrsA&%**,D==$$VT2D
"8"><<+w0N)4<<77KK0-A	 		"--D(2DLL@@.AseC ABBB##BC 	CBC	B#C C "B##7CC CC c"|jSr)rDrs rJrrs::<rLc0tjdd|S)Nz[-_.]+r)rsubrs rJ1_replace_hyphens_dots_and_underscores_with_dashesrs66)S$''rLc@tttatSr)_installed_modulesrrrrLrJ_get_installed_modulesrs!!"="?@rLctt|}tjDcic]\}}t||}}}|j	|}|yt|Scc}}wr)rrrrr~r)packagenormalized_packagerDvinstalled_packagesrs      rJpackage_versionrs|/9'B017799IFA	:&A1D9!$$%78G!!sA(cL|J|j|ur|j||r)rwith_traceback)tprHrs   rJr^r^s2"$""2&&
KrLcy)z.No-op function for ensure_integration_enabled.Nr)_a_ks  rJ_no_opr
s	rLcyrr)roriginal_functions  rJensure_integration_enabledrs	rLcyrr)rs rJrrs
	rLc\trttttffd}|S)a
    Ensures a given integration is enabled prior to calling a Sentry-patched function.

    The function takes as its parameters the integration that must be enabled and the original
    function that the SDK is patching. The function returns a function that takes the
    decorated (Sentry-patched) function as its parameter, and returns a function that, when
    called, checks whether the given integration is enabled. If the integration is enabled, the
    function calls the decorated, Sentry-patched function. If the integration is not enabled,
    the original function is called.

    The function also takes care of preserving the original function's signature and docstring.

    Example usage:

    ```python
    @ensure_integration_enabled(MyIntegration, my_function)
    def patch_my_function():
        with sentry_sdk.start_transaction(...):
            return my_function()
    ```
    cjdfd}turt|St|S)Ncjtjj|i|S|i|Sr)rrget_integration)argskwargsrrsentry_patched_functions  rJrunnerz;ensure_integration_enabled..patcher..runnerCs=$$&66{CK($9&99*D;F;;rL)rzP.argsrzP.kwargs)rr	)rrrrs` rJpatcherz+ensure_integration_enabled..patcherAs8	<&1501&99'u&'//rL)rrrr2r3)rrrs`` rJrr"s,4!!Q$1BC0NrLc*tjSr)timeperf_counter_nsrrLrJnanosecond_timerTs##%%rLcBttjdzS)NgeA)rrperf_counterrrLrJrrZs4$$&,--rLc*tjSr)rrrrLrJnowr_srL)get_hubis_module_patchedcyrrrrLrJget_gevent_hubrjsrLcyNFr)mod_names rJrrnsrLc2tdxstdS)Nr_threadrrrLrJ	is_geventrts[)I->y-IIrLc| 	|j}|j}|||fS	trt	}|	|j
dfS	t
j}|j}|j}|||fS		t
j}|j}|j}|||fS	y#t$rYwxYw#t$rYwxYw#t$rY^wxYw#t$rYywxYw)zK
    Try to get the id of the current thread, with various fall backs.
    Nra)	identrrrrthread_identrcurrent_threadmain_thread)r	thread_idthread_name
gevent_hubs    rJget_current_thread_metarys0	I ++K$ +--%{#%
!
!..44

))+LL	kk k))!
&&(LL	kk k))!G		"




	
sFB1
C	1C=1C1	B=<B=	CC	CC	C*)C*cL|tk(rt|dr|jdvryy)Ncode)rNFT)
SystemExitr7r)rrHs  rJshould_be_treated_as_errorrs$	ZGE62uzzY7NrLTcp	t||r|S		||S#t$rYwxYw#t$rYywxYw)z
    Attempt to convert from an unknown type to a specific type, using the
    given function. Return None if the conversion fails, i.e. if the function
    raises an exception.
    N)rrr*)convert_funcrHs  rJtry_convertrsR
e\*L+
E""	

s
)	&&	55cfd	|}tj|tS#t$rt|cYSwxYw)z&Safely serialize to a readable string.ct|rH	t|dd}t|dd}t|dd}|r
|r|d|}n|r
|r|d|}n|}d|dSt|tr*|jDcic]\}}|	|c}}St|ttfr|Dcgc]
}	|c}St|d	r`	t|jDcic]\}}|jd
s	|	|!}}}dt|jd|dS|S#t$rdt|jdcYSwxYwcc}}wcc}wcc}}w#t$rt|cYSwxYw)
Nrrr	anonymousrz
z
.serialize_itemsD>
; |T:"4>tZ=h#)(!H: 6I#)(!D6 2I $I#I;a00d
#59ZZ\B\TQA~a((\BB
tUm
,/34t!N1%t44
T:
&
"!%T
 0 0 2 21<<,~a(( 2
4:../qq99K#
;#DJ$7$7#8::
;C4
"Dz!
"sBAD)8E)EE"$$EE")"E
EE""E98E9)r))rSrTrCr*)rV
serializedrs  @rJsafe_serializersB!F#D)
zz*c224ys"+AAcl|yt|jddxs|djddS)NFenable_logs_experimentsrGr~rUs rJhas_logs_enabledrs?M5)	=>"&&}e<rLcV|y|jdxs|djdS)Nbefore_send_logrr~rs rJget_before_send_logrs6;;()W^-D-H-H.rLc>|yt|jddS)NFenable_metricsTrrs rJhas_metrics_enabledrs!,d344rLcV|y|jdxs|djdS)Nbefore_send_metricrrrs rJget_before_send_metricr
s6;;+,0G0K0K1rLr)NNN)NTTNN)TTN)NNNNNN)NNrrNNra)TTF)Tr)rerSr:loggingrrbr-rrgrerrcollectionsrrrdecimalr	functoolsrrr	numbersr
urllib.parserrr
rrrrr8rsentry_sdk._compatrsentry_sdk.constsrrrrsentry_sdk._typesrrrtypingrtypesrrrrrrr r!r"r#r$r%r&r'r(r)r*r+
gevent.hubr,r-r.r/r0r1r2r3r	getLoggerrrrrp	frozensetrErFrrKrWrurrrrrrrrrrrrrrrrr"r-r2rNrVrYrXrfrtrzr~rrr7r*HAS_CHAINED_EXCEPTIONSrrrrrrrrrrrrrrrrr?rr r5r8HAS_REAL_CONTEXTVARSrCONTEXTVARS_ERROR_MESSAGErCrErFrHrLrJrmrtrurrrrrrrrrrrr^rrrrrrrrrrrrrrrrrrr
rrLrJrsE
	
	
"'33KK+
#SR .&CC#AA	q!
		.	/"**12BCBC"'
+ T80!H78'
	H+

5j)+,	""Z"F
F
R.R.RbP
&+b8 4 
1j!6-
.dN!,BC7@d&R	)X!.
 $N:%T<		:1h1hB#7L$4#5 j)X(
##:;	y	C
I$$C
L",&W
X
)&X
{$@A	8>
 
A:
(""	
-`&.


0/J
0fA&+\5A@`:

s$$K8L8LLLL