Viewing File: /opt/alt/python38/lib/python3.8/site-packages/sentry_sdk/__pycache__/scope.cpython-38.opt-1.pyc

U

\@stddlmZddlmZddlmZddlmZddlmZm	Z	m
Z
gZddZdd	Zd
dZGdd
d
eZdS))copy)dequewraps)chain)loggercapture_internal_exceptionsobject_to_jsoncCst|dSN)global_event_processorsappend)	processorr	/scope.pyadd_global_event_processorsrcCst||jdS)N)fsetdoc)property__doc__fnrrr_attr_settersrcstfdd}|S)Ncs2|js
dSzd|_|f||WSd|_XdS)NTF)_should_capture)selfargskwargsrrrwrappersz!_disable_capture.<locals>.wrapperr)rrrrr_disable_captures
rc@seZdZdZdZddZeddZeddZed	d
Z	eddZ
d
dZddZddZ
ddZddZddZddZddZddZd(d d!Zed)d"d#Zd$d%Zd&d'ZdS)*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_processorsrcCsg|_g|_d|_|dSr
)r(r)r clearrrrr__init__@szScope.__init__cCs
||_dS)z"When set this overrides the level.N)rrvaluerrrlevelGszScope.levelcCs
||_dS)z0When set this overrides the default fingerprint.N)r!r-rrrfingerprintLszScope.fingerprintcCs
||_dS)z;When set this forces a specific transaction name to be set.N)r"r-rrrtransactionQszScope.transactioncCs
||_dS)z/When set a specific user is bound to the scope.N)r#r-rrruserVsz
Scope.usercCs||j|<dS)z)Sets a tag for a key to a specific value.N)r$rkeyr.rrrset_tag[sz
Scope.set_tagcCs|j|ddS)zRemoves a specific tag.N)r$poprr4rrr
remove_tag_szScope.remove_tagcCs||j|<dS)z5Binds a context at a certain key to a specific value.N)r%r3rrrset_contextcszScope.set_contextcCs|j|ddS)zRemoves a context.N)r%r6r7rrrremove_contextgszScope.remove_contextcCs||j|<dS)z&Sets an extra key to a specific value.N)r&r3rrr	set_extrakszScope.set_extracCs|j|ddS)zRemoves a specific extra key.N)r&r6r7rrrremove_extraoszScope.remove_extracCs<d|_d|_d|_d|_i|_i|_i|_|d|_dS)zClears the entire scope.NT)	rr!r"r#r$r%r&clear_breadcrumbsrr+rrrr*sszScope.clearcCst|_dS)zClears breadcrumb buffer.N)rr'r+rrrr=szScope.clear_breadcrumbscCs|j|dS)zq"Register a scope local event processor on the scope.

        This function behaves like `before_send.`
        N)r(r)rfuncrrradd_event_processorszScope.add_event_processorNcs*dk	r|fdd}|j|dS)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.
        Ncs>zt|d}Wntk
r*d}YnX|r:||S|S)NF)
isinstance	Exception)eventexc_infoZis_instclsZ	real_funcrrr>s

z'Scope.add_error_processor.<locals>.func)r)r)rr>rFrrEradd_error_processors	zScope.add_error_processorc
Csdd}|jdk	r|j|d<|dg|j|ddkrR|jdk	rR|j|d<|ddkrt|jdk	rt|j|d<|ddkr|jdk	r|j|d<|jr|d	i	t
|j|jr|d
i	|j|jr|di	|j|dk	r|dnd}|dk	r>|j
D].}|||}|dkr6|||d
S|}qtt|jD]D}|}t|||}W5QRX|dkr|||dS|}qJ|S)zBApplies the information contained on the scope to the given event.cSstd|||dS)Nz%s (%s) dropped event (%s))rinfo)rCcauseZtyrrr_dropsz#Scope.apply_to_event.<locals>._dropNr/Zbreadcrumbsr2r1r0ZextraZtagsZcontextsrDzerror processorzevent processor)r
setdefaultextendr'getr#r"r!r&updater	r$r%r)rrr(r)rrCZhintrJrDr
Z	new_eventrrrapply_to_events>









zScope.apply_to_eventcCst|j}|j|_|j|_|j|_|j|_|j|_t|j	|_	t|j
|_
t|j|_t|j
|_
t|j|_t|j|_|j|_|Sr
)object__new__	__class__rr r!r"r#dictr$r%r&rr'listr(r)r)rrvrrr__copy__szScope.__copy__cCsd|jjtt||jfS)Nz<%s id=%s name=%s>)rR__name__hexidr r+rrr__repr__s

zScope.__repr__)N)N)rW
__module____qualname__r	__slots__r,rr/r0r1r2r5r8r9r:r;r<r*r=r?rGrrOrVrZrrrrr,s2




1rN)rcollectionsr	functoolsr	itertoolsrZsentry_sdk.utilsrrr	ZAnyCallableZDictZOptionalZDequeZListrrrrrPrrrrr<module>s
Back to Directory File Manager