
    I.ea                     ^    d Z ddlmZmZmZ ddlZddlmZm	Z	 ddl
mZ dd
Z e             dS )z!
Experimental support for fugue.
    )AnyDictTupleN   )hvPlotTabular
post_patch)_fugue_ipythonhvplotbokehFc                 ,  	 	 ddl mm} ddlm}m} n#  t          d          xY wdd l} G fdd|          	|                     || d                     dt          t          t          f         d	|f	fd
            }t          ||           d S )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ddfdZ xZS )patch.<locals>._VisualizefuncreturnNc                     t                                                       || _        t          t          |           d S N)super__init___funcgetattrr   )selfr   	__class__s     ,lib/python3.11/site-packages/hvplot/fugue.pyr   z"patch.<locals>._Visualize.__init__   s6    GGDJM4(((((    dfsc                    g }|                                 D ]~}t          | j                  }|                    di           }  t	          |                                j        | j                  di |j        di |}|	                    |           t          j        | }	 t          st                       ddlm}  ||           dS # t           $ r |                                 Y dS 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_pandasr
   r   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jjll % %dk**'-zz&"'='=QB 5tzBBLLVLLQYYTXYYe$$$$*f%C% "MMM 433333	    





s   %C C/.C/)__name__
__module____qualname__strr   r4   __classcell__)r   r   s   @r   
_Visualizer      sn        	) 	) 	) 	) 	) 	) 	) 	)
	z 	d 	 	 	 	 	 	 	 	r   r:   c                 ,    t          | t                    S r   )
isinstancer8   )xs    r   <lambda>zpatch.<locals>.<lambda>7   s    :aQTCUCU r   objr   c                 &     | d                   S )Nr   r#   )r?   r:   s    r   _parse_hvplotzpatch.<locals>._parse_hvplot7   s    z#a&!!!r   )fuguer   r   fugue.extensionsr   r   ImportErrorhvplot.pandas	candidater   r8   r   )
name	extensionlogor   r   r   r
   rA   r   r:   s
           @@r   patchrJ      s   
////////IIIIIIIII
M
 
 	

       Y   @ 2249U9UVVWW"5c? "y " " " " " XW" y$s    &)r
   r   F)__doc__typingr   r   r   panelr*    r   r   utilr	   rJ   r#   r   r   <module>rP      s     $ # # # # # # # # #     ' ' ' ' ' ' ' '            0  0  0  0 f r   