
    -Ph'                     X    d Z ddlmZ ddlmZ  G d d          Z e            Zd	dZdS )
z
This module deals with interpreting the parse tree as Python
would have done, in the compiler.

For now this only covers parse tree to value conversion of
compile-time values.
   )DictNode)CompileErrorc                       e Zd Zd ZdS )
EmptyScopec                     d S )N )selfnames     [/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/Cython/Compiler/Interpreter.pylookupzEmptyScope.lookup   s    t    N)__name__
__module____qualname__r   r   r   r   r   r      s#            r   r   Nr   c                    fd| rfdt          |           D             } |rWt          |t                    sJ i }|j        D ]4} |j        d          \  }} |j        |j        j                  ||<   5|}| |fS )a,  
    Tries to interpret a list of compile time option nodes.
    The result will be a tuple (optlist, optdict) but where
    all expression nodes have been interpreted. The result is
    in the form of tuples (value, pos).

    optlist is a list of nodes, while optdict is a DictNode (the
    result optdict is a dict)

    If type_env is set, all type nodes will be analysed and the resulting
    type set. Otherwise only interpretateable ExprNodes
    are allowed, other nodes raises errors.

    A CompileError will be raised if there are problems.
    c                     |v rLr5|                                }|st          | j        d          || j        fS t          | j        d          |                     t                    | j        fS )NzInvalid type.zType not allowed here.)analyse_as_typer   poscompile_time_valueempty_scope)nodeixtype	type_argstype_envs      r   	interpretz0interpret_compiletime_options.<locals>.interpret%   s~    ?? G++H55 B&txAAAdh''"48-EFFF''44dh??r   c                 .    g | ]\  }} ||          S r   r   ).0r   xr   s      r   
<listcomp>z1interpret_compiletime_options.<locals>.<listcomp>1   s)    DDDA99Q##DDDr   N)	enumerate
isinstancer   key_value_pairskeyvalue)	optlistoptdictr   r   new_optdictitemnew_keydummyr   s	     ``    @r   interpret_compiletime_optionsr,      s    "	@ 	@ 	@ 	@ 	@ 	@  EDDDD71C1CDDD '8,,,,,+ 	I 	ID&Ytx66NGU#,9TZ#H#HK  [!!r   )Nr   )__doc__	ExprNodesr   Errorsr   r   r   r,   r   r   r   <module>r0      s                               jll%" %" %" %" %" %"r   