Your IP : 216.73.216.213


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



��Y,�@s�dZddlmZddlZddlZddlZejddkZejddkZer�e	fZ
efZe
fZe	ZeZn0efZ
eefZe
ejfZeZe	Zy
eZWnek
r�dd�ZYnXeZy
eZWnek
rdd	�ZYnXer+eZnGd
d�de�Zerzdd
�Zdd�Zdd�Zdd�Zn0dd
�Zdd�Zdd�Zdd�Zer�dd�Z dd�Z!ddl"Z"e"j#Z#e"j$Z$n1dd�Z dd�Z!ddl#Z#e#j#Z#Z$erGe%e&d�d�Z'dd d!�Z(nddd"d#�Z'e'd$�ejdd�d2kr�e'd%�n2ejdd�d3kr�e'd&�nd'd(�Z)er#dd)l*m+Z+dd*l,m-Z.ddl/j0Z1dd+l2m3Z3dd,l4m5Z6dd-l7m8Z9nTdd)l1m+Z+ddl.Z.ddl1Z1dd+l3m3Z3dd,l7m5Z6ddl9Z9d.d/�Z:d0d1�Z;dS)4z�
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
�)�absolute_importN��cCs
|j�S)N)�next)�it�r�C/opt/alt/python35/lib/python3.5/site-packages/raven/utils/compat.py�advance_iterator:sr	cCs tdd�t|�jD��S)Ncss|]}d|jkVqdS)�__call__N)�__dict__)�.0�klassrrr�	<genexpr>Cszcallable.<locals>.<genexpr>)�any�type�__mro__)�objrrr�callableBsrc@seZdZdd�ZdS)�IteratorcCst|�j|�S)N)r�__next__)�selfrrrrJsz
Iterator.nextN)�__name__�
__module__�__qualname__rrrrrrHsrcKst|j|��S)N)�iter�keys)�d�kwrrr�iterkeysOsrcKst|j|��S)N)r�values)rrrrr�
itervaluesRsr cKst|j|��S)N)r�items)rrrrr�	iteritemsUsr"cKst|j|��S)N)r�lists)rrrrr�	iterlistsXsr$cKs
|j|�S)N)r)rrrrrr[scKs
|j|�S)N)r )rrrrrr ^scKs
|j|�S)N)r")rrrrrr"ascKs
|j|�S)N)r$)rrrrrr$dscCs
|jd�S)Nzlatin-1)�encode)�srrr�bisr'cCs|S)Nr)r&rrr�ulsr(cCs|S)Nr)r&rrrr'rscCst|jdd�d�S)Nz\\z\\\\Zunicode_escape)�unicode�replace)r&rrrr(vs�builtins�execc
CsQz=|dkr|�}|j|k	r6|j|��|�Wdd}d}XdS)N)�
__traceback__�with_traceback)�tp�value�tbrrr�reraises	
r2cCs_|dkr?tjd�}|j}|dkr9|j}~n|dkrQ|}td�dS)zExecute code in a namespace.N�zexec _code_ in _globs_, _locs_)�sys�	_getframe�	f_globals�f_localsr,)Z_code_Z_globs_Z_locs_�framerrr�exec_�s		r9zedef reraise(tp, value, tb=None):
    try:
        raise tp, value, tb
    finally:
        tb = None
z�def raise_from(value, from_value):
    try:
        if from_value is None:
            raise value
        raise value from from_value
    finally:
        value = None
zrdef raise_from(value, from_value):
    try:
        raise value from from_value
    finally:
        value = None
cCs
|�dS)Nr)r0�
from_valuerrr�
raise_from�sr;)�	HTTPError)�client)�Queue)�quote)�parsecCsGt|dt|dd��}|dkrCtdt|�j��|S)N�__code__�	func_codezCould not get code from %r)�getattr�	TypeErrorrr)�func�rvrrr�get_code�srGc
Cs�yddlm}Wntk
r,dSYnXd|kr=dSt|jdd��j�dkr�dd	lm}|td
��dS)Nr)�opt�threadszenable-threads�0�false�off�no)�warnz�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).)rKrLrMrJ)	ZuwsgirH�ImportError�str�get�lower�warningsrN�Warning)rHrNrrr�
check_threads�s
	$rU)rr)rr)<�__doc__�
__future__r�operatorr4�types�version_info�PY2�PY3rP�string_types�int�
integer_typesr�class_types�	text_type�bytes�binary_type�
basestring�longZ	ClassTyper)rr	�	NameErrorr�objectrrr r"r$r'r(�io�StringIO�BytesIOrC�
__import__r9r2r;Zurllib.errorr<�httpr=ZhttplibZurllib.request�requestZurllib2�queuer>�urllib.parser?Zurllib_quote�urllibr@�urlparserGrUrrrr�<module>	s�