�
���g�. � �f � d dl Z d dlmZ G d� dej � � Z G d� dej � � ZdS )� N)�base_namespacec �z � e Zd ZdZd� Zd� Z dd�Z dd�Z dd�Zdd �Z dd
�Z
dd�Zdd�Zdd
�Z
dd�Zdd�ZdS )�AsyncNamespaceaR Base class for asyncio server-side class-based namespaces.
A class-based namespace is a class that contains all the event handlers
for a Socket.IO namespace. The event handlers are methods of the class
with the prefix ``on_``, such as ``on_connect``, ``on_disconnect``,
``on_message``, ``on_json``, and so on. These can be regular functions or
coroutines.
:param namespace: The Socket.IO namespace to be used with all the event
handlers defined in this class. If this argument is
omitted, the default namespace is used.
c � � dS �NT� ��selfs �h/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/socketio/async_namespace.py�is_asyncio_basedzAsyncNamespace.is_asyncio_based � � ��t� c � � K � d|pdz }t | |� � r�t | |� � }t j |� � du rQ ||� � d{V ��}n+# t $ r |dk r ||dd� � � d{V ��}n� Y nw xY wnC# t j $ r d}Y n0w xY w ||� }n%# t $ r |dk r ||dd� � }n� Y nw xY w|S dS �a� Dispatch an event to the proper handler method.
In the most common usage, this method is not overloaded by subclasses,
as it performs the routing of events to methods. However, this
method can be overridden if special dispatching rules are needed, or if
having a single method that catches all events is desired.
Note: this method is a coroutine.
�on_� TN�
disconnect�������hasattr�getattr�asyncio�iscoroutinefunction� TypeError�CancelledError�r
�event�args�handler_name�handler�rets r �
trigger_eventzAsyncNamespace.trigger_event �e � � � � ����,���4��&�&� ��d�L�1�1�G��*�7�3�3�t�;�;��"�$+�G�T�N�2�2�2�2�2�2����$� "� "� "� !�L�0�0�(/���c�r�c��(;�";�";�";�";�";�";�C�C�!� �C� "������ �-� � � ��C�C�C������!�'�4�.�C�C�� � � � � ��,�,�%�g�t�C�R�C�y�1���� �� ���� �J�3 � �B �A �
A: �%A6�3A: �5A6�6A: �:B�
B�B �B:�9B:NFc
� �d K � | j � ||||||p| j ||�� � � d{V ��S )a) Emit a custom event to one or more connected clients.
The only difference with the :func:`socketio.Server.emit` method is
that when the ``namespace`` argument is not given the namespace
associated with the class is used.
Note: this method is a coroutine.
)�data�to�room�skip_sid� namespace�callback�ignore_queueN)�server�emitr* ) r
r r&