U
    	fq'                     @  sx  d dl mZ d dlZd dlZd dlmZmZ d dlmZm	Z	m
Z
 d dlmZ d dlmZ d dlmZmZmZ d dlmZmZmZmZmZmZmZmZ ejd	krd d
lmZmZ nd d
lmZmZ erRd dlmZ ddl m!Z!m"Z" ddl#m$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/m0Z0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 edZ8edZ9G dd dedZ:dS )    )annotationsN)ABCMetaabstractmethod)AsyncIterator	AwaitableMapping)PathLike)Signals)AddressFamily
SocketKindsocket)IOTYPE_CHECKINGAnyCallableContextManagerSequenceTypeVaroverload)      )TypeVarTupleUnpack)Literal   )CapacityLimiterEvent)CancelScope)TaskInfo)BlockingPortal   )ConnectedUDPSocketConnectedUNIXDatagramSocketIPSockAddrTypeSocketListenerSocketStream	UDPSocketUNIXDatagramSocketUNIXSocketStream)Process)	TaskGroup)
TestRunnerT_RetvalPosArgsTc                   @  s<  e Zd ZeeddddddddZeedd	d
dZeedd	ddZeedd	ddZeedd	ddZ	edd	ddZ
edd	ddZeedddddZeeejdddddd d!d"Zeedd	d#d$Zeed%d	d&d'Zeed(d	d)d*Zeedd+d,d-d.Zeedd0ddd1dd2d3d4Zeedd	d5d6Zeeddddd7d8d9Zeed0dddd7d:d;Zeed<d	d=d>Zeed/d/dd?d@dAdBdBdBdCdDddEdF	dGdHZeed/d/dd?dIdJdBdBdBdCdDddEdF	dKdHZeed/d/dd?dLddBdBdBdCdDddEdF	dMdHZeedNddOdPdQZeeddRdSdTdUdVdWdXZeed@dYdZd[d\Zeed]d^d_d`daZeed]d^d_dbdcZeedddTdTddedfdgdhZ eed]ddidjdkdlZ!eed]d@dmdjdndlZ!eed]dodpdjdqdlZ!eedrdrdrdrdsdtdudvdwdSdSdxdydzd{Z"eedd|dSd}d~ddZ#eed]dd_ddZ$eed]dd_ddZ%eed+d	ddZ&eedddddZ'eedd	ddZ(eedd	ddZ)eedd	ddZ*eedddddZ+d/S )AsyncBackendz1Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]]ztuple[Unpack[PosArgsT]]zdict[str, Any]r,   )funcargskwargsoptionsreturnc                 C  s   dS )a  
        Run the given coroutine function in an asynchronous event loop.

        The current thread must not be already running an event loop.

        :param func: a coroutine function
        :param args: positional arguments to ``func``
        :param kwargs: positional arguments to ``func``
        :param options: keyword arguments to call the backend ``run()`` implementation
            with
        :return: the return value of the coroutine function
        N )clsr/   r0   r1   r2   r4   r4   W/var/www/html/apigroqsegura/apigroq/lib/python3.8/site-packages/anyio/abc/_eventloop.pyrun4   s    	zAsyncBackend.runobject)r3   c                 C  s   dS )z

        :return:
        Nr4   r5   r4   r4   r6   current_tokenJ   s    zAsyncBackend.current_tokenfloatc                 C  s   dS )zz
        Return the current value of the event loop's internal clock.

        :return: the clock value (seconds)
        Nr4   r9   r4   r4   r6   current_timeR   s    zAsyncBackend.current_timeztype[BaseException]c                 C  s   dS )zFReturn the exception class that is raised in a task if it's cancelled.Nr4   r9   r4   r4   r6   cancelled_exception_class[   s    z&AsyncBackend.cancelled_exception_classNonec                   s   dS )z
        Check if the task has been cancelled, and allow rescheduling of other tasks.

        This is effectively the same as running :meth:`checkpoint_if_cancelled` and then
        :meth:`cancel_shielded_checkpoint`.
        Nr4   r9   r4   r4   r6   
checkpoint`   s    zAsyncBackend.checkpointc                   s"   |   tj kr|  I dH  dS )z
        Check if the current task group has been cancelled.

        This will check if the task has been cancelled, but will not allow other tasks
        to be scheduled if not.

        N)current_effective_deadlinemathinfr?   r9   r4   r4   r6   checkpoint_if_cancelledj   s    	z$AsyncBackend.checkpoint_if_cancelledc              	     s,   | j dd | dI dH  W 5 Q R X dS )z
        Allow the rescheduling of other tasks.

        This will give other tasks the opportunity to run, but without checking if the
        current task group has been cancelled, unlike with :meth:`checkpoint`.

        T)shieldr   N)create_cancel_scopesleepr9   r4   r4   r6   cancel_shielded_checkpointv   s    	z'AsyncBackend.cancel_shielded_checkpoint)delayr3   c                   s   dS )zt
        Pause the current task for the specified duration.

        :param delay: the duration, in seconds
        Nr4   )r5   rH   r4   r4   r6   rF      s    zAsyncBackend.sleepF)deadlinerD   boolr   )rI   rD   r3   c                C  s   d S Nr4   )r5   rI   rD   r4   r4   r6   rE      s    z AsyncBackend.create_cancel_scopec                 C  s   dS )aQ  
        Return the nearest deadline among all the cancel scopes effective for the
        current task.

        :return:
            - a clock value from the event loop's internal clock
            - ``inf`` if there is no deadline in effect
            - ``-inf`` if the current scope has been cancelled
        :rtype: float
        Nr4   r9   r4   r4   r6   r@      s    z'AsyncBackend.current_effective_deadliner*   c                 C  s   d S rK   r4   r9   r4   r4   r6   create_task_group   s    zAsyncBackend.create_task_groupr   c                 C  s   d S rK   r4   r9   r4   r4   r6   create_event   s    zAsyncBackend.create_eventr   )total_tokensr3   c                 C  s   d S rK   r4   )r5   rN   r4   r4   r6   create_capacity_limiter   s    z$AsyncBackend.create_capacity_limiterNz&Callable[[Unpack[PosArgsT]], T_Retval]zCapacityLimiter | None)r/   r0   abandon_on_cancellimiterr3   c                   s   d S rK   r4   )r5   r/   r0   rP   rQ   r4   r4   r6   run_sync_in_worker_thread   s    	z&AsyncBackend.run_sync_in_worker_threadc                 C  s   d S rK   r4   r9   r4   r4   r6   check_cancelled   s    zAsyncBackend.check_cancelled)r/   r0   tokenr3   c                 C  s   d S rK   r4   r5   r/   r0   rT   r4   r4   r6   run_async_from_thread   s    z"AsyncBackend.run_async_from_threadc                 C  s   d S rK   r4   rU   r4   r4   r6   run_sync_from_thread   s    z!AsyncBackend.run_sync_from_threadr   c                 C  s   d S rK   r4   r9   r4   r4   r6   create_blocking_portal   s    z#AsyncBackend.create_blocking_portal)cwdenvstart_new_sessionzstr | byteszLiteral[True]zint | IO[Any] | Nonez"str | bytes | PathLike[str] | NonezMapping[str, str] | Noner)   )	commandshellstdinstdoutstderrrY   rZ   r[   r3   c          	        s   d S rK   r4   	r5   r\   r]   r^   r_   r`   rY   rZ   r[   r4   r4   r6   open_process   s    zAsyncBackend.open_processzSequence[str | bytes]zLiteral[False]c          	        s   d S rK   r4   ra   r4   r4   r6   rb      s    z#str | bytes | Sequence[str | bytes]c          	        s   d S rK   r4   ra   r4   r4   r6   rb      s    zset[Process])workersr3   c                 C  s   d S rK   r4   )r5   rc   r4   r4   r6   #setup_process_pool_exit_at_shutdown  s    z0AsyncBackend.setup_process_pool_exit_at_shutdownstrintzIPSockAddrType | Noner%   )hostportlocal_addressr3   c                   s   d S rK   r4   )r5   rg   rh   ri   r4   r4   r6   connect_tcp  s    zAsyncBackend.connect_tcpr(   )pathr3   c                   s   d S rK   r4   )r5   rk   r4   r4   r6   connect_unix  s    zAsyncBackend.connect_unixr   r$   )sockr3   c                 C  s   d S rK   r4   r5   rm   r4   r4   r6   create_tcp_listener  s    z AsyncBackend.create_tcp_listenerc                 C  s   d S rK   r4   rn   r4   r4   r6   create_unix_listener  s    z!AsyncBackend.create_unix_listenerr
   zUDPSocket | ConnectedUDPSocket)familyri   remote_address
reuse_portr3   c                   s   d S rK   r4   )r5   rq   ri   rr   rs   r4   r4   r6   create_udp_socket#  s    	zAsyncBackend.create_udp_socketr'   )
raw_socketremote_pathr3   c                   s   d S rK   r4   r5   ru   rv   r4   r4   r6   create_unix_datagram_socket.  s    z(AsyncBackend.create_unix_datagram_socketr"   c                   s   d S rK   r4   rw   r4   r4   r6   rx   5  s    zstr | bytes | Nonez0UNIXDatagramSocket | ConnectedUNIXDatagramSocketc                   s   d S rK   r4   rw   r4   r4   r6   rx   <  s    r   )rq   typeprotoflagszbytes | str | Nonezstr | int | Nonezint | AddressFamilyzint | SocketKindz]list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]])rg   rh   rq   ry   rz   r{   r3   c                  s   d S rK   r4   )r5   rg   rh   rq   ry   rz   r{   r4   r4   r6   getaddrinfoC  s    zAsyncBackend.getaddrinfor#   ztuple[str, str])sockaddrr{   r3   c                   s   d S rK   r4   )r5   r}   r{   r4   r4   r6   getnameinfoY  s    zAsyncBackend.getnameinfoc                   s   d S rK   r4   rn   r4   r4   r6   wait_socket_readable`  s    z!AsyncBackend.wait_socket_readablec                   s   d S rK   r4   rn   r4   r4   r6   wait_socket_writablee  s    z!AsyncBackend.wait_socket_writablec                 C  s   d S rK   r4   r9   r4   r4   r6   current_default_thread_limiterj  s    z+AsyncBackend.current_default_thread_limiterr	   z&ContextManager[AsyncIterator[Signals]])signalsr3   c                 G  s   d S rK   r4   )r5   r   r4   r4   r6   open_signal_receivero  s    z!AsyncBackend.open_signal_receiverr   c                 C  s   d S rK   r4   r9   r4   r4   r6   get_current_taskv  s    zAsyncBackend.get_current_taskzlist[TaskInfo]c                 C  s   d S rK   r4   r9   r4   r4   r6   get_running_tasks{  s    zAsyncBackend.get_running_tasksc                   s   d S rK   r4   r9   r4   r4   r6   wait_all_tasks_blocked  s    z#AsyncBackend.wait_all_tasks_blockedr+   )r2   r3   c                 C  s   d S rK   r4   )r5   r2   r4   r4   r6   create_test_runner  s    zAsyncBackend.create_test_runner)FN)N)r   ),__name__
__module____qualname__classmethodr   r7   r:   r<   r=   r?   rC   rG   rF   rA   rB   rE   r@   rL   rM   rO   rR   rS   rV   rW   rX   r   rb   rd   rj   rl   ro   rp   rt   rx   r|   r~   r   r   r   r   r   r   r   r   r4   r4   r4   r6   r.   3   s     		&	&	& 	" r.   )	metaclass);
__future__r   rA   sysabcr   r   collections.abcr   r   r   osr   signalr	   r   r
   r   typingr   r   r   r   r   r   r   r   version_infor   r   typing_extensionsr   _core._synchronizationr   r   _core._tasksr   _core._testingr   from_threadr   _socketsr!   r"   r#   r$   r%   r&   r'   r(   _subprocessesr)   _tasksr*   _testingr+   r,   r-   r.   r4   r4   r4   r6   <module>   s0   (
(
