
    #Yhf              	      n   d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ d	gZd
dej        iiZd
dej        iiZd Zd"dZ e
j
                     e
j        ddd           e
j        dddd           e
j        dddd          d#d!                                                ZdS )$z7Magic functions for rendering vega-lite specifications.    )annotationsN)	find_spec)Any)magic_arguments)is_pandas_dataframe)v5vegalite	vega-lite5c                   | t          | t                    r| S t          |           r#|                                x}r ||           } | S t          | t                    rd| iS t          j        dt          |            dd           | S )z1Convert input data to data for use within schema.Nurlzdata of type z not recognized   )
stacklevel)
isinstancedictr   getstrwarningswarntype)datadata_transformersfuncs      VD:\DownLoads\facial_attendance_system-main\venv311\Lib\site-packages\altair/_magics.py_prepare_datar      s    |z$--|	T	"	" $((***4 	4::D	D#		 t}Ad4jjAAAaPPPP    namer   returnr   c                    ddl m}  |            x}r+| |j        vrd|  d}t          |          |j        |          S d}t	          |          )z+Get a variable from the notebook namespace.r   )get_ipythonz
argument 'z1' does not match the name of any defined variablez[Magic command must be run within an IPython environment, in which get_ipython() is defined.)IPython.core.getipythonr    user_ns	NameError
ValueError)r   r    ipmsgs       r   _get_variabler'   .   su    333333[]]r 
rz!!VtVVVCC.. z$> 	 oor   r   ?zBlocal variablename of a pandas DataFrame to be used as the dataset)nargshelpz-vz	--versionversionr   )destdefaultz-jz--jsonjson
store_true)r,   actionvegalite_v5.VegaLitec                L   t          j        t          |           }ddi}||j                 }|t          d         v sJ t          d         |         }t
          d         |         }|j        rt          j        |          }nnt          d          s?	 t          j        |          }nI# t          j	        $ r}d}	t          |	          |d}~ww xY wddl}
|
                    ||
j                  }|j        't          |j                  }t!          ||          |d	<    ||          S )
aM  
    Cell magic for displaying vega-lite visualizations in CoLab.

    %%vegalite [dataframe] [--json] [--version='v5']

    Visualize the contents of the cell using Vega-Lite, optionally
    specifying a pandas DataFrame object to be used as the dataset.

    if --json is passed, then input is parsed as json rather than yaml.
    r   r   r
   yamlzH%%vegalite: spec is not valid JSON. Install pyyaml to parse spec as yamlNr   )Loaderr   )r   parse_argstringr	   r+   	RENDERERSTRANSFORMERSr.   loadsr   JSONDecodeErrorr$   r3   load
SafeLoaderr   r'   r   )linecellargsexisting_versionsr+   VegaLiter   specerrr&   r3   r   s               r   r	   r	   ?   s9   & *8T::Ds-Gi,,,,,%g.H$[1':y 7z$v 7	+:d##DD# 	+ 	+ 	+7  S//s*	+ 	yydoy66yTY''$T+<==V8D>>s   B$ $C
3CC
)r   r   r   r   )r   r1   )__doc__
__future__r   r.   r   importlib.utilr   typingr   IPython.corer   narwhals.stable.v1.dependenciesr   altair.vegaliter   vegalite_v5__all__r@   r6   r   r7   r   r'   argumentr	    r   r   <module>rN      s   = = " " " " " "   $ $ $ $ $ $       ( ( ( ( ( ( ? ? ? ? ? ? - - - - - -, [!	 [*     " ! ""

	M  
 $)TJJJ$vlKKK& & & LK KJ  #"& & &r   