a
    @¸Df"  ã                   @  sº   U d Z ddlmZ ddlZe e¡ZddlZddlm	Z	 ddl
mZmZmZ ddlmZ dd	lmZ ertdd
lmZ dZddœdd„Ze	dddœdd„ƒZdddœdd„Zg aded< dS )z

é    )ÚannotationsN)Úcontextmanager)ÚTYPE_CHECKINGÚIteratorÚcasté   )ÚDocumenté   )Úcurstate)ÚUnlockedDocumentProxy)ÚcurdocÚpatch_curdocÚ
set_curdocr   )Úreturnc                  C  s8   t tƒdkr0td ƒ } | du r&tdƒ‚tt| ƒS tƒ jS )z Return the document for the current default state.

    Returns:
        Document : the current default document object.

    r   éÿÿÿÿNz,Patched curdoc has been previously destroyed)ÚlenÚ_PATCHED_CURDOCSÚRuntimeErrorr   r   r
   Údocument©Údoc© r   úY/nfs/NAS7/SABIOD/METHODE/ermites/ermites_venv/lib/python3.9/site-packages/bokeh/io/doc.pyr   1   s    

r   z Document | UnlockedDocumentProxyzIterator[None])r   r   c                 c  s$   t  t | ¡¡ ~ dV  t  ¡  dS )a2   Temporarily override the value of ``curdoc()`` and then return it to
    its original state.

    This context manager is useful for controlling the value of ``curdoc()``
    while invoking functions (e.g. callbacks). The cont

    Args:
        doc (Document) : new Document to use for ``curdoc()``

    N)r   ÚappendÚweakrefÚrefÚpopr   r   r   r   r   C   s    r   ÚNonec                 C  s   | t ƒ _dS )zñ Configure the current document (returned by curdoc()).

    Args:
        doc (Document) : new Document to use for curdoc()

    Returns:
        None

    .. warning::
        Calling this function will replace any existing document.

    N)r
   r   r   r   r   r   r   U   s    r   z=list[weakref.ReferenceType[Document | UnlockedDocumentProxy]]r   )Ú__doc__Ú
__future__r   ÚloggingÚ	getLoggerÚ__name__Úlogr   Ú
contextlibr   Útypingr   r   r   r   r   Ústater
   Zdocument.lockingr   Ú__all__r   r   r   r   Ú__annotations__r   r   r   r   Ú<module>   s    

