Ë
    ïñþi	  ã                   óP   — d Z ddlmZmZmZ ddlZ ed«      Z G d„ dee   «      Zy)zÌ
Resolver - An anyio-compatible future-like object for async result passing.

This provides a simple way to pass a result (or exception) from one coroutine
to another without depending on asyncio.Future.
é    )ÚGenericÚTypeVarÚcastNÚTc                   óP   — e Zd ZdZdd„Zdeddfd„Zdeddfd„Zdefd	„Z	de
fd
„Zy)ÚResolverai  
    A simple resolver for passing results between coroutines.

    Unlike asyncio.Future, this works with any anyio-compatible async backend.

    Usage:
        resolver: Resolver[str] = Resolver()

        # In one coroutine:
        resolver.set_result("hello")

        # In another coroutine:
        result = await resolver.wait()  # returns "hello"
    ÚreturnNc                 óR   — t        j                  «       | _        d | _        d | _        y )N)ÚanyioÚEventÚ_eventÚ_valueÚ
_exception©Úselfs    úf/root/aria/mcps/aria-brain/venv/lib/python3.12/site-packages/mcp/shared/experimental/tasks/resolver.pyÚ__init__zResolver.__init__   s   € Ü—k‘k“mˆŒØ $ˆŒØ04ˆ�ó    Úvaluec                 ó�   — | j                   j                  «       rt        d«      ‚|| _        | j                   j	                  «        y)z)Set the result value and wake up waiters.úResolver already completedN)r   Úis_setÚRuntimeErrorr   Úset)r   r   s     r   Ú
set_resultzResolver.set_result$   s3   € à�;‰;×ÑÔÜÐ;Ó<Ð<ØˆŒØ�‰�‰Õr   Úexcc                 ó�   — | j                   j                  «       rt        d«      ‚|| _        | j                   j	                  «        y)z%Set an exception and wake up waiters.r   N)r   r   r   r   r   )r   r   s     r   Úset_exceptionzResolver.set_exception+   s3   € à�;‰;×ÑÔÜÐ;Ó<Ð<ØˆŒØ�‰�‰Õr   c              ƒ   ó¶   K  — | j                   j                  «       ƒ d{  –—†  | j                  �| j                  ‚t        t        | j
                  «      S 7 Œ6­w)z:Wait for the result and return it, or raise the exception.N)r   Úwaitr   r   r   r   r   s    r   r    zResolver.wait2   sF   è ø€ à�k‰k×ÑÓ × Ð Ø�?‰?Ð&Ø—/‘/Ð!ä”A�t—{‘{Ó#Ð#ð	 	!ús   ‚A A¡7Ac                 ó6   — | j                   j                  «       S )z/Return True if the resolver has been completed.)r   r   r   s    r   ÚdonezResolver.done:   s   € à�{‰{×!Ñ!Ó#Ð#r   )r	   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   ÚBaseExceptionr   r    Úboolr"   © r   r   r   r      sJ   „ ñó5ð
 ð  dó ð ð °4ó ð$˜Aó $ð$�dô $r   r   )r&   Útypingr   r   r   r   r   r   r)   r   r   ú<module>r+      s.   ðñ÷ *Ñ )ã áˆCƒL€ô-$ˆw�q‰zõ -$r   