a
    na.                     @  s   d Z 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 dd	lmZ dd
lmZ ddlmZ ddlmZmZmZ dZe	eedf ZdefdddddddZdS )z

    )annotationsN)TupleUnion   )serialize_json)	DOC_NB_JS)Document)Model)Theme   )div_for_render_item)
FromCurdocOutputDocumentFor%standalone_docs_json_and_render_itemsnotebook_contentr	   z
str | NoneThemeSourcezTuple[str, str, Document])modelnotebook_comms_targetthemereturnc                 C  s   t | tstdt| g|dd }t| g\}\}W d   n1 sH0    Y  t|}| }|rn||d< tjt	|t	|gd}|||fS )a]   Return script and div that will display a Bokeh plot in a Jupyter
    Notebook.

    The data for the plot is stored directly in the returned HTML.

    Args:
        model (Model) : Bokeh object to render

        notebook_comms_target (str, optional) :
            A target name for a Jupyter Comms object that can update
            the document that is rendered to this notebook div

        theme (Theme, optional) :
            Defaults to the ``Theme`` instance in the current document.
            Setting this to ``None`` uses the default theme or the theme
            already specified in the document. Any other value must be an
            instance of the ``Theme`` class.

    Returns:
        script, div, Document

    .. note::
        Assumes :func:`~bokeh.io.notebook.load_notebook` or the equivalent
        has already been executed.

    z0notebook_content expects a single Model instanceT)Zapply_themeZ
always_newNr   )	docs_jsonZrender_items)

isinstancer	   
ValueErrorr   r   r   Zto_jsonr   Zrenderr   )r   r   r   Znew_docr   Zrender_itemZdivZscript r   3lib/python3.9/site-packages/bokeh/embed/notebook.pyr   5   s    
.)__doc__Z
__future__r   ZloggingZ	getLogger__name__logtypingr   r   Zcore.json_encoderr   Zcore.templatesr   Zdocumentr   r   r	   Zthemesr
   elementsr   utilr   r   r   __all__r   r   r   r   r   r   <module>   s   
