
    gh>                     ,   S SK r S SKrS SKJr  S SKrS SKJr  S SKJr  S SK	J
r
JrJrJr  S SKJr  \(       a2  S SKJr  S SKJr  S S	KJr  S S
KJr  S SKJr  \" S5      r\" S\S\4   S9rSrSrSr " S S\5      rS rS r\" \5      S 5       rS rS r g)    N)wraps)Integration)ignore_logger)capture_internal_exceptionsensure_integration_enabledevent_from_exceptionreraise)TYPE_CHECKING)Any)Iterator)TypeVar)Callable)ExcInfoTF.)boundz_wrapped_{}_z_inspect_{}_sentry_used_c                   (    \ rS rSrSr\S 5       rSrg)BeamIntegration"   beamc            	         ^^ SSK Jn Jn  [        S5        [        S5        / SQmT H,  n[	        U [
        R                  U5      [        X5      5        M.     UR                  mUU4S jnX1l        g )Nr   )DoFnParDorootzbundle_processor.create)processstart_bundlefinish_bundlesetupc                   > [        U SS5      (       d  T H  n[        X5      (       d  M  [        R                  U5      n[        X5      n[        U[        R                  U5      5      n[        U[
        S5      (       a  Ml  [        U[
        S5      (       a  M  [        XU5        [        X[        U5      5        M     SU l        T	" X/UQ70 UD6  g )N_sentry_is_patchedFT)	getattrhasattrWRAPPED_FUNCformatINSPECT_FUNC	USED_FUNCsetattr_wrap_task_callr!   )
selffnargskwargs	func_namewrapped_funcprocess_funcinspect_funcfunction_patchesold_inits
           _/home/kali/devsecops-assessor/venv/lib/python3.13/site-packages/sentry_sdk/integrations/beam.pysentry_init_pardo5BeamIntegration.setup_once.<locals>.sentry_init_pardo7   s     4!5u==!1I"211 #/#6#6y#AL $+2#9L#*2|/B/B9/M#NL"<EBB7$iL L  ,?|/LM "2" +/'T///    )	apache_beam.transforms.corer   r   r   r(   r&   r%   _wrap_inspect_call__init__)r   r   r.   r5   r2   r3   s       @@r4   
setup_onceBeamIntegration.setup_once%   sa     	<f/0P)I##I."43 * >>	00 +r7   )r!   N)__name__
__module____qualname____firstlineno__
identifierstaticmethodr;   __static_attributes__ r7   r4   r   r   "   s    J)+ )+r7   r   c                 Z   ^ [        U T5      (       d  g U4S jn[        U[        S5        U$ )Nc                   > [         R                  T5      n[        X5      (       a  [        X5      nO.[        U T5      n[	        U T[        U5      5        [	        XU5         SSKJn  U" U5      $ ! [         a    SSK	J
n  U" U5      s $ f = f)z7
Inspect function overrides the way Beam gets argspec.
r   )get_function_args_defaults)getfullargspec)r$   r%   r#   r"   r(   r)   r8   rG   ImportError apache_beam.typehints.decoratorsrH   )r*   r/   r0   rG   rH   r.   s        r4   _inspect$_wrap_inspect_call.<locals>._inspectX   s    
 $**954&&"46L"43LD)_\%BCD5	0N-l;; 	0G!,//	0s   "A0 0B
BT)r#   r(   r'   )clsr.   rK   s    ` r4   r9   r9   R   s-     3	""00 Hi&Or7   c                 R   ^  [        T 5      U 4S j5       n[        U[        S5        U$ )z4
Wrap task call with a try catch to get exceptions.
c                     >  T" U 0 UD6n[        W[        R                  5      (       d  U$ [        U5      $ ! [          a    [        5          NBf = f)N)	Exceptionraise_exception
isinstancetypesGeneratorType_wrap_generator_call)r,   r-   genfuncs      r4   _inner_wrap_task_call.<locals>._innerz   sS    	''C #u2233J#C((  		s   7 AAT)r   r(   r'   )rW   rX   s   ` r4   r)   r)   t   s.     4[	) 	) FIt$Mr7   c                     [         R                  " 5       n[        U UR                  SSS.S9u  p#[         R                  " X#S9  g)z 
Send Beam exception to Sentry.
r   F)typehandled)client_options	mechanism)hintN)
sentry_sdk
get_clientr   optionscapture_event)exc_infoclienteventr_   s       r4   _capture_exceptionrg      s@     ""$F&~~!e4KE
 U.r7   c                      [         R                  " 5       n [        5          [        U 5        SSS5        [	        U 6   g! , (       d  f       N= f)z
Raise an exception.
N)sysrd   r   rg   r	   )rd   s    r4   rQ   rQ      s3    
 ||~H	$	&8$ 
'X 
'	&s	   =
Ac              #   v   #      [        U 5      v   M  ! [         a     g[         a    [        5          N#f = f7f)z,
Wrap the generator to handle any failures.
N)nextStopIterationrP   rQ   )rV   s    r4   rU   rU      s>     
 	s)O   	 		s$   9 9
696969)!ri   rS   	functoolsr   r`   sentry_sdk.integrationsr   sentry_sdk.integrations.loggingr   sentry_sdk.utilsr   r   r   r	   typingr
   r   r   r   r   sentry_sdk._typesr   r   r   r$   r&   r'   r   r9   r)   rg   rQ   rU   rD   r7   r4   <module>rs      s    
    / 9  !)A8CH-.A 	-+k -+`D, O,/ -/r7   