c.zddlZddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z mZddlmZer&ddlmZdd lmZdd lmZdd lmZdd lmZdd lmZmZ ddlmZn#e$r ddlmZYnwxYwejdejddzejdZ GddeZ!dZ"ddZ#dZ$dZ%dS)N)Hub) Integration)add_global_event_processor)EnvironHeaders)capture_internal_exceptions safe_repr)MYPY)Any)Callable)Dict)Optional)List)EventHint)HTTPConnectionz%s.%s.%s)nameversionbuildc(eZdZdZedZdS)StdlibIntegrationstdlibc^tttd}dS)Nctjt9|di}t |t rd|vr t|d<|S)Ncontextsruntime)rcurrentget_integrationr setdefault isinstancedict_RUNTIME_CONTEXT)eventhintrs ~/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/sentry_sdk/integrations/stdlib.pyadd_python_runtime_contextz@StdlibIntegration.setup_once..add_python_runtime_context.s[{**+<==I ++J;;h--;)82K2K*:HY'L)_install_httplib_install_subprocessr)r&s r% setup_oncezStdlibIntegration.setup_once(s@  #   $ #   r'N)__name__ __module__ __qualname__ identifier staticmethodr*r'r%rr%s2J  \   r'rc~tjtjfd}fd}|t_|t_dS)Nctj}|t|||g|Ri|S|j}|j}|j}|} | ds|dkrdpdd|||krd|zpd|} |d|d|  } | d || d | |||g|Ri|} | D]\} } | | | | |_ | S) N)zhttp://zhttps://ihttpshttpz://z:%s op descriptionmethodurl) rrrrhostport default_port startswith start_spanset_dataiter_trace_propagation_headers putheader_sentrysdk_span)selfr:r;argskwargshubr<r=r>real_urlspanrvkeyvaluereal_putrequests r% putrequestz$_install_httplib..putrequest>sgk   0 1 1 9"?4FtFFFvFF Fyy( ""#:;; #/9699 $5;; H~~5Q~RR h''' eX&&& _T63 @ @ @ @ @ @<<>> ' 'JC NN3 & & & &# r'c@t|dd}| |g|Ri|S|g|Ri|}|d|j|t |j|d|j||S)NrD status_codereason)getattrrAstatusset_http_statusintrRfinish)rErFrGrJrKreal_getresponses r% getresponsez%_install_httplib..getresponse_st.55 <##D:4:::6:: :  d 4T 4 4 4V 4 4 mRY/// S^^,,, h ***  r')rrOrY)rOrYrXrNs @@r%r(r(9s`$/O%1B !+N!,Nr'c||vr||}| ||}||||<nD|t|kr||}| ||}||||<n|o |d}||||<|S)a? given (*args, **kwargs) of a function call, retrieve (and optionally set a default for) an argument by either name or position. This is useful for wrapping functions with complex type signatures and extracting a few arguments without needing to redefine that function's entire type signature. N)len)rFrGrpositionsetdefault_callbackrKs r%_init_argumentr^ss v~~ D\  *$$R((B >F4L CII   (^  *$$R((B >DN >%8%8%>%> >F4L Ir'ctjjfd}|tj_tjjfd}|tj_tjjfd}|tj_dS)Nctj}|t  |g|Ri|St |}t ||ddpg}t ||dd}d}t |ttfrat|dkrNt5d tt|}dddn #1swxYwY|t|}d}|D]I\}} |t ||ddd }| |d |d d z<J|d |5} |r| d| |g|Ri|} | d|j| cdddS#1swxYwYdS)NrFrcwd dr6env c8t|p tjSN)r!osenviron)xs r%zH_install_subprocess..sentry_patched_popen_init..sao2:AVAVr' SUBPROCESS_-_ subprocessr7zsubprocess.cwdsubprocess.pid)rrrrlistr^r tupler[rjoinmapstrrrBupperreplacer@rAset_tagpid) rEakwrHrFrar9rdkvrJrKold_popen_inits r%sentry_patched_popen_initz6_install_subprocess..sentry_patched_popen_initslk   0 1 1 9!>$1111b11 1 GGaVQ//52QE1-- dT5M * * 7s4yy3,.. 7 7!hhs3~~66  7 7 7 7 7 7 7 7 7 7 7 7 7 7 7  #D//K6688 A ADAq{$QE27V7VWW?@C  1 1#s ; ;; < < ^^|^ E E  5 .444/q///B//B LL)48 4 4 4                  s%()CC!$C!0AF>>GGctj}|t |g|Ri|S|d5}|d|j|g|Ri|cdddS#1swxYwYdS)Nzsubprocess.waitr8rprrrrr@rxry)rErzr{rHrJold_popen_waits r%sentry_patched_popen_waitz6_install_subprocess..sentry_patched_popen_waitsk   0 1 1 9!>$1111b11 1 ^^0^ 1 1 2T LL)48 4 4 4!>$1111b11 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 'A>>BBctj}|t |g|Ri|S|d5}|d|j|g|Ri|cdddS#1swxYwYdS)Nzsubprocess.communicaterrpr)rErzr{rHrJold_popen_communicates r% sentry_patched_popen_communicatez=_install_subprocess..sentry_patched_popen_communicatesk   0 1 1 9((8888R88 8 ^^7^ 8 8 9D LL)48 4 4 4((8888R88 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9r)roPopen__init__wait communicate)rrrrr~rs @@@r%r)r)s%.N+++++Z!:J%*N 2 2 2 2 26J&,8 9 9 9 9 9$DJ   r'c8ttjdS)Nrl)prefix)rrhrir0r'r%"get_subprocess_traceparent_headersrs "*] ; ; ;;r'rg)&rhrosysplatformsentry_sdk.hubrsentry_sdk.integrationsrsentry_sdk.scopersentry_sdk.tracingrsentry_sdk.utilsrrsentry_sdk._typesr typingr r r r rrrhttplibr ImportError http.clientpython_implementation version_inforr"rr(r^r)rr0r'r%rs  //////777777------CCCCCCCC"""""".--------+&&&&&&&+++********+ +H * , ,S-bqb12 [ (7-7-7-t>ODODODd<<<<