Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / kombu / utils / functional.pyc
Size: Mime:
ó
öEYc	@@sdZddlmZmZddlZddlZddlZddlmZm	Z	m
Z
ddlmZm
Z
ddlmZddlmZddlmZmZmZmZmZd	d
lmZddd
ddddgZeƒZedefd„ƒYƒZdefd„ƒYZdded„Z!edefd„ƒYƒZ"d„Z#e	efefd„Z$e	efd„Z%dd„Z&d„Z'ddde(d„Z)dddd d!„Z*giddd"d"d#dd$„Z+d%d&d'„Z,d)id%d(„Z-e"Z.e#Z/dS(*uFunctional Utilities.i(tabsolute_importtunicode_literalsN(tIterabletMappingtOrderedDict(tcounttrepeat(tsleep(twraps(tUserDicttitemstkeystpython_2_unicode_compatibletstring_ti(t	safe_repruLRUCacheumemoizeulazyumaybe_evaluateuis_listu
maybe_listu
dictfiltertChannelPromisecB@s#eZd„Zd„Zd„ZRS(cC@s
||_dS(N(t__contract__(tselftcontract((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__init__scC@s7y|jSWn%tk
r2|jƒ}|_|SXdS(N(t	__value__tAttributeErrorR(Rtvalue((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__call__"s

cC@s<yt|jƒSWn$tk
r7djt|jƒƒSXdS(Nu<promise: 0x{0:x}>(treprRRtformattidR(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__repr__)s
(t__name__t
__module__RRR(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyRs		tLRUCachecB@sØeZdZdd„Zd„Zd„Zed„Zd„Z	d„Z
d„ZeZd„Z
e
Zd	„ZeZd
d„Zd„Zd
„Zejddkr»eZe
ZeZnd„Zd„Zd„ZRS(u?LRU Cache implementation using a doubly linked list to track access.

    Arguments:
        limit (int): The maximum number of keys to keep in the cache.
            When a new key is inserted and the limit has been exceeded,
            the *Least Recently Used* key will be discarded from the
            cache.
    cC@s(||_tjƒ|_tƒ|_dS(N(tlimitt	threadingtRLocktmutexRtdata(RR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyR:s	cC@s2|j#|jj|ƒ}||<|SWdQXdS(N(R"R#tpop(RtkeyR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__getitem__?s
c	O@sƒ|jt|j|j}}|j||Ž|ryt|ƒ|kryx1tt|ƒ|ƒD]}|jdtƒq\WnWdQXdS(Ntlast(R"R#RtupdatetlentrangetpopitemtFalse(RtargstkwargsR#Rt_((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyR(Ds
cC@s$|j|jj|ƒSWdQXdS(N(R"R#R+(RR'((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyR+Ms
c	C@sd|jU|jrMt|jƒ|jkrM|jjtt|jƒƒƒn||j|<WdQXdS(N(R"RR)R#R$tnexttiter(RR%R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__setitem__Qs
!"cC@s
t|jƒS(N(R1R#(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__iter__Xsc
c@sO|j@x8|D]0}y||j|fVWqtk
r@qXqWWdQXdS(N(R"R#tKeyError(Rtk((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt_iterate_items[s


c
c@sI|j:x2|D]*}y|j|VWqtk
r:qXqWWdQXdS(N(R"R#R4(RR5((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt_iterate_valuesds


cC@s!|jt|jƒSWdQXdS(N(R"RR#(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt
_iterate_keysns
icC@sD|j5t|jj|ƒƒ|}t|ƒ||<|SWdQXdS(N(R"tintR#R$tstr(RR%tdeltatnewval((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pytincrts
cC@s#tt|ƒƒ}|jdƒ|S(Numutex(tdicttvarsR$(Rtd((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__getstate__|s
cC@s||_tjƒ|_dS(N(t__dict__R R!R"(Rtstate((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__setstate__s	iicC@st|jƒƒS(N(tlistR8(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyR‹scC@st|jƒƒS(N(RER7(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pytvaluesŽscC@st|jƒƒS(N(RER6(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyR
‘sN(RRt__doc__tNoneRR&R(tTrueR+R2R3R6t	iteritemsR7t
itervaluesR8titerkeysR=RARDtsystversion_infoRRFR
(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyR0s.													c@s‡‡‡fd†}|S(u)Decorator to cache function return value.c@sztjƒ‰ˆdˆƒ‰tˆƒ‡‡‡‡‡fd†ƒ‰‡‡fd†}dˆ_ˆ_|ˆ_ˆˆ_ˆS(NRc@s²ˆrˆ||ƒ}n#|tftt|jƒƒƒ}yˆˆ|}WdQXWnFtk
ržˆ||Ž}ˆjd7_ˆ|ˆ|<WdQXnXˆjd7_|S(Ni(tKEYWORD_MARKttupletsortedR
R4tmissesthits(R-R.R%R(t_MtcachetfuntkeyfunR"(sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyRT›s#
c@sˆjƒdˆ_ˆ_dS(u+Clear the cache and reset cache statistics.iN(tclearRSRR((RTRU(sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyRX­s
i(R tLockRRSRRRXt
original_func(RVRX(tCacheRWtmaxsize(RTRURVR"sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt_memoize—s'		((R\RWR[R]((R[RWR\sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pytmemoize•s tlazycB@s~eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zej
d
dkr|d„ZnRS(
u
Holds lazy evaluation.

    Evaluated when called or if the :meth:`evaluate` method is called.
    The function is re-evaluated on every call.

    Overloaded operations that will evaluate the promise:
        :meth:`__str__`, :meth:`__repr__`, :meth:`__cmp__`.
    cO@s||_||_||_dS(N(t_funt_argst_kwargs(RRVR-R.((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyRÅs		cC@s
|jƒS(N(tevaluate(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyRÊscC@s|j|j|jŽS(N(R`RaRb(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyRcÍscC@s
t|ƒƒS(N(R:(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__str__ÐscC@s
t|ƒƒS(N(R(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyRÓscC@s
|ƒ|kS(N((Rtrhs((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__eq__ÖscC@s
|ƒ|kS(N((RRe((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__ne__ÙscC@s||t|ƒ<|S(N(R(Rtmemo((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__deepcopy__ÜscC@s*|j|jfi|jd6|jd6fS(Nu_argsu_kwargs(t	__class__R`RaRb(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt
__reduce__àsiicC@s3t||jƒr#t||ƒƒSt|ƒ|ƒS(N(t
isinstanceRjtcmp(RRe((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt__cmp__æs(RRRGRRRcRdRRfRgRiRkRMRNRn(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyR_ºs										cC@st|tƒr|jƒS|S(u9Evaluate value only if value is a :class:`lazy` instance.(RlR_Rc(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pytmaybe_evaluateìs
cC@s#t||ƒo"t||pdƒS(unReturn true if the object is iterable.

    Note:
        Returns false if object is a mapping or string.
    ((Rl(tltscalarstiters((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pytis_listóscC@s&|dkst||ƒr|S|gS(u0Return list of one element if ``l`` is a scalar.N(RHRs(RpRq((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt
maybe_listüscK@sA|dkr|n|r't||n|}d„t|ƒDƒS(u=Remove all keys from dict ``d`` whose value is :const:`None`.cS@s+i|]!\}}|dk	r||“qS(N(RH(t.0R5tv((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pys
<dictcomp>s	N(RHR>R
(R@tkw((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt
dictfilters-cc@sCt|ƒ}tj}x'tdƒD]}||ƒ|dVq"WdS(Ni(REtrandomtshuffleRRH(titRzR/((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pytshufflecycles
	
gð?cc@sL|d}x;|s ||kr2|V||7}q
|s<Pn||Vq
dS(Ngð?((tstarttstoptstept
repeatlasttcur((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pytfxranges

gY@cc@s`d|d}}xH||kr$Pn|V|rEt|||ƒ}n
||7}||7}qdS(Nigð?(tmin(R}R~Rtmaxtsum_R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt
fxrangemaxs
iic
C@s
d}
t||||dtƒ}xätƒD]Ù}
y|||ŽSWq,|k
r}|rm|
|krm‚n|	r}|	ƒnt|r˜||||
ƒn	t|ƒƒ}
|
rx4tt|
ƒƒD] }|	rÖ|	ƒntdƒqÀWttt|
ƒ|
ƒƒqq,Xq,WdS(uaRetry the function over and over until max retries is exceeded.

    For each retry we sleep a for a while before we try again, this interval
    is increased for every retry until the max seconds is reached.

    Arguments:
        fun (Callable): The function to try
        catch (Tuple[BaseException]): Exceptions to catch, can be either
            tuple or a single exception class.

    Keyword Arguments:
        args (Tuple): Positional arguments passed on to the function.
        kwargs (Dict): Keyword arguments passed on to the function.
        errback (Callable): Callback for when an exception in ``catch``
            is raised.  The callback must take three arguments:
            ``exc``, ``interval_range`` and ``retries``, where ``exc``
            is the exception instance, ``interval_range`` is an iterator
            which return the time in seconds to sleep next, and ``retries``
            is the number of previous retries.
        max_retries (int): Maximum number of retries before we give up.
            If this is not set, we will retry forever.
        interval_start (float): How long (in seconds) we start sleeping
            between retries.
        interval_step (float): By how much the interval is increased for
            each retry.
        interval_max (float): Maximum number of seconds to sleep
            between retries.
    iR€gð?N(	R‚RIRtfloatR0R*R9Rtabs(RVtcatchR-R.terrbacktmax_retriestinterval_startt
interval_steptinterval_maxtcallbacktretriestinterval_rangetexctttsR/((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pytretry_over_time(s(

u, u{0}={1}c@s#|j‡fd†t|ƒDƒƒS(Nc3@s-|]#\}}ˆj|t|ƒƒVqdS(N(Rt
_safe_repr(RuR5Rv(tfmt(sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pys	<genexpr>_s(tjoinR
(R.tsepR–((R–sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt
reprkwargs^scC@sIdj||jtt|pdƒƒ|r6|r6|p9dt||ƒƒS(Nu{0}({1}{2}{3})u((RR—tmapR•R™(tnameR-R.R˜((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pytreprcallbs((0RGt
__future__RRRyRMR tcollectionsRRRt	itertoolsRRttimeRt
vine.utilsRt
kombu.fiveR	R
RRR
tencodingRR•t__all__tobjectRORRRHR^R_RoRsRtRxR|R,R‚R†R”R™Rœtpromiset
maybe_promise(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/kombu/utils/functional.pyt<module>sB(	e%1			
		4