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 / vine / funtools.pyc
Size: Mime:
ó
ŽEYc@@s²dZddlmZmZddlmZddlmZdddd	d
ddd
gZd„Z	d„Z
d„Zd„Zdd„Zd„Zd„Zd„Zd„ZdS(uFunctional utilities.i(tabsolute_importtunicode_literalsi(tThenable(tpromiseu
maybe_promiseuensure_promiseuppartialupreplaceu
ready_promiseustarpromiseu	transformuwrapcC@s&|r"t|tƒs"t|ƒSn|S(uAReturn None if p is unefined, otherwise make sure it's a promise.(t
isinstanceRR(tp((sB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pyt
maybe_promises
cC@s|dkrtƒSt|ƒS(ueEnsure p is a promise.

    If p is not a promise, a new promise is created with p' as callback.
    N(tNoneRR(R((sB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pytensure_promisescO@sBt|ƒ}|r%||j|_n|r>|jj|ƒn|S(u-Create/modify promise with partial arguments.(Rtargstkwargstupdate(RR	R
((sB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pytppartial sc@s‡‡‡fd†}t|ƒS(u¸Replace promise arguments.

    This will force the promise to disregard any arguments
    the promise is fulfilled with, and to be called with the
    provided arguments instead.
    c@s
ˆˆˆŽS(N((t_t__(R	R
R(sB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pyt	_replacer1s(R(RR	R
R((R	R
RsB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pytpreplace*scG@st|ƒ}||Œ|S(u)Create promise that is already fulfilled.(R(tcallbackR	R((sB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pyt
ready_promise6s
cO@st|||ƒS(u%Create promise, using star arguments.(R(tfunR	R
((sB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pytstarpromise=scO@sAt|ƒ}tt||||fƒ}|jtƒ|jƒ|S(u?Filter final argument to a promise.

    E.g. to coerce callback argument to :class:`int`::

        transform(int, callback)

    or a more complex example extracting something from a dict
    and coercing the value to :class:`float`:

    .. code-block:: python

        def filter_key_value(key, filter_, mapping):
            return filter_(mapping[key])

        def get_page_expires(self, url, callback=None):
            return self.request(
                'GET', url,
                callback=transform(get_key, callback, 'PageExpireValue', int),
            )

    (RRt
_transbacktthentthrow(tfilter_Rtfilter_argst
filter_kwargstP((sB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pyt	transformBscC@sFy|||f|Ž}Wntk
r7|jƒnX||ƒSdS(N(t	ExceptionR(RRR	R
tret((sB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pyR^s

c@s‡fd†}|S(užWrap promise.

    This wraps the promise such that if the promise is called with a promise as
    argument, we attach ourselves to that promise instead.
    c@sGt|ƒdkr6t|dtƒr6|djˆƒSˆ||ŽSdS(Nii(tlenRRR(R	R
(R(sB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pyton_callms%((RR ((RsB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pytwrapgsN(t__doc__t
__future__RRtabstractRtpromisesRt__all__RRRRRRRRRR!(((sB/home/tvault/.virtenv/lib/python2.7/site-packages/vine/funtools.pyt<module>s