
    hje	                    |    d Z ddlmZ ddlZ ej        e          ZddlZddlm	Z	 ddl
mZ ddlmZ dZdd	Zd
 ZdS )a   Generate an inline visual representations of a pandas Dataframe.

This directive will embed the output of ``df.head().to_html()`` into the HTML
output.

For example:

.. code-block:: rest

    :bokeh-dataframe:`bokeh.sampledata.sprint.sprint`

Will generate the output:

:bokeh-dataframe:`bokeh.sampledata.sprint.sprint`

To enable this extension, add `"bokeh.sphinxext.bokeh_dataframe"` to the
extensions list in your Sphinx configuration module.

    )annotationsN)nodes)SphinxError   )PARALLEL_SAFE)bokeh_dataframesetupc                   ddl }|                    dd          \  }}		 t          j        |          }
n## t          $ r t          d|	 d|           w xY wt          |
|	d          }|t          d|	 d|	 d|           t          ||j                  st          |d	          t          j
        d
|                                                                d          }|gg fS )ai  Generate an inline visual representation of a single color palette.

    If the HTML representation of the dataframe can not be created, a
    SphinxError is raised to terminate the build.

    For details on the arguments to this function, consult the Docutils docs:

    http://docutils.sourceforge.net/docs/howto/rst-roles.html#define-the-role-function

    r   N.r   z"Unable to generate HTML table for z: couldn't import module z: no Dataframe z in module z is not a pandas Dataframe html)format)pandasrsplit	importlibimport_moduleImportErrorr   getattr
isinstance	DataFramer   rawheadto_html)namerawtexttextlinenoinlineroptionscontentpdmodule_namedf_namemoduledfnodes                ?lib/python3.11/site-packages/bokeh/sphinxext/bokeh_dataframe.pyr   r   D   s"    ;;sA..Kp(55 p p pnwnnalnnooop 
$	'	'B	zxwxxW^xxkvxxyyyb",'' AT???@@@9R**,,V<<<D62:s	   4  Ac                F    |                      dt                     t          S )z+ Required Sphinx extension setup function. zbokeh-dataframe)add_roler   r   )apps    r'   r	   r	   c   s    LL"O444    )NN)__doc__
__future__r   logging	getLogger__name__logr   docutilsr   sphinx.errorsr   r   r   __all__r   r	    r+   r'   <module>r6      s    . # " " " " " g!!           % % % % % %         >    r+   