HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/local/lib/python3.9/site-packages/vine/__pycache__/funtools.cpython-39.pyc
a

X>h.�@srdZddlmZddlmZgd�Zdd�Zdd�Zd	d
�Zdd�Z	ddd�Z
dd�Zdd�Zdd�Z
dd�Zd
S)zFunctional utilities.�)�Thenable��promise)�
maybe_promise�ensure_promise�ppartial�preplace�
ready_promise�starpromise�	transform�wrapcCs|rt|t�st|�S|S)zBReturn None if p is undefined, otherwise make sure it's a promise.)�
isinstancerr��p�r�7/usr/local/lib/python3.9/site-packages/vine/funtools.pyrs
rcCs|durt�St|�S)zeEnsure p is a promise.

    If p is not a promise, a new promise is created with p' as callback.
    N)rrrrrrrsrcOs,t|�}|r||j|_|r(|j�|�|S)z-Create/modify promise with partial arguments.)r�args�kwargs�update)rrrrrrrsrcs���fdd�}t|�S)z�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.
    cs��i���S�Nr)�_�__�rrrrr�	_replacer/szpreplace.<locals>._replacerr)rrrrrrrr(srNcGst|�}||�|S)z)Create promise that is already fulfilled.)r)�callbackrrrrrr	4sr	cOst|||�S)z%Create promise, using star arguments.r)Zfunrrrrrr
;sr
cOs.t|�}tt||||f�}|�t�|j�|S)a?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),
            )

    )rr�
_transback�then�throw)�filter_rZfilter_args�
filter_kwargs�Prrrr@srcCs@z|||fi|��}Wnty2|��Yn
0||�SdSr)�	Exceptionr)rrrr�retrrrr\s
rcs�fdd�}|S)z�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.
    cs:t|�dkr(t|dt�r(|d���S�|i|��SdS)Nr�)�lenr
rr)rrrrr�on_callkszwrap.<locals>.on_callr)rr%rrrresr)N)�__doc__ZabstractrZpromisesr�__all__rrrrr	r
rrrrrrr�<module>s