
    aDgK                         d Z  G d de      Z G d de      Z G d de      Z G d de      Z G d	 d
e      Z G d de      Z G d de      Z G d de      Z	 G d de      Z
 G d de      Z G d de      Zy)zc
wsproto/events
~~~~~~~~~~~~~~

Events that result from processing data on a WebSocket connection.
c                   4    e Zd ZdZg Zi Zd Zd Zd Zd Z	dZ
y)Eventz(
    Base class for wsproto events.
    c                 B   t        | j                        }|D ]5  }||vst        dj                  || j                  j
                               |j                  | j                        }|D ]5  }||vst        dj                  || j                  j
                               | j                  j                         D ci c]  \  }}|t        |      r |       n| }}}| j                  j                  |       | j                  j                  |       y c c}}w )Nzunrecognized kwarg {} for {}z missing required kwarg {} for {})set_fields	TypeErrorformat	__class____name__
difference	_defaultsitemscallable__dict__update)	selfkwargsallowedkwargrequiredfieldkeyvaluedefaultss	            N/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/wsproto/events.py__init__zEvent.__init__   s   dll# 	EG#299t~~66 	 %%dnn5 	EF"6==t~~66 	 #nn224
U HUO6
 
 	X&V$
s   Dc                     | j                   j                  }| j                  D cg c]!  }dj                  || j                  |         # }}dj                  |      }dj                  ||      S c c}w )Nz{}={}z, z{}({}))r	   r
   r   r   r   join)r   namer   
kwarg_strs	kwarg_strs        r   __repr__zEvent.__repr__*   si    ~~&&EI\\
<AGNN5$--"67

 
 IIj)	tY//	
s   &A0c                 j    | j                   |j                   k(  xr | j                  |j                  k(  S N)r	   r   r   others     r   __eq__zEvent.__eq__2   s'    ~~0TT]]enn5TT    c                 &    | j                  |       S r#   )r&   r$   s     r   __ne__zEvent.__ne__5   s    ;;u%%%r'   N)r
   
__module____qualname____doc__r   r   r   r!   r&   r)   __hash__ r'   r   r   r   
   s/     GI%00U& Hr'   r   c                   $    e Zd ZdZg dZeeedZy)Requesta  The beginning of a Websocket connection, the HTTP Upgrade request

    This event is fired when a SERVER connection receives a WebSocket
    handshake request (HTTP with upgrade header).

    Fields:

    .. attribute:: extensions (Union[List[Extension], List[str]])

    .. attribute:: extra_headers

       The additional request headers, excluding extensions, host, subprotocols,
       and version headers.

    .. attribute:: host (str)

       The hostname, or host header value.

    .. attribute:: subprotocols List[str]

       A list of subprotocols ordered by preference.

    .. attribute:: target (str)

       A list of the subprotocols proposed in the request, as a list
       of strings.

    )
extensionsextra_headershostsubprotocolstarget)r1   r2   r4   Nr
   r*   r+   r,   r   listr   r.   r'   r   r0   r0   <   s    : PG#dDQIr'   r0   c                   $    e Zd ZdZg dZeeddZy)AcceptConnectiona  The acceptance of a Websocket upgrade request.

    This event is fired when a CLIENT receives an acceptance response
    from a server. It is also used to accept an upgrade request when
    acting as a SERVER.

    Fields:

    .. attribute: extra_headers (List[Tuple[bytes, bytes]])

       Any additional (non websocket related) headers present in the
       acceptance response.

    .. attribute: subprotocol (Optional[str])

       The accepted subprotocol to use. Optional.

    )r1   r2   subprotocolNr6   r.   r'   r   r9   r9   ^   s    & =G#d4PIr'   r9   c                   $    e Zd ZdZg dZedddZy)RejectConnectionau  The rejection of a Websocket upgrade request, the HTTP response.

    This event is fired when a CLIENT receives a rejection response
    from a server. It can be used to reject a request when sent from
    as SERVER. If has_body is False the headers must include a
    content-length or transfer encoding.

    Fields:

    .. attribute:: headers (List[Tuple[bytes, bytes]])

       The headers to send with the response.

    .. attribute:: has_body

       This defaults to False, but set to True if there is a body. See
       also :class:`~RejectData`.

    .. attribute:: status_code

       The response status code.

    )headershas_bodystatus_codeFi  Nr6   r.   r'   r   r<   r<   v   s    0 5G eCHIr'   r<   c                        e Zd ZdZddgZddiZy)
RejectDatazThe rejection HTTP response body.

    Fields:

    .. attribute:: body_finished

       True if this is the final chunk of the body data.

    .. attribute:: data (bytes)

       The raw body data.

    body_finisheddataTNr
   r*   r+   r,   r   r   r.   r'   r   rA   rA      s     'G $'Ir'   rA   c                   &    e Zd ZdZddgZddiZd Zy)CloseConnectiona  The end of a Websocket connection, represents a closure frame.

    This event is fired after the connection is considered closed.

    wsproto automatically emits a CLOSE frame when it receives one, to
    complete the close-handshake.

    Fields:

    .. attribute:: code

       The integer close code to indicate why the connection
       has closed.

    .. attribute:: reason

       Additional reasoning for why the connection has closed.

    codereasonNc                 D    t        | j                  | j                        S )N)rG   rH   )rF   rG   rH   r   s    r   responsezCloseConnection.response   s    DIIdkkBBr'   r
   r*   r+   r,   r   r   rK   r.   r'   r   rF   rF      s#    ( x G4 ICr'   rF   c                   "    e Zd ZdZg dZdddZy)Messagea  The websocket data message.

    Fields:

    .. attribute:: data

       The message data as byte string, can be decoded as UTF-8 for
       TEXT messages.  This only represents a single chunk of data and
       not a full WebSocket message.  You need to buffer and
       reassemble these chunks to get the full message.

    .. attribute:: frame_finished

       This has no semantic content, but is provided just in case some
       weird edge case user wants to be able to reconstruct the
       fragmentation pattern of the original stream.

    .. attribute:: message_finished

       True if this frame is the last one of this message, False if
       more frames are expected.

    )rC   frame_finishedmessage_finishedT)rO   rP   NrD   r.   r'   r   rN   rN      s    0 =G#'TBIr'   rN   c                       e Zd ZdZy)TextMessagezDThis event is fired when a data frame with TEXT payload is received.Nr
   r*   r+   r,   r.   r'   r   rR   rR      s    Nr'   rR   c                       e Zd ZdZy)BytesMessagezPThis event is fired when a data frame with BINARY payload is
    received.

    NrS   r.   r'   r   rU   rU      s    
 	r'   rU   c                   $    e Zd ZdZdgZddiZd Zy)Pinga  The Ping event can be sent to trigger a ping frame and is fired
    when a Ping is received.

    wsproto automatically emits a PONG frame with the same payload.

    Fields:

    .. attribute:: payload

       An optional payload to emit with the ping frame.
    payloadr'   c                 .    t        | j                        S )N)rX   )PongrX   rJ   s    r   rK   zPing.response   s    DLL))r'   NrL   r.   r'   r   rW   rW      s    
 kGC I*r'   rW   c                       e Zd ZdZdgZddiZy)rZ   zThe Pong event is fired when a Pong is received.

    Fields:

    .. attribute:: payload

       An optional payload to emit with the pong frame.

    rX   r'   NrD   r.   r'   r   rZ   rZ     s     kGC Ir'   rZ   N)r,   objectr   r0   r9   r<   rA   rF   rN   rR   rU   rW   rZ   r.   r'   r   <module>r]      s   /F /dRe RDQu Q0Iu I:( (&Ce C:Ce C:	' 		7 	*5 *(!5 !r'   