Xj)UddlmZddlZddlZddlmZmZddlmZm Z m Z m Z m Z ddl mZddlmZddlmZddlmZmZmZdd lmZmZmZmZmZmZej:d k\r dd lmZmZndd l mZmZerDdd l!m"Z"d dl#m$Z$m%Z%m&Z&m'Z'd dl(m)Z)d dl*m+Z+ddl,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:edZ;eddZ<edZ=e>e?zee>zee?zZ@deAd<GddeZBy) ) annotationsN)ABCMetaabstractmethod) AsyncIterator AwaitableCallable CoroutineSequence)AbstractContextManager)PathLike)Signals) AddressFamily SocketKindsocket)IO TYPE_CHECKINGAny TypeAliasTypeVaroverload) ) TypeVarTupleUnpack)FileDescriptorLike)CapacityLimiterEventLock Semaphore) CancelScope)TaskInfo)ConnectedUDPSocketConnectedUNIXDatagramSocketIPSockAddrTypeSocketListener SocketStream UDPSocketUNIXDatagramSocketUNIXSocketStream)Process) TaskGroup) TestRunnerT_RetvalT_coT) covariantPosArgsTrStrOrBytesPathcJeZdZee d6dZeed7dZeed8dZeed9dZeed:dZ ed:dZ ed:dZ eed;dZ eee jd d  ddZeed?dZeedd d d@dZeedAdZee dB dCdZeed:dZee dDdZee dEdZee dFdZeedGdZee dH dIdZeedJdZeedKdZeedKdZee dLdZ ee! dMdZ"ee! dNd Z"ee dOd!Z"eed"d"d"d"d# dPd$Z#ee dQ dRd%Z$eedSd&Z%eedSd'Z&eedSd(Z'eedKd)Z(eedTd*Z)eedUd+Z*eedVd,Z+eedWd-Z,eedXd.Z-ee dYd/Z.eedZd0Z/ee d[d1Z0eed\d2Z1eed]d3Z2eed:d4Z3eed^d5Z4y)_ AsyncBackendcy)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)clsfuncargskwargsoptionss h/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/anyio/abc/_eventloop.pyrunzAsyncBackend.run4cy)z Return an object that allows other threads to run code inside the event loop. :return: a token object, specific to the event loop running in the current thread Nr7r8s r= current_tokenzAsyncBackend.current_tokenJr?r@cy)zz Return the current value of the event loop's internal clock. :return: the clock value (seconds) Nr7rBs r= current_timezAsyncBackend.current_timeTr?r@cy)zFReturn the exception class that is raised in a task if it's cancelled.Nr7rBs r=cancelled_exception_classz&AsyncBackend.cancelled_exception_class]r?r@c Kyw)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`. Nr7rBs r= checkpointzAsyncBackend.checkpointbcK|jtj k(r|jd{yy7w)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_deadlinemathinfrIrBs r=checkpoint_if_cancelledz$AsyncBackend.checkpoint_if_cancelledls7  ) ) +y 8.." " " 9 "s6A?AcK|jd5|jdd{dddy7 #1swYyxYww)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)shieldrN)create_cancel_scopesleeprBs r=cancel_shielded_checkpointz'AsyncBackend.cancel_shielded_checkpointxsG $ $D $ 1 ))A,       s$A:8: A:AAc Kyw)zt Pause the current task for the specified duration. :param delay: the duration, in seconds Nr7)r8delays r=rTzAsyncBackend.sleeprJrKF)deadlinerRcyNr7)r8rXrRs r=rSz AsyncBackend.create_cancel_scope r@cy)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 Nr7rBs r=rMz'AsyncBackend.current_effective_deadliner?r@cyrZr7rBs r=create_task_groupzAsyncBackend.create_task_group r@cyrZr7rBs r= create_eventzAsyncBackend.create_eventr_r@cyrZr7)r8 fast_acquires r= create_lockzAsyncBackend.create_lockr_r@N) max_valuerccyrZr7)r8 initial_valuerercs r=create_semaphorezAsyncBackend.create_semaphores r@cyrZr7)r8 total_tokenss r=create_capacity_limiterz$AsyncBackend.create_capacity_limiterr_r@c KywrZr7)r8r9r:abandon_on_cancellimiters r=run_sync_in_worker_threadz&AsyncBackend.run_sync_in_worker_thread  rKcyrZr7rBs r=check_cancelledzAsyncBackend.check_cancelledr_r@cyrZr7r8r9r:tokens r=run_async_from_threadz"AsyncBackend.run_async_from_thread r@cyrZr7rts r=run_sync_from_threadz!AsyncBackend.run_sync_from_threadrwr@c KywrZr7)r8commandstdinstdoutstderrr;s r= open_processzAsyncBackend.open_processs  rKcyrZr7)r8workerss r=#setup_process_pool_exit_at_shutdownz0AsyncBackend.setup_process_pool_exit_at_shutdownr_r@c KywrZr7)r8hostport local_addresss r= connect_tcpzAsyncBackend.connect_tcp rKc KywrZr7)r8paths r= connect_unixzAsyncBackend.connect_unix  rKcyrZr7r8socks r=create_tcp_listenerz AsyncBackend.create_tcp_listenerr_r@cyrZr7rs r=create_unix_listenerz!AsyncBackend.create_unix_listenerr_r@c KywrZr7)r8familyrremote_address reuse_ports r=create_udp_socketzAsyncBackend.create_udp_socket rprKc KywrZr7r8 raw_socket remote_paths r=create_unix_datagram_socketz(AsyncBackend.create_unix_datagram_sockets !rKc KywrZr7rs r=rz(AsyncBackend.create_unix_datagram_sockets '*rKc KywrZr7rs r=rz(AsyncBackend.create_unix_datagram_socket$rrKr)rtypeprotoflagsc KywrZr7)r8rrrrrrs r= getaddrinfozAsyncBackend.getaddrinfo+s ( rKc KywrZr7)r8sockaddrrs r= getnameinfozAsyncBackend.getnameinfoArrKc KywrZr7r8objs r= wait_readablezAsyncBackend.wait_readableHrrKc KywrZr7rs r= wait_writablezAsyncBackend.wait_writableMrrKcyrZr7rs r=notify_closingzAsyncBackend.notify_closingRr_r@c KywrZr7rs r=wrap_listener_socketz!AsyncBackend.wrap_listener_socketWrrKc KywrZr7rs r=wrap_stream_socketzAsyncBackend.wrap_stream_socket\rrKc KywrZr7rs r=wrap_unix_stream_socketz$AsyncBackend.wrap_unix_stream_socketarrKc KywrZr7rs r=wrap_udp_socketzAsyncBackend.wrap_udp_socketfrrKc KywrZr7rs r=wrap_connected_udp_socketz&AsyncBackend.wrap_connected_udp_socketkrrKc KywrZr7rs r=wrap_unix_datagram_socketz&AsyncBackend.wrap_unix_datagram_socketprrKc KywrZr7rs r=#wrap_connected_unix_datagram_socketz0AsyncBackend.wrap_connected_unix_datagram_socketurrKcyrZr7rBs r=current_default_thread_limiterz+AsyncBackend.current_default_thread_limiter|r_r@cyrZr7)r8signalss r=open_signal_receiverz!AsyncBackend.open_signal_receiverr[r@cyrZr7rBs r=get_current_taskzAsyncBackend.get_current_taskr_r@cyrZr7rBs r=get_running_taskszAsyncBackend.get_running_tasksr_r@c KywrZr7rBs r=wait_all_tasks_blockedz#AsyncBackend.wait_all_tasks_blockedrrKcyrZr7)r8r<s r=create_test_runnerzAsyncBackend.create_test_runnerr_r@) r9z1Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]]r:tuple[Unpack[PosArgsT]]r;dict[str, Any]r<rreturnr/)robject)rfloat)rztype[BaseException])rNone)rWrrr)rXrrRboolrr!)rr-)rr)rcrrr)rgintrez int | Nonercrrr )rjrrr)FN) r9&Callable[[Unpack[PosArgsT]], T_Retval]r:rrmrrnzCapacityLimiter | Nonerr/)r9z7Callable[[Unpack[PosArgsT]], Coroutine[Any, Any, T_co]]r:rrurrr0)r9rr:rrurrr/) r{z)StrOrBytesPath | Sequence[StrOrBytesPath]r|int | IO[Any] | Noner}rr~rr;rrr,)rz set[Process]rrrZ)rstrrrrIPSockAddrType | Nonerr()r str | bytesrr+)rrrr') rrrrrrrrrzUDPSocket | ConnectedUDPSocket)rrrrrr*)rrrrrr%)rrrzstr | bytes | Nonerz0UNIXDatagramSocket | ConnectedUNIXDatagramSocket)rzbytes | str | Nonerzstr | int | Nonerzint | AddressFamilyrzint | SocketKindrrrrrzuSequence[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]]])r)rr&rrrztuple[str, str])rrrr)rrrr()rrrr+)rrrr))rrrr$)rrrr*)rrrr%)rr)rr rz.AbstractContextManager[AsyncIterator[Signals]])rr")rzSequence[TaskInfo])r<rrr.)5__name__ __module__ __qualname__ classmethodrr>rCrErGrIrPrUrTrNrOrSrMr^rardrhrkrorrrvryrrrrrrrrrrrrrrrrrrrrrrrrrrrr7r@r=r5r53s{ ? &        (    UU   # #    "&((5  48              !%"             #(*.  4 &   (        E &       4 &        :  $  %  %           JN  ! 2G           - .    (    !!.2! !! **.9* $**  .@ 9   '(!"    $         (45 % .1                       $      7          r@r5) metaclass)C __future__rrNsysabcrrcollections.abcrrrr r contextlibr osr signalr rrrtypingrrrrrr version_inforrtyping_extensions _typeshedr_core._synchronizationrrrr _core._tasksr!_core._testingr"_socketsr$r%r&r'r(r)r*r+ _subprocessesr,_tasksr-_testingr.r/r0r2rbytesr3__annotations__r5r7r@r=rs" 'SS-44w++6,PP*)   '!$ : v&  #%K(3-7(5/I Ig Wg r@