
    fi                         d dl Z d dlZd dlmZ d dlmZ d dlmZmZ erd dlm	Z	  e	de
ed          ZdZ G d	 d
          Zd ZdS )    N)LRUCache)Lock)TYPE_CHECKINGAny)	TypedDictFlagDataflagresultd   c                   ,    e Zd Zd Zd Zd Zd Zd ZdS )
FlagBufferc                 b    || _         t                      | _        t          |          | _        d S N)capacityr   lockr   _FlagBuffer__buffer)selfr   s     h/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/sentry_sdk/feature_flags.py__init__zFlagBuffer.__init__   s)     FF	 !**    c                 8    t          | j                  | _        d S r   )r   r   r   r   s    r   clearzFlagBuffer.clear   s     //r   c                     | j         5  t          | j                  }t          j        | j        |          |_        |cd d d            S # 1 swxY w Y   d S r   )r   r   r   copydeepcopyr   )r   memobuffers      r   __deepcopy__zFlagBuffer.__deepcopy__   s    Y 	 	..F"mDM4@@FO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   5A

AAc                     | j         5  d | j                                        D             cd d d            S # 1 swxY w Y   d S )Nc                     g | ]
\  }}||d S )r	    ).0keyvalues      r   
<listcomp>z"FlagBuffer.get.<locals>.<listcomp>)   s1       3=3..  r   )r   r   get_allr   s    r   getzFlagBuffer.get&   s    Y 	 	 AEAVAVAXAX  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   #8<<c                     t          |t                    rt          d          | j        5  | j                            ||           d d d            d S # 1 swxY w Y   d S )Nz=FlagBuffer instances can not be inserted into the dictionary.)
isinstancer   
ValueErrorr   r   set)r   r
   r   s      r   r-   zFlagBuffer.set-   s    fj)) 	
 O   Y 	, 	,MdF+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,s   AAAN)__name__
__module____qualname__r   r   r    r)   r-   r#   r   r   r   r      s_        + + +0 0 0    , , , , ,r   r   c                     t          j                    j        }|                    | |           t          j                    }|r|                    d|  |           dS dS )z
    Records a flag and its value to be sent on subsequent error events.
    We recommend you do this on flag evaluations. Flags are buffered per Sentry scope.
    zflag.evaluation.N)
sentry_sdkget_isolation_scopeflagsr-   get_current_spanset_flag)r
   r   r4   spans       r   add_feature_flagr8   <   sl     *,,2E	IIdF&((D 9///888889 9r   )r   r2   sentry_sdk._lru_cacher   	threadingr   typingr   r   r   strboolr   DEFAULT_FLAG_CAPACITYr   r8   r#   r   r   <module>r?      s         * * * * * *       % % % % % % % % D      ycT%B%BCCH  (, (, (, (, (, (, (, (,V9 9 9 9 9r   