�
K�g� � �� � d dl mZ d dlZd dlZd dlZd dlZd dlZej dk rd dlm Z nd dl
m Z e d� � Z ej d� � Z
dd�Zdd�Z G d� de� � Zdd�Zdd�ZdS )� )�annotationsN)� �
)� ParamSpec�P�T�args�tuple[typing.Callable, dict]�return�Nonec
� �& �K � t j dt � � t j � � 4 �d {V ���d�fd�}| D ]+\ }}�� |t
j |fi |��� � �, d d d � � �d {V �� d S # 1 �d {V ��swxY w Y d S )NzOrun_until_first_complete is deprecated and will be removed in a future version.�func�%typing.Callable[[], typing.Coroutine]r r c � �^ �K � | � � � d {V �� �j � � � d S �N)�cancel_scope�cancel)r �
task_groups ��e/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/starlette/concurrency.py�runz%run_until_first_complete.<locals>.run s9 �� � � ��$�&�&�L�L�L�L�L�L�L��#�*�*�,�,�,�,�,� )r r r r )�warnings�warn�DeprecationWarning�anyio�create_task_group�
start_soon� functools�partial)r r r �kwargsr s @r �run_until_first_completer! sy �� � � ��M�Y��� � �
�&�(�(� J� J� J� J� J� J� J�J� -� -� -� -� -� -� !� J� J�L�D�&��!�!�#�y�'8��'H�'H��'H�'H�I�I�I�I� J�
J� J� J� J� J� J� J� J� J� J� J� J� J� J� J� J� J� J� J� J� J� J� J� J���� J� J� J� J� J� Js �5B �
B
�
B
r �typing.Callable[P, T]�P.argsr �P.kwargsc � �z K � t j | g|�R i |��} t j � | � � � d {V ��S r )r r r � to_thread�run_sync)r r r s r �run_in_threadpoolr( # sN � � � ���T�3�D�3�3�3�F�3�3�D���)�)�$�/�/�/�/�/�/�/�/�/r c � � e Zd ZdS )�_StopIterationN)�__name__�
__module__�__qualname__� r r r* r* ( s � � � � � ��Dr r* �iterator�typing.Iterator[T]c �L � t | � � S # t $ r t �w xY wr )�next�
StopIterationr* )r/ s r �_nextr4 , s4 � ���H�~�~���� � � ������s � �#�typing.Iterable[T]�typing.AsyncIterator[T]c � K � t | � � } t j � t |� � � d {V ��W V � n# t
$ r Y d S w xY w�Br )�iterr r&