
     f              	         d dl mZ d dlZd dlmZmZmZmZmZm	Z	m
Z
mZmZmZ d dlZddlmZmZ erd dlmZmZ  ed          Znd Zg d	Z ed
d          Z ed          Zed)d            Zed*d            Zd*dZed+d            Zed,d            Zd,d Z ej        d!d!d"           G d# d$ej        e	e                               Ze ej        dd!d%           G d& d'ee         e	e                                           Ze ej        dd!d%           G d( dee
                                           Zeee         ef         Z dS )-    )annotationsN)
TYPE_CHECKINGAsyncGenerator	AwaitableCallable	GeneratorGenericNoReturnTypeVarUnionoverload   )AlreadyUsedErrorremove_tb_frames)	ParamSpecfinalArgsTc                    | S N )funcs    P/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/outcome/_impl.pyr   r      s        )ErrorOutcomeMaybeValueacapturecaptureValueTT)	covariantResultTsync_fnCallable[ArgsT, NoReturn]args
ArgsT.argskwargsArgsT.kwargsreturnr   c                    d S r   r   r#   r%   r'   s      r   r   r   $   s	     Cr   Callable[ArgsT, ResultT]Value[ResultT] | Errorc                    d S r   r   r+   s      r   r   r   .   s	     Cr   c                    	 t           | |i |          S # t          $ r)}t          |d          }t          |          cY d}~S d}~ww xY w)zRun ``sync_fn(*args, **kwargs)`` and capture the result.

    Returns:
      Either a :class:`Value` or :class:`Error` as appropriate.

    r   Nr   BaseExceptionr   r   )r#   r%   r'   excs       r   r   r   7   sm    WWd-f--...   sA&&Szzs    
A
AA
A
async_fn$Callable[ArgsT, Awaitable[NoReturn]]c                
   K   d S r   r   r3   r%   r'   s      r   r   r   I          Cr   #Callable[ArgsT, Awaitable[ResultT]]c                
   K   d S r   r   r6   s      r   r   r   R   r7   r   c                   K   	 t           | |i | d{V           S # t          $ r)}t          |d          }t          |          cY d}~S d}~ww xY w)zRun ``await async_fn(*args, **kwargs)`` and capture the result.

    Returns:
      Either a :class:`Value` or :class:`Error` as appropriate.

    Nr   r0   )r3   r%   r'   r2   s       r   r   r   [   s      88T4V44444444555   sA&&Szzs    
AAAAF)reprinitslotsc                      e Zd ZU dZ ej        ddd          Zded<   ddZe	j
        dd
            Ze	j
        dd            Ze	j
        dd            ZdS )r   a;  An abstract class representing the result of a Python computation.

    This class has two concrete subclasses: :class:`Value` representing a
    value, and :class:`Error` representing an exception.

    In addition to the methods described below, comparison operators on
    :class:`Value` and :class:`Error` objects (``==``, ``<``, etc.) check that
    the other object is also a :class:`Value` or :class:`Error` object
    respectively, and then compare the contained objects.

    :class:`Outcome` objects are hashable if the contained objects are
    hashable.

    F)defaulteqr<   bool
_unwrappedr)   Nonec                Z    | j         rt          t                              | dd           d S )NrB   T)rB   r   object__setattr__selfs    r   _set_unwrappedzOutcome._set_unwrapped   s0    ? 	#""4t44444r   r    c                    dS )zReturn or raise the contained value or exception.

        These two lines of code are equivalent::

           x = fn(*args)
           x = outcome.capture(fn, *args).unwrap()

        Nr   rG   s    r   unwrapzOutcome.unwrap         r   gen"Generator[ResultT, ValueT, object]r"   c                    dS )zSend or throw the contained value or exception into the given
        generator object.

        Args:
          gen: A generator object supporting ``.send()`` and ``.throw()``
              methods.

        Nr   rH   rM   s     r   sendzOutcome.send   rL   r   agenAsyncGenerator[ResultT, ValueT]c                
   K   dS )zSend or throw the contained value or exception into the given async
        generator object.

        Args:
          agen: An async generator object supporting ``.asend()`` and
              ``.athrow()`` methods.

        Nr   rH   rR   s     r   asendzOutcome.asend   s
        r   N)r)   rC   r)   r    rM   rN   r)   r"   rR   rS   r)   r"   )__name__
__module____qualname____doc__attribrB   __annotations__rI   abcabstractmethodrK   rQ   rV   r   r   r   r   r   m   s           twuUCCCJCCCC5 5 5 5
 	    	    	     r   r   )frozenr;   r=   c                  ^    e Zd ZU dZ ej                    Zded<   	 ddZddZ	ddZ
ddZdS )r   zFConcrete :class:`Outcome` subclass representing a regular value.

    r    valuer)   strc                    d| j         dS )NzValue())re   rG   s    r   __repr__zValue.__repr__       '
''''r   c                8    |                                   | j        S r   )rI   re   rG   s    r   rK   zValue.unwrap   s    zr   rM   rN   r"   c                ^    |                                   |                    | j                  S r   )rI   rQ   re   rP   s     r   rQ   z
Value.send   s(    xx
###r   rR   rS   c                n   K   |                                   |                    | j                   d {V S r   )rI   rV   re   rU   s     r   rV   zValue.asend   s>      ZZ
+++++++++r   Nr)   rf   rW   rX   rY   )rZ   r[   r\   r]   r^   r_   re   r`   ri   rK   rQ   rV   r   r   r   r   r      s           DGIIE( ( ( (   $ $ $ $, , , , , ,r   r   c                      e Zd ZU dZ ej        ej                            e                    Z	de
d<   	 ddZdd	ZddZddZdS )r   zIConcrete :class:`Outcome` subclass representing a raised exception.

    )	validatorr1   errorr)   rf   c                    d| j         dS )NzError(rh   )rq   rG   s    r   ri   zError.__repr__   rj   r   r
   c                L    |                                   | j        }	 |# ~~ w xY wr   )rI   rq   )rH   captured_errors     r   rK   zError.unwrap   s<     	%   $$$$s    #rM   $Generator[ResultT, NoReturn, object]r"   c                ^    |                                   |                    | j                  S r   )rI   throwrq   rP   s     r   rQ   z
Error.send   s(    yy$$$r   rR   !AsyncGenerator[ResultT, NoReturn]c                n   K   |                                   |                    | j                   d {V S r   )rI   athrowrq   rU   s     r   rV   zError.asend   s>      [[,,,,,,,,,r   Nrn   )r)   r
   )rM   ru   r)   r"   )rR   rx   r)   r"   )rZ   r[   r\   r]   r^   r_   
validatorsinstance_ofr1   rq   r`   ri   rK   rQ   rV   r   r   r   r   r      s           #47/--m<<  E     *( ( ( (% % % %,% % % %- - - - - -r   )r#   r$   r%   r&   r'   r(   r)   r   )r#   r,   r%   r&   r'   r(   r)   r-   )r3   r4   r%   r&   r'   r(   r)   r   )r3   r8   r%   r&   r'   r(   r)   r-   )!
__future__r   ra   typingr   r   r   r   r   r	   r
   r   r   r   r^   _utilr   r   typing_extensionsr   r   r   __all__r    r"   r   r   sABCr   r   r   r   r   r   r   <module>r      s   " " " " " " 



                         5 5 5 5 5 5 5 5 22222222IgEE   H
G
G	T	*	*	*
')

 
   
 
   
   $ 
   
 
   
   $ Ud+++5 5 5 5 5cgwv 5 5 ,+5p t%t,,,, , , , ,GFOWV_ , , -, ,0 t%t,,,)- )- )- )- )-GH )- )- -, )-Z 	eFmU"#r   