AlkantarClanX12
Current Path : /opt/alt/python37/lib/python3.7/site-packages/raven/__pycache__/ |
Current File : //opt/alt/python37/lib/python3.7/site-packages/raven/__pycache__/context.cpython-37.pyc |
B ��Y� � @ s� d Z ddlmZ ddlmZmZ ddlmZ ddlm Z ddl mZ yddlm Z W n ek rt ddlm Z Y nX e� Zdd � ZG d d� deee�ZddlZdS ) 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_identc C s$ y t tj�S tk r g S X dS )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_contexts s r c @ s� e Zd ZdZd'dd�Zedd� �Zdd� Zd d � Zdd� Z d d� Z dd� Zdd� Zdd� 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() Nc C sL t j�|d kp|j�}|d k r&t|�}|| _| �� i | _t� | _ || _d S )N) �raven�breadcrumbsZmake_bufferZenable_breadcrumbs�weakref�_client�activate�data�set�exceptions_to_skip)�self�clientr r r r �__init__. s zContext.__init__c C s | j d krd S | � � S )N)r )r r r r r = s zContext.clientc C s t | �S )N)�id)r r r r �__hash__C s zContext.__hash__c C s | |kS )Nr )r �otherr r r �__eq__F s zContext.__eq__c C s | � |� S )N)r )r r r r r �__ne__I s zContext.__ne__c C s | j | S )N)r )r �keyr r r �__getitem__L s zContext.__getitem__c C s t | j�S )N)�iterr )r r r r �__iter__O s zContext.__iter__c C s t | j�S )N)�lenr )r r r r �__len__R s zContext.__len__c C s dt | �j| jf S )Nz<%s: %s>)�type�__name__r )r r r r �__repr__U s zContext.__repr__c C s | � � | S )N)r )r r r r � __enter__X s zContext.__enter__c C s | � � d S )N)� deactivate)r �exc_type� exc_value�tbr r r �__exit__\ s zContext.__exit__Fc C s&