Your IP : 216.73.216.61


Current Path : /opt/alt/python35/lib/python3.5/site-packages/raven/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/raven/__pycache__/events.cpython-35.pyc



��YA�@s�dZddlmZddlZddlZddlmZddlmZm	Z	dZ
Gd
d�de�Ze
ed�r�dd
�Zndd
�ZGdd�de�ZGdd�de�ZGdd	�d	e�ZdS)z�
raven.events
~~~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.

�)�absolute_importN)�
to_unicode)�get_stack_info�iter_traceback_frames�	BaseEvent�	Exception�Message�Queryc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCs||_tjt�|_dS)N)�client�logging�	getLogger�__name__�logger)�selfr
�r�=/opt/alt/python35/lib/python3.5/site-packages/raven/events.py�__init__s	zBaseEvent.__init__cCs
t�dS)N)�NotImplementedError)r�datarrr�	to_stringszBaseEvent.to_stringcKsiS)Nr)r�kwargsrrr�captureszBaseEvent.capturecCs|jj|�S)N)r
�	transform)r�valuerrrr szBaseEvent.transformN)r
�
__module__�__qualname__rrrrrrrrrs�__suppress_context__ccs�|V|\}}}t�}|j|�x`|jrB|j}n	|j}||krXP|j|�|dkrrPt|�||jfVq-WdS)z�
        Return a generator iterator over an exception's chain.

        The exceptions are yielded from outermost to innermost (i.e. last to
        first when viewing a stack trace).

        N)�set�addr�	__cause__�__context__�type�
__traceback__)�exc_info�exc_type�exc�
exc_traceback�contextrrr�_chained_exceptions(s	
		
r(ccs	|VdS)Nr)r#rrrr(Csc@sCeZdZdZdZdd�Zdd�Zddd	�ZdS)
rz�
    Exceptions store the following metadata:

    - value: 'My exception value'
    - type: 'ClassName'
    - module '__builtin__' (i.e. __builtin__.TypeError)
    - frames: a list of serialized frames (see _get_traceback_frames)

    �	exceptioncCs=||jdd}|dr5d|d|dfS|dS)N�values�rz%s: %sr!���)�name)rrr%rrrrTs
zException.to_stringcCs�tt|�d|jd|jj�}t|dd�}|rKt|�}t|dd�}dt|�dt|�d	t|�d
|iS)zH
        Convert exception info to a value for the values list.
        Ztransformer�capture_localsrNr
z	<unknown>rr!�moduleZ
stacktrace)rrrr
r.�getattr�strr)rr$�	exc_valuer&�
stack_infoZ
exc_modulerrr�
_get_valueZs	zException._get_valueNcKs�|s|dkrtj�}|s1td��g}x3t|�D]%}|j|�}|jd|�qDWd|jdtj�|j	d|iiS)NTzNo exception foundr�levelr*)
�sysr#�
ValueErrorr(r4�insert�getr�ERRORr-)rr#rr*rrrrrpszException.capture)r
rr�__doc__r-rr4rrrrrrGs
	c@s:eZdZdZdZdd�Zfddd�ZdS)rz{
    Messages store the following metadata:

    - message: 'My message from %s about %s'
    - params: ('foo', 'bar')
    zsentry.interfaces.MessagecCs||jdS)N�message)r-)rrrrrr�szMessage.to_stringNcKsVt|�}|jd|d|j|�d|ii}d|krR|pK||d<|S)Nr<�params�	formatted)rr-r)rr<r=r>rrrrrr�szMessage.capture)r
rrr;r-rrrrrrr�sc@s4eZdZdZdZdd�Zdd�ZdS)r	zw
    Messages store the following metadata:

    - query: 'SELECT * FROM table'
    - engine: 'postgesql_psycopg2'
    zsentry.interfaces.QuerycCs||j}|dS)N�query)r-)rrZsqlrrrr�s
zQuery.to_stringcKs%|jdt|�dt|�iiS)Nr?�engine)r-rr1)rr?r@rrrrr�sz
Query.captureN)r
rrr;r-rrrrrrr	�s)rrrr	)r;�
__future__rrr6Zraven.utils.encodingrZraven.utils.stacksrr�__all__�objectr�hasattrrr(rr	rrrr�<module>s;