U
    /e                      @  s   d dl mZ d dlZeeZd dlmZmZ d dl	m
Z
 ddlmZ ddlmZ erfdd	lmZmZ d
ZG dd de
ZG dd dee ZdS )    )annotationsN)TYPE_CHECKINGAny)	TypedDict   )ProtocolError)Message   )DocJsonDocument)push_docc                   @  s   e Zd ZU ded< dS )PushDocr
   docN)__name__
__module____qualname____annotations__ r   r   D/tmp/pip-unpacked-wheel-f5fndrjf/bokeh/protocol/messages/push_doc.pyr   1   s   
r   c                   @  s:   e Zd ZdZdZeddd dddZddd	d
dZdS )r   z Define the ``PUSH-DOC`` message for pushing Documents from clients to a
    Bokeh server.

    The ``content`` fragment of for this message is has the form:

    .. code-block:: python

        {
            'doc' : <Document JSON>
        }

    zPUSH-DOCr   r   )documentmetadatareturnc                 K  s&   |   }t| d}| |||}|S )z


        )r   )Zcreate_headerr   Zto_json)clsr   r   headercontentmsgr   r   r   createD   s    zpush_doc.createNone)r   r   c                 C  s&   d| j krtd|| j d  dS )z5

        Raises:
            ProtocolError

        r   zNo doc in PUSH-DOCN)r   r   Zreplace_with_json)selfr   r   r   r   push_to_documentO   s    
zpush_doc.push_to_documentN)r   r   r   __doc__Zmsgtypeclassmethodr   r   r   r   r   r   r   4   s
   
r   )
__future__r   logging	getLoggerr   logtypingr   r   Ztyping_extensionsr   
exceptionsr   messager   Zdocument.documentr
   r   __all__r   r   r   r   r   r   <module>   s   
