
    ds                     d    d dl Z d dlZej        dk    re j        Znd Z G d d          ZddZdS )	    N)      c                 *    t          j        |           S N)astModule)nodelisttype_ignoress     5lib/python3.11/site-packages/altair/utils/execeval.pyr   r   	   s    z(###    c                   *    e Zd ZdZd Zd Zd Zd ZdS )_CatchDisplayz*Class to temporarily catch sys.displayhookc                     d | _         d S r   outputselfs    r   __init__z_CatchDisplay.__init__   s    r   c                 @    t           j        | _        | t           _        | S r   )sysdisplayhookold_hookr   s    r   	__enter__z_CatchDisplay.__enter__   s    r   c                 (    | j         t          _        dS )NF)r   r   r   )r   typevalue	tracebacks       r   __exit__z_CatchDisplay.__exit__   s    -ur   c                     || _         d S r   r   )r   r   s     r   __call__z_CatchDisplay.__call__   s    r   N)__name__
__module____qualname____doc__r   r   r   r     r   r   r   r      sV        44    
  
    r   r   <string>c                    t          j        | dd          }|i }t                      }t          |j        d         t           j                  r|j        dd         |j        dd         }}n	|j        g }}|D ]3}t          t          |gg           |d          }t          ||           4|5  |D ]7}t          t          j	        |g          |d          }t          ||           8	 ddd           n# 1 swxY w Y   |j
        S )z
    Execute a multi-line block of code in the given namespace

    If the final statement in the code is an expression, return
    the result of the expression.
    z<ast>exec)filenamemodeNsingle)r   parser   
isinstancebodyExprcompiler   r(   Interactiver   )	code	namespacer)   treecatch_displayto_execto_evalnodecompileds	            r   
eval_blockr;   !   sj    9TG&999D	!OOM$)B-** )9SbS>49RSS>9b " "64&"--vNNNXy!!!!	 & & 	& 	&D''(  H 9%%%%		&& & & & & & & & & & & & & & & s   /;C77C;>C;)Nr&   )r   r   version_infor   r   r;   r%   r   r   <module>r=      s    



 



 fZFF$ $ $       (           r   