Your IP : 18.191.171.43


Current Path : /opt/alt/python27/lib/python2.7/site-packages/raven/utils/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyc

�
��Yc@@sLdZddlmZddlZddlZddlZejddkZejddkZer�e	fZ
efZe
fZe	ZeZn0efZ
eefZe
ejfZeZe	Zy
eZWnek
r�d�ZnXeZy
eZWnek
rd�ZnXer#eZndefd	��YZerfd
�Zd�Zd�Zd
�Zn$d�Zd�Zd�Zd�Zer�d�Z d�Z!ddl"Z"e"j#Z#e"j$Z$n+d�Z d�Z!ddl#Z#e#j#Z#Z$ere%e&d�d�Z'dd�Z)nddd�Z'e'd�ejd d%krQe'd�n)ejd d&krqe'd�n	d�Z*er�ddl+m,Z,ddl-m.Z/ddl0j1Z2dd l3m4Z4dd!l5m6Z7dd"l8m9Z:nTddl2m,Z,ddl/Z/ddl2Z2dd l4m4Z4dd!l8m6Z7ddl:Z:d#�Z;d$�Z<dS('s�
raven.utils.compat
~~~~~~~~~~~~~~~~~~

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

Utilities for writing code that runs on Python 2 and 3
i(tabsolute_importNiicC@s
|j�S(N(tnext(tit((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pytadvance_iterator:scC@std�t|�jD��S(Ncs@s|]}d|jkVqdS(t__call__N(t__dict__(t.0tklass((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pys	<genexpr>Cs(tanyttypet__mro__(tobj((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pytcallableBstIteratorcB@seZd�ZRS(cC@st|�j|�S(N(R	t__next__(tself((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyRJs(t__name__t
__module__R(((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyR
HscK@st|j|��S(N(titertkeys(tdtkw((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pytiterkeysOscK@st|j|��S(N(Rtvalues(RR((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyt
itervaluesRscK@st|j|��S(N(Rtitems(RR((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyt	iteritemsUscK@st|j|��S(N(Rtlists(RR((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyt	iterlistsXscK@s
|j|�S(N(R(RR((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyR[scK@s
|j|�S(N(R(RR((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyR^scK@s
|j|�S(N(R(RR((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyRascK@s
|j|�S(N(R(RR((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyRdscC@s
|jd�S(Nslatin-1(tencode(ts((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pytbiscC@s|S(N((R((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pytulscC@s|S(N((R((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyRrscC@st|jdd�d�S(Ns\\s\\\\tunicode_escape(tunicodetreplace(R((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyR vstbuiltinstexeccC@sWzC|dkr|�}n|j|k	r<|j|��n|�Wdd}d}XdS(N(tNonet
__traceback__twith_traceback(ttptvaluettb((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pytreraises
cB@sc|dkrBejd�}|j}|dkr<|j}n~n|dkrW|}nddUdS(sExecute code in a namespace.isexec _code_ in _globs_, _locs_N(R&tsyst	_getframet	f_globalstf_locals(t_code_t_globs_t_locs_tframe((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pytexec_�s		sedef reraise(tp, value, tb=None):
    try:
        raise tp, value, tb
    finally:
        tb = None
s�def raise_from(value, from_value):
    try:
        if from_value is None:
            raise value
        raise value from from_value
    finally:
        value = None
srdef raise_from(value, from_value):
    try:
        raise value from from_value
    finally:
        value = None
cC@s
|�dS(N((R*t
from_value((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyt
raise_from�s(t	HTTPError(tclient(tQueue(tquote(tparsecC@sJt|dt|dd��}|dkrFtdt|�j��n|S(Nt__code__t	func_codesCould not get code from %r(tgetattrR&t	TypeErrorR	R(tfunctrv((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pytget_code�scC@s�yddlm}Wntk
r(dSXd|kr9dSt|jdd��j�dkr�dd	lm}|td
��ndS(Ni(topttthreadssenable-threadst0tfalsetofftno(twarns�We detected the use of uwsgi with disabled threads.  This will cause issues with the transport you are trying to use.  Please enable threading for uwsgi.  (Enable the "enable-threads" flag).(RGRHRIRF(	tuwsgiRDtImportErrortstrtgettlowertwarningsRJtWarning(RDRJ((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyt
check_threads�s
$(ii(ii(=t__doc__t
__future__RtoperatorR-ttypestversion_infotPY2tPY3RMtstring_typestintt
integer_typesR	tclass_typest	text_typetbytestbinary_typet
basestringtlongt	ClassTypeR"RRt	NameErrorRtobjectR
RRRRRR tiotStringIOtBytesIOR?t
__import__R5R&R,R7turllib.errorR8thttpR9thttplibturllib.requesttrequestturllib2tqueueR:turllib.parseR;turllib_quoteturllibR<turlparseRCRR(((sC/opt/alt/python27/lib/python2.7/site-packages/raven/utils/compat.pyt<module>	s�					





													


		

?>