Xj ddlmZdZddlZddlmZddlmZmZddl m Z ddl m Z erdd l mZejd k\r dd lmZmZndd lmZmZed Zed Zdddd ddZddZy)) annotations)run_synccurrent_default_thread_limiterN)Callable) TYPE_CHECKINGTypeVar)warn)get_async_backend)CapacityLimiter) ) TypeVarTupleUnpackT_RetvalPosArgsTF)abandon_on_cancel cancellablelimitercK||}tdtdtj||||d{S7w)aL Call the given function with the given arguments in a worker thread. If the ``abandon_on_cancel`` option is enabled and the task waiting for its completion is cancelled, the thread will still run its course but its return value (or any raised exception) will be ignored. :param func: a callable :param args: positional arguments for the callable :param abandon_on_cancel: ``True`` to abandon the thread (leaving it to run unchecked on own) if the host task is cancelled, ``False`` to ignore cancellations in the host task until the operation has completed in the worker thread :param cancellable: deprecated alias of ``abandon_on_cancel``; will override ``abandon_on_cancel`` if both parameters are passed :param limiter: capacity limiter to use to limit the total amount of threads running (if omitted, the default limiter is used) :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread :return: an awaitable that yields the return value of the function. NzThe `cancellable=` keyword argument to `anyio.to_thread.run_sync` is deprecated since AnyIO 4.1.0; use `abandon_on_cancel=` instead) stacklevel)rr)r DeprecationWarningr run_sync_in_worker_thread)funcrrrargss c/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/anyio/to_thread.pyrrsY:'  M   #$>> d&7?  s7A>Ac2tjS)a Return the capacity limiter that is used by default to limit the number of concurrent threads. :return: a capacity limiter object :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread )r rrrrFs   = = ??r ) rz&Callable[[Unpack[PosArgsT]], T_Retval]rzUnpack[PosArgsT]rboolrz bool | NonerzCapacityLimiter | Nonereturnr)r"r ) __future__r__all__syscollections.abcrtypingrrwarningsr _core._eventloopr _core._synchronizationr version_inforrtyping_extensionsrrrrrr rr-s"   $)/7w++6 :   # $#&* ( 0( (( ( $ (  (V @r