
    ag                     R    d Z ddlmZ ddlZddlmZmZmZ ddl	m
Z
 ddZ e        y)	z!
Experimental support for fugue.
    )AnyN   )hvPlotTabular
post_patch_module_extensions)_fugue_ipythonc                 <  	 	 ddl mm} ddlm}m} dd l} G fdd|      	dt        vrL|j                   || d             d	t        t        t        f   d
|f	fd       }t        j                  d       t        ||       y # t        $ r t        d      w xY w)Nr   )
DataFrames	Outputter)namespace_candidateparse_outputterzwCould not add fugue support as it could not be imported. Please make sure you have installed fugue in your environment.c                   <     e Zd Zdeddf fdZdW ddfdZ xZS )patch.<locals>._VisualizefuncreturnNc                 P    t         |           || _        t        t        |       y N)super__init___funcgetattrr   )selfr   	__class__s     ,lib/python3.12/site-packages/hvplot/fugue.pyr   z"patch.<locals>._Visualize.__init__   s    GDJM4(    dfsc                    g }|j                         D ]~  }t        | j                        }|j                  di       }  t	        |j                         j                  | j                        di |j                  di |}|j                  |        t        j                  | }	 t        s
t                ddlm}  ||       y# t         $ r |j#                          Y yw xY w)z
            Process the dataframes and output the result as
            a pn.Column.

            Parameters:
            -----------
            dfs: fugue.DataFrames
            optsr   )displayN )valuesdictparamspopr   	as_pandashvplotr   r   append_pnColumnr   get_ipythonIPython.displayr   	NameErrorshow)	r   r   chartsdfr#   r   chartcolr   s	            r   processz!patch.<locals>._Visualize.process   s     Fjjldkk*'-zz&"'=QB 5 5tzzBLVLQQYTXYe$	 #
 **f%C%M 4  
s   'C C"!C")__name__
__module____qualname__strr   r2   __classcell__)r   r
   s   @r   
_Visualizer      s)    	) 	) 	)
	z 	d 	r   r8   zhvplot.fuguec                 "    t        | t              S r   )
isinstancer6   )xs    r   <lambda>zpatch.<locals>.<lambda>;   s    zRSUXGYr   objr   c                      | d         S )Nr   r    )r=   r8   s    r   _parse_hvplotzpatch.<locals>._parse_hvplot;   s    c!f%%r   )fuguer
   r   fugue.extensionsr   r   ImportErrorhvplot.pandasr   	candidatetupler6   addr   )
name	extensionlogor   r   r   r&   r?   r
   r8   s
           @@r   patchrJ      s    
/I Y @ //		"	"#6t=Y#Z	[	&uS#X 	&9 	& 
\	& 	~.y$a  
M
 	

s   B B)r&   bokehF)__doc__typingr   panelr(    r   r   r   utilr   rJ   r    r   r   <module>rQ      s(      ; ;  4 n r   