Ë
    S>{i9  ã                   ó>  — d dl mZ d dl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 d dlmZ d dlmZ d d	lmZ erAd d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ  ed«      Z ededef   ¬«      ZdZdZdZ  G d„ de«      Z!d„ Z"d„ Z#d„ Z$d„ Z%d„ Z&y)é    )Úabsolute_importN)Úwraps)ÚHub)Úreraise)Úcapture_internal_exceptionsÚevent_from_exception)ÚIntegration)Úignore_logger)ÚTYPE_CHECKING)ÚAny)ÚIterator)ÚTypeVar)ÚOptional)ÚCallable)ÚClient)ÚExcInfoÚTÚF.)Úboundz_wrapped_{}_z_inspect_{}Ú_sentry_used_c                   ó    — e Zd ZdZed„ «       Zy)ÚBeamIntegrationÚbeamc            	      óà   ‡‡— ddl m} m} t        d«       t        d«       g d¢Š‰D ],  }t	        | t
        j                  |«      t        | |«      «       Œ. |j                  Šˆˆfd„}||_        y )Nr   )ÚDoFnÚParDoÚrootzbundle_processor.create)ÚprocessÚstart_bundleÚfinish_bundleÚsetupc                 ó~  •— t        | dd«      s¢‰D ]–  }t        ||«      sŒt        j                  |«      }t        ||«      }t        |t        j                  |«      «      }t        |t
        d«      rŒbt        |t
        d«      rŒtt        |||«       t        ||t        |«      «       Œ˜ d| _         ‰	| |g|¢­i |¤Ž y )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
           €€úZ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sentry_sdk/integrations/beam.pyÚsentry_init_pardoz5BeamIntegration.setup_once.<locals>.sentry_init_pardo6   s½   ø€ ô ˜4Ð!5°uÔ=Ø!1ò N�IÜ" 2 yÔ1Ø Ü#/×#6Ñ#6°yÓ#A�Lô $+¨2¨yÓ#9�LÜ#*¨2¬|×/BÑ/BÀ9Ó/MÓ#N�LÜ" <´¸EÕBÌ7Ø$¤i°õLô    L°,Ô?Ü  I¬¸|Ó/LÕMðNð" +/�Ô'Ù�T˜2Ð/ Ò/¨Ó/ó    )	Úapache_beam.transforms.corer   r   r
   r*   r(   r'   Ú_wrap_inspect_callÚ__init__)r   r   r0   r7   r4   r5   s       @@r6   Ú
setup_oncezBeamIntegration.setup_once$   sj   ù€ ÷ 	<ä�fÔÜÐ/Ô0âPÐØ)ò 	ˆIÜØÜ×#Ñ# IÓ.Ü" 4¨Ó3õð	ð —>‘>ˆõ	0ð0 +ˆ�r8   N)Ú__name__Ú
__module__Ú__qualname__Ú
identifierÚstaticmethodr<   © r8   r6   r   r   !   s   „ Ø€Jàñ)+ó ñ)+r8   r   c                 óN   ‡— t        | ‰«      sy ˆfd„}t        |t        d«       |S )Nc                 ó  •— t         j                  ‰«      }t        | |«      rt        | |«      }n/t        | ‰«      }t	        | ‰t        |«      «       t	        | ||«       	 ddlm}  ||«      S # t        $ r ddl	m
}  ||«      cY S w xY w)zG
        Inspect function overrides the way Beam gets argspec.
        r   )Úget_function_args_defaults)Úgetfullargspec)r&   r'   r%   r$   r*   r+   r9   rE   ÚImportErrorÚ apache_beam.typehints.decoratorsrF   )r,   r1   r2   rE   rF   r0   s        €r6   Ú_inspectz$_wrap_inspect_call.<locals>._inspectW   s„   ø€ ô
 $×*Ñ*¨9Ó5ˆÜ�4˜Ô&Ü" 4¨Ó6‰Lä" 4¨Ó3ˆLÜ�D˜)¤_°\Ó%BÔCÜ�D˜,¨Ô5ð	0ÝNá-¨lÓ;Ð;øÜò 	0ÝGá! ,Ó/Ò/ð	0ús   Á A. Á.BÂBT)r%   r*   r)   )Úclsr0   rI   s    ` r6   r:   r:   Q   s*   ø€ ô �3˜	Ô"Øô0ô0 ˆH”i Ô&Ø€Or8   c                 óˆ   ‡ ‡— t         j                  j                  Št        ‰ «      ˆˆ fd„«       }t	        |t
        d«       |S )z~
    Wrap task call with a try catch to get exceptions.
    Pass the client on to raise_exception so it can get rebinded.
    c                  óš   •— 	  ‰| i |¤Ž}t        t        j                  «      s|S t        |‰«      S # t         $ r t        ‰«       Y Œ>w xY w)N)Ú	ExceptionÚraise_exceptionÚ
isinstanceÚtypesÚGeneratorTypeÚ_wrap_generator_call)r.   r/   ÚgenÚclientÚfuncs      €€r6   Ú_innerz_wrap_task_call.<locals>._inner{   sT   ø€ ð	$Ù˜Ð' Ñ'ˆCô ˜#œu×2Ñ2Ô3ØˆJÜ# C¨Ó0Ð0øô ò 	$Ü˜FÖ#ð	$ús   ƒ3 ³A
Á	A
T)r   ÚcurrentrT   r   r*   r)   )rU   rV   rT   s   ` @r6   r+   r+   s   s=   ù€ ô �[‰[×Ñ€Fä
ˆ4ƒ[ô	1ó ð	1ô ˆF”I˜tÔ$Ø€Mr8   c                 ó´   — |j                  t        «      }|€y|j                  }|€yt        | |j                  dddœ¬«      \  }}|j                  ||¬«       y)z(
    Send Beam exception to Sentry.
    Nr   F)ÚtypeÚhandled)Úclient_optionsÚ	mechanism)Úhint)Úget_integrationr   rT   r   ÚoptionsÚcapture_event)Úexc_infoÚhubÚintegrationrT   Úeventr]   s         r6   Ú_capture_exceptionre   ‹   sc   € ð
 ×%Ñ%¤oÓ6€KØÐØà�Z‰Z€FØ€~Øä&ØØ—~‘~Ø!¨eÑ4ô�K€Eˆ4ð
 ×Ñ�e $ÐÕ'r8   c                 óì   — t         j                  }|j                  €|j                  | «       t	        j
                  «       }t        «       5  t        ||«       ddd«       t        |Ž  y# 1 sw Y   ŒxY w)zI
    Raise an exception. If the client is not in the hub, rebind it.
    N)	r   rW   rT   Úbind_clientÚsysra   r   re   r   )rT   rb   ra   s      r6   rN   rN       s[   € ô
 �+‰+€CØ
‡z�zÐØ�‰˜ÔÜ�|‰|‹~€HÜ	$Ó	&ñ *Ü˜8 SÔ)÷*äˆXÒ÷*ð *ús   ÁA*Á*A3c              #   ór   K  — 	 	 t        | «      –— Œ# t        $ r Y yt        $ r t        |«       Y Œ!w xY w­w)z4
    Wrap the generator to handle any failures.
    N)ÚnextÚStopIterationrM   rN   )rS   rT   s     r6   rR   rR   ®   sA   è ø€ ð
 ð	$Ü�s“)ŠOð øô ò 	ÙÜò 	$Ü˜FÖ#ð	$üs$   ‚7… ’7“	4œ7ž4±7³4´7)'Ú
__future__r   rh   rP   Úsentry_sdk._functoolsr   Úsentry_sdk.hubr   Úsentry_sdk._compatr   Úsentry_sdk.utilsr   r   Úsentry_sdk.integrationsr	   Úsentry_sdk.integrations.loggingr
   Úsentry_sdk._typesr   Útypingr   r   r   r   r   Úsentry_sdk.clientr   r   r   r   r&   r(   r)   r   r:   r+   re   rN   rR   rB   r8   r6   ú<module>rv      s‘   ðÝ &ã 
Û Ý 'å Ý &ß NÝ /Ý 9Ý +áÝÝÝÝÝå(Ý)á�‹€AÙ�˜8 C¨ HÑ-Ô.€Að €Ø€Ø€	ô-+�kô -+ò`òDò0(ò*ó$r8   