a
    ^g%                     @  s  U 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
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 d d	l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jdkrd dlm Z  nd dlm Z  erd dl!m"Z" ddl#m$Z$m%Z%m&Z&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z< edZ=edZ>ee?e@ddf ZAdeBd< G dd  d ed!ZCdS )"    )annotationsN)ABCMetaabstractmethod)AsyncIterator	AwaitableCallableSequence)AbstractContextManager)PathLike)Signals)AddressFamily
SocketKindsocket)IOTYPE_CHECKINGAnyTypeVarUnionoverload)      )TypeVarTupleUnpack)r   
   )	TypeAlias)	HasFileno   )CapacityLimiterEventLock	Semaphore)CancelScope)TaskInfo)BlockingPortal   )ConnectedUDPSocketConnectedUNIXDatagramSocketIPSockAddrTypeSocketListenerSocketStream	UDPSocketUNIXDatagramSocketUNIXSocketStream)Process)	TaskGroup)
TestRunnerT_RetvalPosArgsTzPathLike[str]zPathLike[bytes]r   StrOrBytesPathc                   @  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d/dd0d1d2dd3d4d5d6Zeedd7d8d9d:Zeedd;ddd<dd=d>d?Zeedd	d@dAZeedddddBdCdDZeed;ddddBdEdFZeedGd	dHdIZeedJdKdKdKdLdMdNdOdPZeedQddRdSdTZeeddUd1dVdWdXdYdZZeed[d\d]d^d_Zeed`dadbdcddZeed`dadbdedfZ eedgdVdVddhdidjdkZ!ee"d`ddldmdndoZ#ee"d`d[dpdmdqdoZ#eed`drdsdmdtdoZ#eedududududvdwdxdydzd1d1d{d|d}d~Z$eeddd1ddddZ%eedddddZ&eedddddZ'eed7d	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]r0   )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 )clsr4   r5   r6   r7   r9   r9   b/var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/site-packages/anyio/abc/_eventloop.pyrun9   s    	zAsyncBackend.runobject)r8   c                 C  s   dS )z

        :return:
        Nr9   r:   r9   r9   r;   current_tokenO   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)
        Nr9   r>   r9   r9   r;   current_timeW   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.Nr9   r>   r9   r9   r;   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`.
        Nr9   r>   r9   r9   r;   
checkpointe   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infrD   r>   r9   r9   r;   checkpoint_if_cancelledo   s    	z$AsyncBackend.checkpoint_if_cancelledc                   s@   | j dd  | dI dH  W d   n1 s20    Y  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sleepr>   r9   r9   r;   cancel_shielded_checkpoint{   s    	z'AsyncBackend.cancel_shielded_checkpoint)delayr8   c                   s   dS )zt
        Pause the current task for the specified duration.

        :param delay: the duration, in seconds
        Nr9   )r:   rM   r9   r9   r;   rK      s    zAsyncBackend.sleepF)deadlinerI   boolr!   )rN   rI   r8   c                C  s   d S Nr9   )r:   rN   rI   r9   r9   r;   rJ      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
        Nr9   r>   r9   r9   r;   rE      s    z'AsyncBackend.current_effective_deadliner.   c                 C  s   d S rP   r9   r>   r9   r9   r;   create_task_group   s    zAsyncBackend.create_task_groupr   c                 C  s   d S rP   r9   r>   r9   r9   r;   create_event   s    zAsyncBackend.create_eventr   )fast_acquirer8   c                C  s   d S rP   r9   )r:   rS   r9   r9   r;   create_lock   s    zAsyncBackend.create_lockN)	max_valuerS   intz
int | Noner    )initial_valuerU   rS   r8   c                C  s   d S rP   r9   )r:   rW   rU   rS   r9   r9   r;   create_semaphore   s    	zAsyncBackend.create_semaphorer   )total_tokensr8   c                 C  s   d S rP   r9   )r:   rY   r9   r9   r;   create_capacity_limiter   s    z$AsyncBackend.create_capacity_limiterz&Callable[[Unpack[PosArgsT]], T_Retval]zCapacityLimiter | None)r4   r5   abandon_on_cancellimiterr8   c                   s   d S rP   r9   )r:   r4   r5   r[   r\   r9   r9   r;   run_sync_in_worker_thread   s    	z&AsyncBackend.run_sync_in_worker_threadc                 C  s   d S rP   r9   r>   r9   r9   r;   check_cancelled   s    zAsyncBackend.check_cancelled)r4   r5   tokenr8   c                 C  s   d S rP   r9   r:   r4   r5   r_   r9   r9   r;   run_async_from_thread   s    z"AsyncBackend.run_async_from_threadc                 C  s   d S rP   r9   r`   r9   r9   r;   run_sync_from_thread   s    z!AsyncBackend.run_sync_from_threadr#   c                 C  s   d S rP   r9   r>   r9   r9   r;   create_blocking_portal   s    z#AsyncBackend.create_blocking_portalz)StrOrBytesPath | Sequence[StrOrBytesPath]zint | IO[Any] | Noner   r-   )commandstdinstdoutstderrr6   r8   c                  s   d S rP   r9   )r:   rd   re   rf   rg   r6   r9   r9   r;   open_process   s    zAsyncBackend.open_processzset[Process])workersr8   c                 C  s   d S rP   r9   )r:   ri   r9   r9   r;   #setup_process_pool_exit_at_shutdown   s    z0AsyncBackend.setup_process_pool_exit_at_shutdownstrzIPSockAddrType | Noner)   )hostportlocal_addressr8   c                   s   d S rP   r9   )r:   rl   rm   rn   r9   r9   r;   connect_tcp   s    zAsyncBackend.connect_tcpzstr | bytesr,   )pathr8   c                   s   d S rP   r9   )r:   rp   r9   r9   r;   connect_unix  s    zAsyncBackend.connect_unixr   r(   )sockr8   c                 C  s   d S rP   r9   r:   rr   r9   r9   r;   create_tcp_listener  s    z AsyncBackend.create_tcp_listenerc                 C  s   d S rP   r9   rs   r9   r9   r;   create_unix_listener  s    z!AsyncBackend.create_unix_listenerr   zUDPSocket | ConnectedUDPSocket)familyrn   remote_address
reuse_portr8   c                   s   d S rP   r9   )r:   rv   rn   rw   rx   r9   r9   r;   create_udp_socket  s    	zAsyncBackend.create_udp_socketr+   )
raw_socketremote_pathr8   c                   s   d S rP   r9   r:   rz   r{   r9   r9   r;   create_unix_datagram_socket   s    z(AsyncBackend.create_unix_datagram_socketr&   c                   s   d S rP   r9   r|   r9   r9   r;   r}   &  s    zstr | bytes | Nonez0UNIXDatagramSocket | ConnectedUNIXDatagramSocketc                   s   d S rP   r9   r|   r9   r9   r;   r}   ,  s    r   )rv   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]]])rl   rm   rv   r~   r   r   r8   c                  s   d S rP   r9   )r:   rl   rm   rv   r~   r   r   r9   r9   r;   getaddrinfo3  s    zAsyncBackend.getaddrinfor'   ztuple[str, str])sockaddrr   r8   c                   s   d S rP   r9   )r:   r   r   r9   r9   r;   getnameinfoI  s    zAsyncBackend.getnameinfozHasFileno | int)objr8   c                   s   d S rP   r9   r:   r   r9   r9   r;   wait_readableP  s    zAsyncBackend.wait_readablec                   s   d S rP   r9   r   r9   r9   r;   wait_writableU  s    zAsyncBackend.wait_writablec                 C  s   d S rP   r9   r>   r9   r9   r;   current_default_thread_limiterZ  s    z+AsyncBackend.current_default_thread_limiterr   z.AbstractContextManager[AsyncIterator[Signals]])signalsr8   c                 G  s   d S rP   r9   )r:   r   r9   r9   r;   open_signal_receiver_  s    z!AsyncBackend.open_signal_receiverr"   c                 C  s   d S rP   r9   r>   r9   r9   r;   get_current_taskf  s    zAsyncBackend.get_current_taskzSequence[TaskInfo]c                 C  s   d S rP   r9   r>   r9   r9   r;   get_running_tasksk  s    zAsyncBackend.get_running_tasksc                   s   d S rP   r9   r>   r9   r9   r;   wait_all_tasks_blockedp  s    z#AsyncBackend.wait_all_tasks_blockedr/   )r7   r8   c                 C  s   d S rP   r9   )r:   r7   r9   r9   r;   create_test_runneru  s    zAsyncBackend.create_test_runner)FN)N)r   ).__name__
__module____qualname__classmethodr   r<   r?   rA   rB   rD   rH   rL   rK   rF   rG   rJ   rE   rQ   rR   rT   rX   rZ   r]   r^   ra   rb   rc   rh   rj   ro   rq   rt   ru   ry   r   r}   r   r   r   r   r   r   r   r   r   r   r9   r9   r9   r;   r3   8   s  	  	 	" r3   )	metaclass)D
__future__r   rF   sysabcr   r   collections.abcr   r   r   r   
contextlibr	   osr
   signalr   r   r   r   typingr   r   r   r   r   r   version_infor   r   Ztyping_extensionsr   Z	_typeshedr   Z_core._synchronizationr   r   r   r    Z_core._tasksr!   Z_core._testingr"   Zfrom_threadr#   _socketsr%   r&   r'   r(   r)   r*   r+   r,   Z_subprocessesr-   _tasksr.   Z_testingr/   r0   r1   rk   bytesr2   __annotations__r3   r9   r9   r9   r;   <module>   s:    	

(
