
    tni~                         d dl mZ d dlmZ d dlmZmZ 	 d dlZd dlm	Z	m
Z
 erd dlmZ d dlmZ d dlmZ d d	l mZ n# e$ r  ed
          w xY w G d de          Z G d de	          ZdS )    )TYPE_CHECKING)add_feature_flag)DidNotEnableIntegrationN)HookMetadata)LDClient)EvaluationSeriesContext)EvaluationDetail)AnyzLaunchDarkly is not installedc                   4    e Zd ZdZdd	dZed
d            ZdS )LaunchDarklyIntegrationlaunchdarklyN	ld_clientLDClient | Nonereturnc                    	 |pt          j                    }n1# t          $ r$}t          dt	          |          z             d}~ww xY w|                                st          d          |                    t                                 dS )z
        :param client: An initialized LDClient instance. If a client is not provided, this
            integration will attempt to use the shared global instance.
        z#Error getting LaunchDarkly client. Nz'LaunchDarkly client is not initialized.)ldclientget	Exceptionr   repris_initializedadd_hookLaunchDarklyHook)selfr   clientexcs       a/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/sentry_sdk/integrations/launchdarkly.py__init__z LaunchDarklyIntegration.__init__   s    
	R0(,..FF 	R 	R 	RDtCyyPQQQ	R $$&& 	JHIII 	(**+++++s    
AAAc                      d S N r"       r   
setup_oncez"LaunchDarklyIntegration.setup_once'   s    r#   r!   )r   r   r   N)r   N)__name__
__module____qualname__
identifierr   staticmethodr$   r"   r#   r   r   r      sR        J, , , , ,     \  r#   r   c                   R    e Zd Zedd            Z	 	 	 	 	 	 	 	 dd
Z	 	 	 	 	 	 ddZdS )r   r   r   c                 "    t          d          S )Nzsentry-flag-auditor)name)r   )r   s    r   metadatazLaunchDarklyHook.metadata-   s    23333r#   series_contextr
   datadict[Any, Any]detailr   c                 n    t          |j        t                    rt          |j        |j                   |S r!   )
isinstancevalueboolr   key)r   r.   r/   r1   s       r   after_evaluationz!LaunchDarklyHook.after_evaluation1   s2     flD)) 	?^/>>>r#   c                     |S r!   r"   )r   r.   r/   s      r   before_evaluationz"LaunchDarklyHook.before_evaluation<   s	     r#   N)r   r   )r.   r
   r/   r0   r1   r   r   r0   )r.   r
   r/   r0   r   r0   )r%   r&   r'   propertyr-   r7   r9   r"   r#   r   r   r   ,   s        4 4 4 X4	1	 	 #		
 
	 	 	 	7?O	     r#   r   )typingr   sentry_sdk.feature_flagsr   sentry_sdk.integrationsr   r   r   ldclient.hookr   r   r	   r
   ldclient.evaluationr   r   ImportErrorr   r   r"   r#   r   <module>rA      sB               5 5 5 5 5 5 = = = = = = = =8OOO,,,,,,,, %%%%%%999999888888 8 8 8
,6
7
778    k   0    t     s	   &= A