Format: application/x-python-code
1 o
2
3 ;'h\ � @ s� d dl mZ d dlZd dlmZ d dlmZ d dlmZ ddl m
4 Z
5 ddlmZ ej
6 d kr6d d
7 lmZmZ nd d
8 lmZmZ ed�Zed�Zd
9 ddd�ddd�Zd dd�ZdS )!� )�annotationsN)�Callable)�TypeVar)�warn� )�get_async_backend)�CapacityLimiter)� � )�TypeVarTuple�Unpack�T_Retval�PosArgsTF)�abandon_on_cancel�cancellable�limiter�func�&Callable[[Unpack[PosArgsT]], T_Retval]�args�Unpack[PosArgsT]r �boolr �bool | Noner �CapacityLimiter | None�returnc � s6 �|dur|}t dtdd� t� j| |||d�I dH S )a�
10 Call the given function with the given arguments in a worker thread.
11
12 If the ``cancellable`` option is enabled and the task waiting for its completion is
13 cancelled, the thread will still run its course but its return value (or any raised
14 exception) will be ignored.
15
16 :param func: a callable
17 :param args: positional arguments for the callable
18 :param abandon_on_cancel: ``True`` to abandon the thread (leaving it to run
19 unchecked on own) if the host task is cancelled, ``False`` to ignore
20 cancellations in the host task until the operation has completed in the worker
21 thread
22 :param cancellable: deprecated alias of ``abandon_on_cancel``; will override
23 ``abandon_on_cancel`` if both parameters are passed
24 :param limiter: capacity limiter to use to limit the total amount of threads running
25 (if omitted, the default limiter is used)
26 :return: an awaitable that yields the return value of the function.
27
28 Nz�The `cancellable=` keyword argument to `anyio.to_thread.run_sync` is deprecated since AnyIO 4.1.0; use `abandon_on_cancel=` instead� )�
29 stacklevel)r r )r �DeprecationWarningr Zrun_sync_in_worker_thread)r r r r r � r �EC:\Users\shubh\Videos\agent\nova\Lib\site-packages\anyio/to_thread.py�run_sync s ���r r c C s
30 t � �� S )z�
31 Return the capacity limiter that is used by default to limit the number of
32 concurrent threads.
33
34 :return: a capacity limiter object
35
36 )r �current_default_thread_limiterr r r r r = s
37 r )r r r r r r r r r r r r
38 )r r )�
39 __future__r �sys�collections.abcr �typingr �warningsr Z_core._eventloopr �abcr �version_infor r Ztyping_extensionsr
40 r r r r r r r �<module> s"