
     f8                       d dl mZ d dlZd dlZd dlZd dlZd dlZd dlm	Z	 d dl
mZ d dlmZmZmZmZmZmZmZmZmZ d dlmZ d dlZ ededef         	          Z ed
          Z ed          Zer*d dlmZm Z  d dl!m"Z"m#Z#m$Z$m%Z%  e"d          Z& e$d          Z'erdEdZ(nYej)        dk    rJd dl*Z* e*j+                    Z,e,-                    d           e,.                    d          Z/ e0e/d          Z(ndEdZ(dFdZ1dGd!Z2 G d" d#          Z3dHd*Z4dId.Z5 G d/ d0ee                   Z6dJd2Z7dKd5Z8erd d6lmZ ne8Ze G d7 d8e	                      Z9dLd;Z:er ed<ede;f         	          Z<	 	 dMdNdCZ=dS d dDl
m=Z= dS )O    )annotationsN)ABCMeta)update_wrapper)	TYPE_CHECKINGAny	AwaitableCallableGenericNoReturnSequenceTypeVarfinal)thread_localCallT.)boundTRetT)AsyncGeneratorTypeTracebackType)	ParamSpecSelfTypeVarTupleUnpackArgsTPosArgsTsignumintreturnNonec                    d S N r   s    M/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/trio/_util.pysignal_raiser%   *   s          ntzint raise(int);z!api-ms-win-crt-runtime-l1-1-0.dllraisec                R    t          j        t          j                    |            d S r!   )signalpthread_kill	threading	get_identr#   s    r$   r%   r%   Z   s$    I/116:::::r&   boolc                     	 t          j         t           j        t          j        t           j                             dS # t          t          f$ r Y dS w xY w)z7Attempt to reliably check if we are in the main thread.TF)r*   SIGINT	getsignal	TypeError
ValueErrorr"   r&   r$   is_main_threadr4   f   sT    fmV%5fm%D%DEEEtz"   uus   ;? AAasync_fn-Callable[[Unpack[PosArgsT]], Awaitable[RetT]]argsUnpack[PosArgsT]1collections.abc.Coroutine[object, NoReturn, RetT]c                   dd}t           j        dc}t           _        	  | | }n# t          $ r t          | t          j        j                  rH|                                  t          d| d| j         d	| j         d
| j         d| j         d          d  ||           rt          d| d          d  w xY w	 |t           _        n# |t           _        w xY wt          |t          j        j                  su ||          rt          d|d          t          j
        |          rt          d|          t          d                    t          | d|                               |S )Nvalueobjectr   r.   c                    t          | t          j        j                  rdS t	          | dd           dS | j        j        dv S )NT_asyncio_future_blocking)FutureDeferred)
isinstancecollectionsabc	Generatorgetattr	__class____name__)r;   s    r$   &_return_value_looks_like_wrong_libraryzBcoroutine_or_error.<locals>._return_value_looks_like_wrong_libraryw   sK     e[_677 	454d;;G4 '+AAAr&   triozLTrio was expecting an async function, but instead it got a coroutine object z/

Probably you did something like:

  trio.run(z4(...))            # incorrect!
  nursery.start_soon(zO(...))  # incorrect!

Instead, you want (notice the parentheses!):

  trio.run(z2, ...)            # correct!
  nursery.start_soon(z, ...)  # correct!z9Trio was expecting an async function, but instead it got u    – are you trying to use a library written for asyncio/twisted/tornado or similar? That won't work without some sort of compatibility shim.zTrio got unexpected zAstart_soon expected an async function but got an async generator zCTrio expected an async function, but {!r} appears to be synchronous__qualname__)r;   r<   r   r.   )sniffio_loopnamer2   rA   rB   rC   	CoroutinecloserG   inspect
isasyncgenformatrE   )r5   r7   rH   	prev_loopcoros        r$   coroutine_or_errorrT   s   s=   B B B B $0#4f I| $&x   h 9:: 	NNN&.N N
 '/N N )1(9N N '/N N )1(9N N N    21(;; 	;; ; ; 
  	= 	F &I%%%% dKO566 
11$77 	Kt K K K   d## 	&!& &    &>8!L!LMM
 
 	

 Ks   % C BB77C Cc                  *    e Zd ZdZddZddZddZdS )ConflictDetectora  Detect when two tasks are about to perform operations that would
    conflict.

    Use as a synchronous context manager; if two tasks enter it at the same
    time then the second one raises an error. You can use it when there are
    two pieces of code that *would* collide and need a lock if they ever were
    called at the same time, but that should never happen.

    We use this in particular for things like, making sure that two different
    tasks don't call sendall simultaneously on the same stream.

    msgstrr   r   c                "    || _         d| _        d S NF)_msg_held)selfrW   s     r$   __init__zConflictDetector.__init__   s    	


r&   c                T    | j         rt          j        | j                  d| _         d S )NT)r\   rI   BusyResourceErrorr[   )r]   s    r$   	__enter__zConflictDetector.__enter__   s*    : 	(333DJJJr&   exc_typetype[BaseException] | None	exc_valueBaseException | None	tracebackTracebackType | Nonec                    d| _         d S rZ   )r\   )r]   rb   rd   rf   s       r$   __exit__zConflictDetector.__exit__   s     


r&   N)rW   rX   r   r   )r   r   )rb   rc   rd   re   rf   rg   r   r   )rG   
__module__rJ   __doc__r^   ra   ri   r"   r&   r$   rV   rV      sZ                    r&   rV   clstype[object]wrapped_cls	attr_namerX   Callable[[CallT], CallT]c                     d fd}|S )z@Similar to wraps, but for async wrappers of non-async functions.funcr   r   c                    | _         d                    j        f          | _        dj         dj         d d| _        | S )N.zLike :meth:`~z`, but async.)rG   joinrJ   rj   rk   )rr   ro   rl   rn   s    r$   	decoratorzasync_wraps.<locals>.decorator   sT    !HHc&6	%BCCs{'=ss@Xss[dsssr&   )rr   r   r   r   r"   )rl   rn   ro   rv   s   ``` r$   async_wrapsrw      s5            r&   module_name	namespace$collections.abc.Mapping[str, object]c                     t                      d
 fd|                                D ]'\  }                    d	          s |           (d S )NqualnamerX   rL   objr<   r   r   c                   t          |          	v rd S 	                    t          |                     t          |dd           }||                    d          r|_        t          |d          r'd|j        vr||_        t          |d          r| |_        t          |t                    r6|j
                                        D ]\  }} dz   |z   ||           d S d S d S d S )Nrj   ztrio.rG   rt   rJ   )idaddrE   
startswithrj   hasattrrG   rJ   rA   type__dict__items)
r|   rL   r}   modro   
attr_valuefix_onerx   objnameseen_idss
         r$   r   z&fixup_module_metadata.<locals>.fix_one  s    c77hFRWWc<..?s~~g66?(CN sJ'' 0Cs|,C,C#3// 0'/C$#t$$ N-0\-?-?-A-A N N)IzGGcMI5y*MMMM ???N NN Nr&   _)r|   rX   rL   rX   r}   r<   r   r   )setr   r   )rx   ry   r}   r   r   r   s   `  @@@r$   fixup_module_metadatar      s     HN N N N N N N N N* ")) + +!!#&& 	+GGWc***+ +r&   c                  *    e Zd ZdZddZddZddZdS )generic_functiona;  Decorator that makes a function indexable, to communicate
    non-inferrable generic type parameters to a static type checker.

    If you write::

        @generic_function
        def open_memory_channel(max_buffer_size: int) -> Tuple[
            SendChannel[T], ReceiveChannel[T]
        ]: ...

    it is valid at runtime to say ``open_memory_channel[bytes](5)``.
    This behaves identically to ``open_memory_channel(5)`` at runtime,
    and currently won't type-check without a mypy plugin or clever stubs,
    but at least it becomes possible to write those.
    fnCallable[..., RetT]r   r   c                4    t          | |           || _        d S r!   )r   _fn)r]   r   s     r$   r^   zgeneric_function.__init__2  s    tR   r&   r7   r   kwargsr   c                     | j         |i |S r!   )r   )r]   r7   r   s      r$   __call__zgeneric_function.__call__6  s    tx((((r&   	subscriptr<   r   c                    | S r!   r"   )r]   r   s     r$   __getitem__zgeneric_function.__getitem__9  s    r&   N)r   r   r   r   )r7   r   r   r   r   r   )r   r<   r   r   )rG   rj   rJ   rk   r^   r   r   r"   r&   r$   r   r   !  sZ             ) ) ) )     r&   r   r   c                @    t          | j         d| j         d          )z5Raises an exception when a final class is subclassed.rt   z does not support subclassingr2   rj   rJ   )rl   s    r$   _init_final_clsr   =  s&    
s~WW(8WWW
X
XXr&   	decoratedtype[T]c                R    t          t                    | _        t          |           S )a8  Decorator that enforces a class to be final (i.e., subclass not allowed).

    If a class uses this metaclass like this::

        @final
        class SomeClass:
            pass

    The metaclass will ensure that no subclass can be created.

    Raises
    ------
    - TypeError if a subclass is created
    )classmethodr   __init_subclass__	std_final)r   s    r$   _final_implr   B  s"    " #.o">">IYr&   )r   c                  ,     e Zd ZdZddZd fdZ xZS )NoPublicConstructora  Metaclass that ensures a private constructor.

    If a class uses this metaclass like this::

        @final
        class SomeClass(metaclass=NoPublicConstructor):
            pass

    The metaclass will ensure that no instance can be initialized. This should always be
    used with @final.

    If you try to instantiate your class (SomeClass()), a TypeError will be thrown. Use
    _create() instead in the class's implementation.

    Raises
    ------
    - TypeError if an instance is created.
    r7   r<   r   r   r   c                @    t          | j         d| j         d          )Nrt   z has no public constructorr   )rl   r7   r   s      r$   r   zNoPublicConstructor.__call__s  s-    ~LL 0LLL
 
 	
r&   rl   r   r   c                6     t                      j        |i |S r!   )superr   )rl   r7   r   rF   s      r$   _createzNoPublicConstructor._createx  s    uww0000r&   )r7   r<   r   r<   r   r   )rl   r   r7   r<   r   r<   r   r   )rG   rj   rJ   rk   r   r   __classcell__)rF   s   @r$   r   r   ^  s[         &
 
 
 

1 1 1 1 1 1 1 1 1 1r&   r   agen$AsyncGeneratorType[object, NoReturn]c                   t          | d          st          |           S 	 | j        j        d         }n'# t          t
          f$ r d| j        j         d}Y nw xY w	 | j        }n# t          $ r | j        j	        }Y nw xY w| d| S )z{Return the fully-qualified name of the async generator function
    that produced the async generator iterator *agen*.
    ag_coderG   <>rt   )
r   reprag_frame	f_globalsAttributeErrorKeyErrorr   co_filenamerJ   co_name)r   moduler|   s      r$   name_asyncgenr   |  s     4## Dzz1(4H% 1 1 10T\-0001($ ( ( (<'(!!x!!!s!   4 !AAA$ $A=<A=FnwrappedCallable[..., object]assignedSequence[str]updatedCallable[[Fn], Fn]c                    d S r!   r"   )r   r   r   s      r$   wrapsr     s	     !Sr&   )r   )r   r   r   r   )r   r.   )r5   r6   r7   r8   r   r9   )rl   rm   rn   rm   ro   rX   r   rp   )rx   rX   ry   rz   r   r   )rl   rm   r   r   )r   r   r   r   )r   r   r   rX   )..)r   r   r   r   r   r   r   r   )>
__future__r   collections.abcrB   rO   osr*   r,   rC   r   	functoolsr   typingr   r   r   r	   r
   r   r   r   r   r   sniffior   rK   rI   r   r   r   typesr   r   typing_extensionsr   r   r   r   r   r   r%   rL   cffiFFI_fficdefdlopen_librE   r4   rT   rV   rw   r   r   r   r   r   r   r<   r   r   r"   r&   r$   <module>r      s   " " " " " "      				            $ $ $ $ $ $
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 1 0 0 0 0 0 xS1222GCLLwv (77777777GGGGGGGGGGGGIgE|J''H  3;..... W__H KKK48::DII   ;;:;;D74))LL; ; ; ;   V V V Vr       B   $+ + + +D    wt}   8Y Y Y Y
       ,  E 1 1 1 1 1' 1 1 1:" " " "$  
 	Xc6k2	3	3	3B #&!$! ! ! ! ! ! !  r&   