Your IP : 3.17.175.191


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/__init__.pyc

�
��Yc@@s�dZddlmZddlmZmZddlZddlZddlm	Z	yddl
Z
Wnek
r}dZ
nXddl
Z
ejd�Zd�Zddd�ZiZd	�Zdd
�Zdd�Zdefd
��YZd�ZdS(s�
raven.utils
~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
i(tabsolute_import(t	iteritemststring_typesN(tupdate_wrappersraven.errorscG@sNi}xA|D]9}|sq
nx$t|�D]\}}|||<q,Wq
W|S(N(R(tdictstouttdtktv((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pytmerge_dictss
c@s��dkri�nt|�}|�kr:�|d�Sd�|<t|t�r{t��fd�t|�D��}nOt|ttf�r�g|D]}t�|�|�^q�}n�||�}�|=|S(sx
    Executes ``func(key_name, value)`` on all values
    recurisively discovering dict and list scoped
    values.
    s<...>ic3@s0|]&\}}|t�|�|�fVqdS(N(tvarmap(t.0RR(tcontexttfunc(sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pys	<genexpr>/sN(tNonetidt
isinstancetdictRtlistttupleR
(R
tvarRtnametobjidtrettf((RR
sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pyR
"s	

+cC@s,d}tdk	r=ytj|�jSWq=tk
r9q=Xnt|d�rX|j}nQt|d�rs|j}n6t|d�r�|j}nt|d�r�|j}nt	|�r�|�}nt
|ttt
f�s�d}n|dkr�dSt
|tt
f�r"djtt|��}nt|�S(Ntget_versiont__version__tVERSIONtversiont.(Rt
pkg_resourcestget_distributionRt	ExceptionthasattrRRRtcallableRRRRtjointmaptstr(tmodule_nametappR((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pytget_version_from_app>s.
	c@sF|s
iSt�}xM|D]E}|jd��|j�fd�tdt��d�D��qWi}x�|D]�}|tkryt|�Wntk
r�qpnXytj	|}Wnt
k
r�qpnXyt||�}Wn&tk
r
}t
j|�d}nX|t|<n
t|}|dkr4qpn|||<qpW|S(NRc3@s"|]}dj�| �VqdS(RN(R#(Rtidx(tparts(sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pys	<genexpr>isi(tsettsplittupdatetrangetlent_VERSION_CACHEt
__import__tImportErrortsystmodulestKeyErrorR(R tloggert	exceptionR(tmodule_listtext_module_listtmtversionsR&R'Rte((R*sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pytget_versionsbs:	
"






cK@sad|fd|fd|fd|fg}|rF|jd|f�nddjd�|D��S(	Ntsentry_timestampt
sentry_clienttsentry_versiont
sentry_keyt
sentry_secrets	Sentry %ss, cs@s%|]\}}d||fVqdS(s%s=%sN((RRR((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pys	<genexpr>�s(tappendR#(tprotocolt	timestamptclienttapi_keyt
api_secrettkwargstheader((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pytget_auth_header�s			tmemoizecB@s#eZdZd�Zdd�ZRS(s�
    Memoize the result of a property call.

    >>> class A(object):
    >>>     @memoize
    >>>     def func(self):
    >>>         return 'foo'
    cC@s1|j|_|j|_|j|_||_dS(N(t__name__t
__module__t__doc__R
(tselfR
((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pyt__init__�scC@sP|dkr|St|�|j}}||krH|j|�||<n||S(N(RtvarsRMR
(RPtobjttypeRtn((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pyt__get__�sN(RMRNRORQRRV(((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pyRL�s	c@s=tj�����fd��t����t�_�S(s Runs a thing once and once only.c@sG�jr
dS��.�jr!dS�||�}t�_|SWdQXdS(N(tcalledtTrue(targsRItrv(R
tlocktnew_func(sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pyR\�s			(t	threadingtLockRtFalseRW(R
((R
R[R\sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pytonce�s

	(ROt
__future__Rtraven.utils.compatRRtloggingR]t	functoolsRRR2RR3t	getLoggerR6R	R
R0R(R=RKtobjectRLR`(((sE/opt/alt/python27/lib/python2.7/site-packages/raven/utils/__init__.pyt<module>s&

		$'


?>