a
    @Dfh                  	   @  sR  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mZ ddlmZ ddlmZ ddlmZ ddlmZmZ ddlm Z  dZ!dZ"d6ddddddddddZ#dddddd d!d"Z$ddd#d$d%d&Z%ddd'd(d)d*d+Z&ddd'dd,d-d.Z'd7dd/d0ddd1d2d3d4d5Z(dS )8z

    )annotationsN)abspath
expanduser)Sequence)Template   )FILE)PathLike)	UIElement)	ResourcesResourcesLike)settings)Theme)warn   )Statecurstate)default_filenamez
Bokeh Plot)savezUIElement | Sequence[UIElement]zPathLike | NonezResourcesLike | Nonez
str | NonezTemplate | str | NonezState | Nonestr)objfilename	resourcestitletemplatestatereturnc                 C  sH   |du rt  }|jj}t||||\}}}t| ||||| tt|S )a   Save an HTML file with the data for the current document.

    Will fall back to the default output state (or an explicitly provided
    :class:`State` object) for ``filename``, ``resources``, or ``title`` if they
    are not provided. If the filename is not given and not provided via output state,
    it is derived from the script name (e.g. ``/foo/myplot.py`` will create
    ``/foo/myplot.html``)

    Args:
        obj (UIElement object) : a Layout (Row/Column), Plot or Widget object to display

        filename (PathLike, e.g. str, Path, optional) : filename to save document under (default: None)
            If None, use the default state configuration.

        resources (Resources or ResourcesMode, optional) : A Resources config to use (default: None)
            If None, use the default state configuration, if there is one.
            otherwise use ``resources.INLINE``.

        title (str, optional) : a title for the HTML document (default: None)
            If None, use the default state title value, if there is one.
            Otherwise, use "Bokeh Plot"

        template (Template, str, optional) : HTML document template (default: FILE)
            A Jinja2 Template, see bokeh.core.templates.FILE for the required template
            parameters

        state (State, optional) :
            A :class:`State` object. If None, then the current default
            implicit state is used. (default: None).

    Returns:
        str: the filename where the HTML file is saved.

    N)r   documenttheme_get_save_args_save_helperr   r   )r   r   r   r   r   r   r    r!   \/nfs/NAS7/SABIOD/METHODE/ermites/ermites_venv/lib/python3.9/site-packages/bokeh/io/saving.pyr   7   s    %r   r   ztuple[PathLike, Resources, str])r   r   r   r   r   c                 C  s0   t | |\}}t| ||}t| ||}|||fS )

    )_get_save_filename_get_save_resources_get_save_title)r   r   r   r   Zis_default_filenamer!   r!   r"   r   m   s    r   ztuple[PathLike, bool])r   r   r   c                 C  s6   |d ur|dfS | j r*t s*| j jdfS tddfS )NFhtmlT)filer   Zignore_filenamer   r   )r   r   r!   r!   r"   r$   z   s
    r$   boolr   )r   r   suppress_warningr   c                 C  sH   |d ur t |tr|S t|dS | jr.| jjS |s:td tt dS )N)modezosave() called but no resources were supplied and output_file(...) was never called, defaulting to resources.CDN)
isinstancer   r(   r   r   r   )r   r   r*   r!   r!   r"   r%      s    

r%   )r   r   r*   r   c                 C  s*   |d ur|S | j r| j jS |s&td tS )Nzosave() called but no title was supplied and output_file(...) was never called, using default title 'Bokeh Plot')r(   r   r   DEFAULT_TITLE)r   r   r*   r!   r!   r"   r&      s    r&   r	   zResources | NonezTheme | NoneNone)r   r   r   r   r   r   r   c           	      C  s^   ddl m} || |||pt|d}t|ddd}|| W d   n1 sP0    Y  dS )r#   r   )	file_html)r   r   r   r   wzutf-8)r+   encodingN)embedr/   r   openwrite)	r   r   r   r   r   r   r/   r'   fr!   r!   r"   r       s    r    )NNNNN)N))__doc__
__future__r   logging	getLogger__name__logos.pathr   r   typingr   Zjinja2r   Zcore.templatesr   Z
core.typesr	   Z	models.uir
   r   r   r   r   Zthemesr   Zutil.warningsr   r   r   r   utilr   r-   __all__r   r   r$   r%   r&   r    r!   r!   r!   r"   <module>   s4   
  6	 