<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
U
    \                     @   st   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m	Z	m
Z
 g Zdd Zdd	 Zd
d ZG dd deZdS )    )copy)dequewraps)chain)loggercapture_internal_exceptionsobject_to_jsonc                 C   s   t |  d S N)global_event_processorsappend)	processor r   A/opt/alt/python38/lib/python3.8/site-packages/sentry_sdk/scope.pyadd_global_event_processor   s    r   c                 C   s   t | | jdS )N)fsetdoc)property__doc__fnr   r   r   _attr_setter   s    r   c                    s   t   fdd}|S )Nc                    s2   | j s
d S zd| _  | f||W S d| _ X d S )NTF)_should_capture)selfargskwargsr   r   r   wrapper   s    z!_disable_capture.<locals>.wrapperr   )r   r   r   r   r   _disable_capture   s    
r   c                   @   s   e Zd ZdZdZdd Zedd Zedd Zed	d
 Z	edd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zd(d d!Zed)d"d#Zd$d% Zd&d' ZdS )*ScopezaThe scope holds extra information that should be sent with all
    events that belong to it.
    )_level_name_fingerprint_transaction_user_tags	_contexts_extras_breadcrumbs_event_processors_error_processorsr   c                 C   s   g | _ g | _d | _|   d S r
   )r(   r)   r    clearr   r   r   r   __init__@   s    zScope.__init__c                 C   s
   || _ dS )z"When set this overrides the level.N)r   r   valuer   r   r   levelG   s    zScope.levelc                 C   s
   || _ dS )z0When set this overrides the default fingerprint.N)r!   r-   r   r   r   fingerprintL   s    zScope.fingerprintc                 C   s
   || _ dS )z;When set this forces a specific transaction name to be set.N)r"   r-   r   r   r   transactionQ   s    zScope.transactionc                 C   s
   || _ dS )z/When set a specific user is bound to the scope.N)r#   r-   r   r   r   userV   s    z
Scope.userc                 C   s   || j |< dS )z)Sets a tag for a key to a specific value.N)r$   r   keyr.   r   r   r   set_tag[   s    zScope.set_tagc                 C   s   | j |d dS )zRemoves a specific tag.N)r$   popr   r4   r   r   r   
remove_tag_   s    zScope.remove_tagc                 C   s   || j |< dS )z5Binds a context at a certain key to a specific value.N)r%   r3   r   r   r   set_contextc   s    zScope.set_contextc                 C   s   | j |d dS )zRemoves a context.N)r%   r6   r7   r   r   r   remove_contextg   s    zScope.remove_contextc                 C   s   || j |< dS )z&Sets an extra key to a specific value.N)r&   r3   r   r   r   	set_extrak   s    zScope.set_extrac                 C   s   | j |d dS )zRemoves a specific extra key.N)r&   r6   r7   r   r   r   remove_extrao   s    zScope.remove_extrac                 C   s<   d| _ d| _d| _d| _i | _i | _i | _|   d| _dS )zClears the entire scope.NT)	r   r!   r"   r#   r$   r%   r&   clear_breadcrumbsr   r+   r   r   r   r*   s   s    zScope.clearc                 C   s   t  | _dS )zClears breadcrumb buffer.N)r   r'   r+   r   r   r   r=      s    zScope.clear_breadcrumbsc                 C   s   | j | dS )zq"Register a scope local event processor on the scope.

        This function behaves like `before_send.`
        N)r(   r   )r   funcr   r   r   add_event_processor   s    zScope.add_event_processorNc                    s*    dk	r| fdd}| j | dS )z"Register a scope local error processor on the scope.

        The error processor works similar to an event processor but is
        invoked with the original exception info triple as second argument.
        Nc                    s>   zt |d  }W n tk
r*   d}Y nX |r:| |S | S )N   F)
isinstance	Exception)eventexc_infoZis_instclsZ	real_funcr   r   r>      s    

z'Scope.add_error_processor.<locals>.func)r)   r   )r   r>   rF   r   rE   r   add_error_processor   s    	zScope.add_error_processorc              
   C   s  dd }| j dk	r| j |d< |dg | j |ddkrR| jdk	rR| j|d< |ddkrt| jdk	rt| j|d< |ddkr| jdk	r| j|d< | jr|d	i 	t
| j | jr|d
i 	| j | jr|di 	| j |dk	r|dnd}|dk	r>| jD ].}|||}|dkr6|||d  S |}qtt| jD ]D}|}t  |||}W 5 Q R X |dkr|||d  S |}qJ|S )zBApplies the information contained on the scope to the given event.c                 S   s   t d|||  d S )Nz%s (%s) dropped event (%s))r   info)rC   causeZtyr   r   r   _drop   s    z#Scope.apply_to_event.<locals>._dropNr/   Zbreadcrumbsr2   r1   r0   ZextraZtagsZcontextsrD   zerror processorzevent processor)r   
setdefaultextendr'   getr#   r"   r!   r&   updater	   r$   r%   r)   r   r   r(   r   )r   rC   ZhintrJ   rD   r   Z	new_eventr   r   r   apply_to_event   s>    









zScope.apply_to_eventc                 C   s   t | j}| j|_| j|_| j|_| j|_| j|_t| j	|_	t| j
|_
t| j|_t| j|_t| j|_t| j|_| j|_|S r
   )object__new__	__class__r   r    r!   r"   r#   dictr$   r%   r&   r   r'   listr(   r)   r   )r   rvr   r   r   __copy__   s    zScope.__copy__c                 C   s   d| j jtt| | jf S )Nz<%s id=%s name=%s>)rR   __name__hexidr    r+   r   r   r   __repr__   s
    
zScope.__repr__)N)N)rW   
__module____qualname__r   	__slots__r,   r   r/   r0   r1   r2   r5   r8   r9   r:   r;   r<   r*   r=   r?   rG   r   rO   rV   rZ   r   r   r   r   r   ,   s2   




1r   N)r   collectionsr   	functoolsr   	itertoolsr   Zsentry_sdk.utilsr   r   r	   ZAnyCallableZDictZOptionalZDequeZListr   r   r   r   rP   r   r   r   r   r   <module>   s   