AlkantarClanX12

Your IP : 3.144.244.244


Current Path : /opt/alt/python37/lib/python3.7/site-packages/raven/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/raven/__pycache__/context.cpython-37.pyc

B

��Y��@s�dZddlmZddlmZmZddlmZddlm	Zddl
mZyddlm
ZWn ek
rtddlm
ZYnXe�Zdd	�ZGd
d�deee�ZddlZdS)
z�
raven.context
~~~~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
�)�absolute_import)�Mapping�Iterable)�local)�ref)�	iteritems)�	get_identcCs$y
ttj�Stk
rgSXdS)z7Returns all the active contexts for the current thread.N)�list�_active_contexts�contexts�AttributeError�r
r
�>/opt/alt/python37/lib/python3.7/site-packages/raven/context.py�get_active_contextss
rc@s�eZdZdZd'dd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd(dd�Zdd�Zd)dd �Zd!d"�Zd#d$�Zd*d%d&�ZdS)+�Contexta'
    Stores context until cleared.

    >>> def view_handler(view_func, *args, **kwargs):
    >>>     context = Context()
    >>>     context.merge(tags={'key': 'value'})
    >>>     try:
    >>>         return view_func(*args, **kwargs)
    >>>     finally:
    >>>         context.clear()
    NcCsLtj�|dkp|j�}|dk	r&t|�}||_|��i|_t�|_	||_dS)N)
�raven�breadcrumbsZmake_bufferZenable_breadcrumbs�weakref�_client�activate�data�set�exceptions_to_skip)�self�clientrr
r
r�__init__.szContext.__init__cCs|jdkrdS|��S)N)r)rr
r
rr=s
zContext.clientcCst|�S)N)�id)rr
r
r�__hash__CszContext.__hash__cCs||kS)Nr
)r�otherr
r
r�__eq__FszContext.__eq__cCs|�|�S)N)r)rrr
r
r�__ne__IszContext.__ne__cCs
|j|S)N)r)r�keyr
r
r�__getitem__LszContext.__getitem__cCs
t|j�S)N)�iterr)rr
r
r�__iter__OszContext.__iter__cCs
t|j�S)N)�lenr)rr
r
r�__len__RszContext.__len__cCsdt|�j|jfS)Nz<%s: %s>)�type�__name__r)rr
r
r�__repr__UszContext.__repr__cCs|��|S)N)r)rr
r
r�	__enter__XszContext.__enter__cCs|��dS)N)�
deactivate)r�exc_type�	exc_value�tbr
r
r�__exit__\szContext.__exit__FcCs&|rt�|_tj�dt���|�dS)Nr)�get_thread_identZ_sticky_threadr
�__dict__�
setdefaultr�add)rZstickyr
r
rr_szContext.activatecCs*ytj�|�Wntk
r$YnXdS)N)r
r�discardr)rr
r
rr+dszContext.deactivateTcCsl|r|��|j}xTt|�D]H\}}|dkr\|�|i�x*t|�D]\}}||||<qBWq|||<qWdS)N)Ztags�extra)rrrr2)rrr�dr!�valueZt_keyZt_valuer
r
r�mergejsz
Context.mergecCs
||_dS)N)r)rrr
r
rrvszContext.setcCs|jS)N)r)rr
r
r�getyszContext.getcCsLi|_|j��|j��|dkr<|j}|dk	r<t�|jk}|rH|��dS)N)rr�clearrrr0Zmain_thread_idr+)rr+rr
r
rr:|s

z
Context.clear)N)F)T)N)r(�
__module__�__qualname__�__doc__r�propertyrrrr r"r$r&r)r*r/rr+r8rr9r:r
r
r
rr!s$


rN)r=�
__future__r�collectionsrr�	threadingrrrZraven.utils.compatr�threadrr0�ImportError�_threadr
rrZraven.breadcrumbsrr
r
r
r�<module>sl