
    -e                        d Z ddlmZ ddlZ ej        e          ZddlmZ ddl	m
Z
 ddlmZ d	Z G d
 de          ZdS )a   Provide a Bokeh Application Handler to build up documents by running
the code from Python script (``.py``) files.

This handler is configured with the filename of a Python module. When a
Bokeh application calls ``modify_doc``, the contents of the module are run to
process a new Document for a session. When the script code is executed, the
Document being modified will be available as ``curdoc``, and any optionally
provided ``args`` will be available as ``sys.argv``.

As an example, consider the following Python module ``myapp.py``

.. code-block:: python

    # myapp.py

    import sys

    from bokeh.io import cudoc
    from bokeh.plotting import figure

    p = figure(x_range=(10, 10), y_range=(10, 10), title=sys.argv[1])

    curdoc().add_root(p)

The a ``ScriptHandler`` configured with this script will modify new Bokeh
Documents by adding an empty plot with a title taken from ``args``.

    )annotationsN)
ModuleType   )PathLike   )CodeHandler)ScriptHandlerc                  4     e Zd ZdZdZdZg ddd fdZ xZS )r	   zD Modify Bokeh documents by executing code from Python scripts.

    zG%s: call to %s() ignored when running scripts with the 'bokeh' command.ScriptN)argvpackagefilenamer   r   	list[str]r   ModuleType | NonereturnNonec                   t          |d          5 }|                                }ddd           n# 1 swxY w Y   t                                          ||||           dS )za

        Keywords:
            filename (str) : a path to a Python source (".py") file

        zutf-8)encodingN)sourcer   r   r   )openreadsuper__init__)selfr   r   r   fr   	__class__s         Alib/python3.11/site-packages/bokeh/application/handlers/script.pyr   zScriptHandler.__init__P   s     (W--- 	VVXXF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	gVVVVVs   488)r   r   r   r   r   r   r   r   )__name__
__module____qualname____doc___logger_text_originr   __classcell__)r   s   @r   r	   r	   G   sp          ]LG@Bae 
W 
W 
W 
W 
W 
W 
W 
W 
W 
W 
W 
W    r	   )r!   
__future__r   logging	getLoggerr   logtypesr   
core.typesr   coder   __all__r	    r%   r   <module>r/      s    @ # " " " " " g!!       # " " " " "      W W W W WK W W W W Wr%   