Ë
    åU.j.  ã                   ó`   — d Z ddlmZ ddlmZ g d¢Zd„ Zd„ Zd„ Zd„ Z	dd
„Z
d„ Zd„ Zd„ Zd„ Zy	)zFunctional utilities.é   )ÚThenable©Úpromise)Úmaybe_promiseÚensure_promiseÚppartialÚpreplaceÚready_promiseÚstarpromiseÚ	transformÚwrapc                 ó@   — | rt        | t        «      st        | «      S | S )zBReturn None if p is undefined, otherwise make sure it's a promise.)Ú
isinstancer   r   ©Úps    úOC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\vine/funtools.pyr   r      s   € áÜ˜!œXÔ&Ü˜1“:ÐØ€Hó    c                 ó0   — | €
t        «       S t        | «      S )zeEnsure p is a promise.

    If p is not a promise, a new promise is created with p' as callback.
    )r   r   r   s    r   r   r      s   € ð
 	€yÜ‹yÐÜ˜ÓÐr   c                 ó‚   — t        | «      } |r|| j                  z   | _        |r| j                  j                  |«       | S )z-Create/modify promise with partial arguments.)r   ÚargsÚkwargsÚupdate)r   r   r   s      r   r   r      s6   € ä�qÓ€AÙØ˜Ÿ™‘ˆŒÙØ	�‰�‰˜ÔØ€Hr   c                 ó,   ‡ ‡‡— ˆˆˆ fd„}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.
    c                  ó   •—  ‰‰i ‰¤ŽS ©N© )Ú_Ú__r   r   r   s     €€€r   Ú	_replacerzpreplace.<locals>._replacer/   s   ø€ Ù�$Ð!˜&Ñ!Ð!r   r   )r   r   r   r   s   ``` r   r	   r	   (   s   ú€ ö"ä�9ÓÐr   Nc                 ó&   — t        | «      } ||Ž  |S )z)Create promise that is already fulfilled.)r   )Úcallbackr   r   s      r   r
   r
   4   s   € ä�xÓ €AÙ€t�HØ€Hr   c                 ó   — t        | ||«      S )z%Create promise, using star arguments.r   )Úfunr   r   s      r   r   r   ;   s   € ä�3˜˜fÓ%Ð%r   c                 óŒ   — t        |«      }t        t        | |||f«      }|j                  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),
            )

    )r   r   Ú
_transbackÚthenÚthrow)Úfilter_r!   Úfilter_argsÚfilter_kwargsÚPs        r   r   r   @   s<   € ô, ˜hÓ'€HÜ”
˜W h°¸]ÐKÓL€AØ‡F�FŒ7‹9�h—n‘nÔ%Ø€Hr   c                 ój   — 	  | ||fz   i |¤Ž} ||«      S # t         $ r |j                  «        Y y w xY wr   )Ú	Exceptionr'   )r(   r!   r   r   Úrets        r   r%   r%   \   sC   € ðÙ�t˜s˜f‘}Ð/¨Ñ/ˆñ ˜‹}Ðøô ò Ø�‰Öðús   ‚ –2±2c                 ó   ‡ — ˆ fd„}|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.
    c                  ó~   •— t        | «      dk(  r't        | d   t        «      r| d   j                  ‰«      S  ‰| i |¤ŽS )Nr   é    )Úlenr   r   r&   )r   r   r   s     €r   Úon_callzwrap.<locals>.on_callk   s=   ø€ Üˆt‹9˜Š>œj¨¨a©´'Ô:Ø˜‘7—<‘< “?Ð"á�dÐ%˜fÑ%Ð%r   r   )r   r3   s   ` r   r   r   e   s   ø€ ô&ð €Nr   r   )Ú__doc__Úabstractr   Úpromisesr   Ú__all__r   r   r   r	   r
   r   r   r%   r   r   r   r   Ú<module>r8      sB   ðÙ Ý Ý ò€òòòò	óò&ò
ò8ór   