
    NgB                     j    d Z ddlmZ ddlT ddlT ddlmZ  G d de          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.
    )absolute_import   )*)CompileErrorc                       e Zd Zd ZdS )
EmptyScopec                     d S )N )selfnames     W/var/www/html/ai-engine/env/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                 f   |v rLr5|                                }|st          | j        d          || j        fS t          | j        d          t          j        d         dk    r*t          | t                    r| j        | j        | j        fS |                     t                    | j        fS )NzInvalid type.zType not allowed here.r      )
analyse_as_typer   possysversion_info
isinstance
StringNodeunicode_value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 #a''tZ00 (&2*DH55++K88$(CCr   c                 .    g | ]\  }} ||          S r
   r
   ).0r    xr$   s      r   
<listcomp>z1interpret_compiletime_options.<locals>.<listcomp>8   s)    DDDA99Q##DDDr   N)	enumerater   DictNodekey_value_pairskeyvalue)	optlistoptdictr#   r"   new_optdictitemnew_keydummyr$   s	     ``    @r   interpret_compiletime_optionsr4      s    "D D D D D D   EDDDD71C1CDDD '8,,,,,+ 	I 	ID&Ytx66NGU#,9TZ#H#HK  [!!r   )Nr
   )__doc__
__future__r   Nodes	ExprNodesErrorsr   objectr   r   r4   r
   r   r   <module>r;      s     ' & & & & &                            jll*" *" *" *" *" *"r   