]L i*UddlmZddlZddlZddlmZmZddlmZm Z m Z m Z ddl m Z ddlmZddlmZddlmZmZmZdd lmZmZmZmZmZmZej8d k\r dd lmZmZndd lmZmZej8d k\rdd lm Z ndd lm Z erJddl!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6ddl7m8Z8ddl9m:Z:ddl;mee?e@ddfZAdeBd<Gdd e!ZCy)") annotationsN)ABCMetaabstractmethod) AsyncIterator AwaitableCallableSequence)AbstractContextManager)PathLike)Signals) AddressFamily SocketKindsocket)IO TYPE_CHECKINGAnyTypeVarUnionoverload) ) TypeVarTupleUnpack)r ) TypeAlias)FileDescriptorLike)CapacityLimiterEventLock Semaphore) CancelScope)TaskInfo)BlockingPortal)ConnectedUDPSocketConnectedUNIXDatagramSocketIPSockAddrTypeSocketListener SocketStream UDPSocketUNIXDatagramSocketUNIXSocketStream)Process) TaskGroup) TestRunnerT_RetvalPosArgsTz PathLike[str]zPathLike[bytes]rStrOrBytesPathcfeZdZee d7dZeed8dZeed9dZeed:dZeed;dZ ed;dZ ed;dZ eedd Zeed?dZeed@dZeedd d dAdZeedBdZee dC dDdZeed;dZee dEdZee dFdZeedGdZee dHdZeedIdZee dJ dKdZeedLdZeedMdZeedMdZ ee dNdZ!ee" dOd Z#ee" dPd!Z#ee dQd"Z#eed#d#d#d#d$ dRd%Z$ee dS dTd&Z%eedUd'Z&eedUd(Z'eedUd)Z(eedMd*Z)eedVd+Z*eedWd,Z+eedXd-Z,eedYd.Z-eedZd/Z.ee d[d0Z/eed\d1Z0ee d]d2Z1eed^d3Z2eed_d4Z3eed;d5Z4eed`d6Z5y)a 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 Z/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/anyio/abc/_eventloop.pyrunzAsyncBackend.run9cy)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_tokenOr?r@cy)zz Return the current value of the event loop's internal clock. :return: the clock value (seconds) Nr7rBs r= current_timezAsyncBackend.current_timeYr?r@cy)zFReturn the exception class that is raised in a task if it's cancelled.Nr7rBs r=cancelled_exception_classz&AsyncBackend.cancelled_exception_classbr?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.checkpointgcK|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_cancelledqs7  ) ) +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_checkpoint}sG $ $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@cyrZr7rBs r=create_blocking_portalz#AsyncBackend.create_blocking_portalr_r@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_listener r_r@cyrZr7rs r=create_unix_listenerz!AsyncBackend.create_unix_listenerr_r@c KywrZr7)r8familyrremote_address reuse_ports r=create_udp_socketzAsyncBackend.create_udp_socketrprKc KywrZr7r8 raw_socket remote_paths r=create_unix_datagram_socketz(AsyncBackend.create_unix_datagram_socket"s !rKc KywrZr7rs r=rz(AsyncBackend.create_unix_datagram_socket(s '*rKc KywrZr7rs r=rz(AsyncBackend.create_unix_datagram_socket.rrKr)rtypeprotoflagsc KywrZr7)r8rrrrrrs r= getaddrinfozAsyncBackend.getaddrinfo5s ( rKc KywrZr7)r8sockaddrrs r= getnameinfozAsyncBackend.getnameinfoKrrKc KywrZr7r8objs r= wait_readablezAsyncBackend.wait_readableRrrKc KywrZr7rs r= wait_writablezAsyncBackend.wait_writableWrrKcyrZr7rs r=notify_closingzAsyncBackend.notify_closing\r_r@c KywrZr7rs r=wrap_listener_socketz!AsyncBackend.wrap_listener_socketarrKc KywrZr7rs r=wrap_stream_socketzAsyncBackend.wrap_stream_socketfrrKc KywrZr7rs r=wrap_unix_stream_socketz$AsyncBackend.wrap_unix_stream_socketkrrKc KywrZr7rs r=wrap_udp_socketzAsyncBackend.wrap_udp_socketprrKc KywrZr7rs r=wrap_connected_udp_socketz&AsyncBackend.wrap_connected_udp_socketurrKc KywrZr7rs r=wrap_unix_datagram_socketz&AsyncBackend.wrap_unix_datagram_socketzrrKc KywrZr7rs r=#wrap_connected_unix_datagram_socketz0AsyncBackend.wrap_connected_unix_datagram_socketrrKcyrZr7rBs r=current_default_thread_limiterz+AsyncBackend.current_default_thread_limiterr_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@) r91Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]]r:tuple[Unpack[PosArgsT]]r;dict[str, Any]r<rreturnr1)robject)rfloat)rztype[BaseException])rNone)rWrrr)rXrrRboolrr")rr/)rr)rcrrr )rgintrez int | Nonercrrr!)rjrrr)FN) r9&Callable[[Unpack[PosArgsT]], T_Retval]r:rrmrrnzCapacityLimiter | Nonerr1)r9rr:rrurrr1)r9rr:rrurrr1)rr$) r}z)StrOrBytesPath | Sequence[StrOrBytesPath]r~int | IO[Any] | Nonerrrrr;rrr.)rz set[Process]rrrZ)rstrrrrIPSockAddrType | Nonerr*)r str | bytesrr-)rrrr)) rr rrrrrrrzUDPSocket | 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<rrr0)6__name__ __module__ __qualname__ classmethodrr>rCrErGrIrPrUrTrNrOrSrMr^rardrhrkrorrrvryr{rrrrrrrrrrrrrrrrrrrrrrrrrrrr7r@r=r5r58s ? &        (    UU   # #    "&((5  48              !%"             #(*.  4 &   (        ? &       4 &          :  $  %  %           JN  ! 2G           - .    (    !!.2! !! **.9* $**  .@ 9   '(!"    $         (45 % .1                       $      7          r@r5) metaclass)D __future__rrNsysabcrrcollections.abcrrrr contextlibr osr signalr rr rtypingrrrrrr version_inforrtyping_extensionsr _typeshedr_core._synchronizationrrr r! _core._tasksr"_core._testingr# from_threadr$_socketsr&r'r(r)r*r+r,r- _subprocessesr._tasksr/_testingr0r1r2rbytesr3__annotations__r5r7r@r=rs" 'HH-44w++6w +,PP*),   '!$ :   #!#uo?P"PQ Ql Wl r@