
    2Bf2                      l    d dl Z d dlmZ  G d dej                        Z G d dej
                        Zy)    N	namespacec                   \    e Zd ZdZd Zd Z	 	 ddZ	 	 ddZddZddZ	dd	Z
dd
ZddZy)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                      yNT selfs    Z/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/socketio/asyncio_namespace.pyis_asyncio_basedzAsyncNamespace.is_asyncio_based           c                    K   d|z   }t        | |      r:t        | |      }t        j                  |      du r	  ||  d{   }|S  || }|S y7 # t        j                  $ r d}Y |S w xY ww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hasattrgetattrasyncioiscoroutinefunctionCancelledErrorr   eventargshandler_namehandlerrets         r   trigger_eventzAsyncNamespace.trigger_event         u}4&dL1G**73t; '.C
 J tnJ ' /-- C J	:   5A-A  AA 
A-A A*&A-)A**A-Nc                 |   K   | j                   j                  |||||xs | j                  |       d{   S 7 w)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roomskip_sidr   callbackN)serveremitr   )r   r   r#   r$   r%   r   r&   s          r   r(   zAsyncNamespace.emit,   sF      [[%%e$T/7090KT^^/7 & 9 9 	9 9s   3<:<c                 z   K   | j                   j                  ||||xs | j                  |       d{   S 7 w)a$  Send a message to one or more connected clients.

        The only difference with the :func:`socketio.Server.send` method is
        that when the ``namespace`` argument is not given the namespace
        associated with the class is used.

        Note: this method is a coroutine.
        )r$   r%   r   r&   N)r'   sendr   )r   r#   r$   r%   r   r&   s         r   r*   zAsyncNamespace.send;   sC      [[%%d090KT^^/7 & 9 9 	9 9s   2;9;c                 t   K   | j                   j                  ||xs | j                         d{   S 7 w)a  Close a room.

        The only difference with the :func:`socketio.Server.close_room` method
        is that when the ``namespace`` argument is not given the namespace
        associated with the class is used.

        Note: this method is a coroutine.
        r   N)r'   
close_roomr   )r   r$   r   s      r   r,   zAsyncNamespace.close_roomI   s<      [[++I7 , 9 9 	9 9   /868c                 t   K   | j                   j                  ||xs | j                         d{   S 7 w)a   Return the user session for a client.

        The only difference with the :func:`socketio.Server.get_session`
        method is that when the ``namespace`` argument is not given the
        namespace associated with the class is used.

        Note: this method is a coroutine.
        r   N)r'   get_sessionr   r   sidr   s      r   r/   zAsyncNamespace.get_sessionU   s<      [[,,96 - 8 8 	8 8r-   c                 v   K   | j                   j                  |||xs | j                         d{   S 7 w)a   Store the user session for a client.

        The only difference with the :func:`socketio.Server.save_session`
        method is that when the ``namespace`` argument is not given the
        namespace associated with the class is used.

        Note: this method is a coroutine.
        r   N)r'   save_sessionr   )r   r1   sessionr   s       r   r3   zAsyncNamespace.save_sessiona   sB      [[--I$? . A A 	A A   0979c                 X    | j                   j                  ||xs | j                        S )a  Return the user session for a client with context manager syntax.

        The only difference with the :func:`socketio.Server.session` method is
        that when the ``namespace`` argument is not given the namespace
        associated with the class is used.
        r   )r'   r4   r   r0   s      r   r4   zAsyncNamespace.sessionm   s'     {{""3)2Mt~~"NNr   c                 t   K   | j                   j                  ||xs | j                         d{   S 7 w)a  Disconnect a client.

        The only difference with the :func:`socketio.Server.disconnect` method
        is that when the ``namespace`` argument is not given the namespace
        associated with the class is used.

        Note: this method is a coroutine.
        r   N)r'   
disconnectr   r0   s      r   r8   zAsyncNamespace.disconnectv   s<      [[++96 , 8 8 	8 8r-   )NNNNN)NNNN)N)__name__
__module____qualname____doc__r   r   r(   r*   r,   r/   r3   r4   r8   r	   r   r   r   r      sJ    , @D,09 DH 9
9
8
AO
8r   r   c                   2    e Zd ZdZd Zd ZddZd	dZd Zy)
AsyncClientNamespaceaR  Base class for asyncio client-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                      yr   r	   r
   s    r   r   z%AsyncClientNamespace.is_asyncio_based   r   r   c                    K   d|z   }t        | |      r:t        | |      }t        j                  |      du r	  ||  d{   }|S  || }|S y7 # t        j                  $ r d}Y |S w xY wwr   r   r   s         r   r   z"AsyncClientNamespace.trigger_event   r    r!   Nc                 x   K   | j                   j                  |||xs | j                  |       d{   S 7 w)a  Emit a custom event to the server.

        The only difference with the :func:`socketio.Client.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.
        )r#   r   r&   N)clientr(   r   )r   r   r#   r   r&   s        r   r(   zAsyncClientNamespace.emit   sA      [[%%e$090KT^^/7 & 9 9 	9 9s   1:8:c                 v   K   | j                   j                  ||xs | j                  |       d{   S 7 w)a  Send a message to the server.

        The only difference with the :func:`socketio.Client.send` method is
        that when the ``namespace`` argument is not given the namespace
        associated with the class is used.

        Note: this method is a coroutine.
        )r   r&   N)rB   r*   r   )r   r#   r   r&   s       r   r*   zAsyncClientNamespace.send   s?      [[%%d090KT^^/7 & 9 9 	9 9r5   c                 R   K   | j                   j                          d{   S 7 w)a  Disconnect a client.

        The only difference with the :func:`socketio.Client.disconnect` method
        is that when the ``namespace`` argument is not given the namespace
        associated with the class is used.

        Note: this method is a coroutine.
        N)rB   r8   r
   s    r   r8   zAsyncClientNamespace.disconnect   s!      [[++----s   '%')NNN)NN)	r9   r:   r;   r<   r   r   r(   r*   r8   r	   r   r   r>   r>      s     ,99	.r   r>   )r   socketior   	Namespacer   ClientNamespacer>   r	   r   r   <module>rH      s4     z8Y(( z8zI.944 I.r   