
    -e                    `   d Z ddlmZ ddlZ ej        e          ZddlmZm	Z	 ddl
mZmZ ddlmZmZ ddlmZ erdd	lmZ d
dlmZ 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dS )z\ Provide a set of objects to represent different stages of a connection
to a Bokeh server.

    )annotationsN)ABCMetaabstractmethod)Enumauto)TYPE_CHECKINGAny   )ID)Message   )ClientConnection)CONNECTED_BEFORE_ACKCONNECTED_AFTER_ACKDISCONNECTEDErrorReasonNOT_YET_CONNECTEDWAITING_FOR_REPLYc                  J    e Zd Z e            Z e            Z e            ZdS )r   N)__name__
__module____qualname__r   NO_ERROR
HTTP_ERRORNETWORK_ERROR     3lib/python3.11/site-packages/bokeh/client/states.pyr   r   9   s/        dffHdffJdffMMMr   r   c                  &    e Zd Zedd            ZdS )State
connectionr   returnNonec                
   K   d S Nr   selfr!   s     r   runz	State.run@   s      r   Nr!   r   r"   r#   )r   r   r   r   r(   r   r   r   r    r    >   s2           ^  r   r    )	metaclassc                      e Zd ZdZddZdS )	r   z5 The ``ClientConnection`` is not yet connected.

    r!   r   r"   r#   c                >   K   |                                  d {V  d S r%   )_connect_asyncr&   s     r   r(   zNOT_YET_CONNECTED.runI   s0      '')))))))))))r   Nr)   r   r   r   __doc__r(   r   r   r   r   r   D   s2         * * * * * *r   r   c                      e Zd ZdZddZdS )	r   zi The ``ClientConnection`` connected to a Bokeh server, but has not yet
    received an ACK from it.

    r!   r   r"   r#   c                >   K   |                                  d {V  d S r%   )_wait_for_ackr&   s     r   r(   zCONNECTED_BEFORE_ACK.runR   s0      &&(((((((((((r   Nr)   r.   r   r   r   r   r   L   s2         
) ) ) ) ) )r   r   c                      e Zd ZdZddZdS )	r   za The ``ClientConnection`` connected to a Bokeh server, and has
    received an ACK from it.

    r!   r   r"   r#   c                >   K   |                                  d {V  d S r%   )_handle_messagesr&   s     r   r(   zCONNECTED_AFTER_ACK.run[   s0      ))+++++++++++r   Nr)   r.   r   r   r   r   r   U   s2         
, , , , , ,r   r   c                  |    e Zd ZdZej        ddfddZedd            Zedd            Z	edd            Z
ddZdS )r   z] The ``ClientConnection`` was connected to a Bokeh server, but is
    now disconnected.

    N reasonr   
error_code
int | Noneerror_detailstrr"   r#   c                0    || _         || _        || _        dS )z Constructs a DISCONNECT-State with given reason (``ErrorReason``
        enum), error id and additional information provided as string.

        N)_error_code_error_detail_error_reason)r'   r8   r9   r;   s       r   __init__zDISCONNECTED.__init__d   s"    
 &)#r   c                    | j         S )zD The reason for the error encoded as an enumeration value.

        )r@   r'   s    r   error_reasonzDISCONNECTED.error_reasonn       
 !!r   c                    | j         S )z8 Holds the error code, if any. None otherwise.

        )r>   rC   s    r   r9   zDISCONNECTED.error_codeu   s    
 r   c                    | j         S )zC Holds the error message, if any. Empty string otherwise.

        )r?   rC   s    r   r;   zDISCONNECTED.error_detail|   rE   r   r!   r   c                
   K   d S r%   r   r&   s     r   r(   zDISCONNECTED.run   s      r   )r8   r   r9   r:   r;   r<   r"   r#   )r"   r   )r"   r:   )r"   r<   r)   )r   r   r   r/   r   r   rA   propertyrD   r9   r;   r(   r   r   r   r   r   ^   s         
 .9-A\`vx $ $ $ $ $ " " " X"       X  " " " X"     r   r   c                  ^    e Zd ZU dZded<   ddZedd	            Zedd
            ZddZ	dS )r   z The ``ClientConnection`` has sent a message to the Bokeh Server which
    should generate a paired reply, and is waiting for the reply.

    Message[Any] | None_replyreqidr   r"   r#   c                "    || _         d | _        d S r%   )_reqidrL   )r'   rM   s     r   rA   zWAITING_FOR_REPLY.__init__   s    r   c                    | j         S )z? The reply from the server. (``None`` until the reply arrives) )rL   rC   s    r   replyzWAITING_FOR_REPLY.reply        {r   c                    | j         S )z, The request ID of the originating message. )rO   rC   s    r   rM   zWAITING_FOR_REPLY.reqid   rR   r   r!   r   c                |  K   |                                  d {V }|4|                    t          t          j                             d {V  d S d|j        v rF|j        d         | j        k    r0|| _        |                    t                                 d {V  d S |
                                 d {V  d S )NrM   )_pop_message_transition_to_disconnectedr   r   r   headerrM   rL   _transitionr   _next)r'   r!   messages      r   r(   zWAITING_FOR_REPLY.run   s      "//11111111?88kF_9`9`aaaaaaaaaaa&&7>'+Bdj+P+P!DK(()<)>)>???????????""$$$$$$$$$$$r   N)rM   r   r"   r#   )r"   rK   )r"   r   r)   )
r   r   r   r/   __annotations__rA   rI   rQ   rM   r(   r   r   r   r   r      s          
         X    X% % % % % %r   r   )r/   
__future__r   logging	getLoggerr   logabcr   r   enumr   r   typingr   r	   
core.typesr   protocol.messager   r!   r   __all__r   r    r   r   r   r   r   r   r   r   <module>rf      s    # " " " " " g!! ( ' ' ' ' ' ' '         % % % % % % % %       -******,,,,,,"    $   
    g    * * * * * * * *) ) ) ) )5 ) ) ), , , , ,% , , ,& & & & &5 & & &P% % % % % % % % % %r   