o
    h                     @   s   d dl mZ d dlmZ d dlmZmZ 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 W n eyG   ed
w G dd deZG dd de	ZdS )    )TYPE_CHECKING)add_feature_flag)DidNotEnableIntegrationN)HookMetadata)LDClient)EvaluationSeriesContext)EvaluationDetail)AnyzLaunchDarkly is not installedc                   @   s&   e Zd ZdZdddZedd ZdS )LaunchDarklyIntegrationlaunchdarklyNc              
   C   sZ   z|pt  }W n ty } ztdt| d}~w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)self	ld_clientclientexc r   f/var/www/html/pro-man-master/venv/lib/python3.10/site-packages/sentry_sdk/integrations/launchdarkly.py__init__   s   z LaunchDarklyIntegration.__init__c                   C   s   d S Nr   r   r   r   r   
setup_once(   s   z"LaunchDarklyIntegration.setup_oncer   )__name__
__module____qualname__
identifierr   staticmethodr   r   r   r   r   r      s
    
r   c                   @   s(   e Zd Zedd Zdd Zdd ZdS )r   c                 C   s
   t ddS )Nzsentry-flag-auditor)name)r   )r   r   r   r   metadata0   s   
zLaunchDarklyHook.metadatac                 C   s   t |jtrt|j|j |S r   )
isinstancevalueboolr   key)r   series_contextdatadetailr   r   r   after_evaluation5   s   z!LaunchDarklyHook.after_evaluationc                 C   s   |S r   r   )r   r)   r*   r   r   r   before_evaluation<   s   z"LaunchDarklyHook.before_evaluationN)r   r   r    propertyr$   r,   r-   r   r   r   r   r   .   s
    
r   )typingr   sentry_sdk.feature_flagsr   sentry_sdk.integrationsr   r   r   ldclient.hookr   r   r   r	   ldclient.evaluationr
   r   ImportErrorr   r   r   r   r   r   <module>   s"    