
    Ng                        d dl mZ ddlmZ ddlT 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  G d
 de          Zd Zd Z ed          Z ed          Z ed          Z eddeeg          Z ed          ZdS )    )absolute_import   )ModuleScope)*)CythonUtilityCodeerror)StringSourceDescriptor)
MemoryView)EncodedStringc                   \     e Zd ZdZdZd Zd Z fdZ fdZd Z	ddZ
d	 Zd
 Zd Z xZS )CythonScoper   Fc                     t          j        | dd d            d| _        |                                  || _        t
          t          t          fD ]'}|                     |j	        |d d          }d|_
        (d S )NcythonTz<error>)cname)r   __init__pxd_file_loadedpopulate_cython_scopecontextcy_integral_typecy_floating_typecy_numeric_typedeclare_typedefnamein_cinclude)selfr   
fused_typeentrys       W/var/www/html/ai-engine/env/lib/python3.11/site-packages/Cython/Compiler/CythonScope.pyr   zCythonScope.__init__   s    T9dD999#""$$$+-=O 	% 	%J(()3)-/8 ) : :E !%E	% 	%    c                     | j         j        S N)r   cpp)r   s    r   is_cppzCythonScope.is_cpp   s    |r    c                 z    t          |          }|r|S t          t          |                               |          S r"   )parse_basic_typesuperr   lookup_type)r   r   type	__class__s      r   r(   zCythonScope.lookup_type"   s;    %% 	K[$''33D999r    c                     t          t          |                               |          }|C| j        s<|                                  t          t          |                               |          }|S r"   )r'   r   lookup_cythonscope_initializedload_cythonscope)r   r   r   r*   s      r   r,   zCythonScope.lookup*   s`    k4((//55=!>=!!###+t,,33D99Er    c                 ,    t          d|z  |           d S )Ncython.%s is not availabler   )r   module_nameposs      r   find_modulezCythonScope.find_module3   s    *[8#>>>>>r    c                    | j                             |d           }|s/|                                  | j                             |d           }|r|j        r|j        S t	          t          dd          ddfd|z            )Nr    r   r0   )entriesgetr.   	as_moduler	   r
   )r   r1   
as_packager   s       r   find_submodulezCythonScope.find_submodule6   s      d33 	8!!###L$$[$77E 	>U_ 	>?" /	3??AF.<> > >r    c                    |                     d          }| }t          |          dk    r>|                    |d                   }|r|j        }|d= |d S t          |          dk    >|                    |d                   S )N.r   r   )splitlenlookup_herer8   )r   qname	name_pathscopes       r   lookup_qualified_namez!CythonScope.lookup_qualified_nameF   s    KK%%	)nnq  %%il33E (!}t )nnq   $$Yq\222r    c                    |                      dt          d d          }d|_        |j        }|                     dt          t          t          dt          d           t          dt          |          d           g          d dd           d S )	NPyTypeObject)	base_typer2   r   TPyObject_TypeCheckotr   )r2   definingr   )
r   c_void_typeis_voidr)   declare_cfunction	CFuncTypec_bint_typeCFuncTypeArgpy_object_type
c_ptr_type)r   type_objecttype_object_types      r   r   z!CythonScope.populate_cython_scopeT   s    **#"	 + $ $
 #&+ kLnd$K$K$0jAQ6R6RTX$Y$Y$[ \ \( 	 	* 	* 	* 	* 	*r    c                    | j         rdS d| _         t                              | |            t                              | |            t	          d| d          x| _        }||                     d|d          _        d|_        d|_	        t                              ||            t          j                            | j        | t          j                  }d |j                                        D             }|D ]	}d|_        
t#          d          }t	          || d	          }||                     ||d
          _        d|_        d|_	        dS )zy
        Creates some entries for testing purposes and entries for
        cython.array() and for cython.view.*.
        NT)cython_scopeview)rV   	allowlistc                 4    g | ]}|j         j        |j         S  )r)   is_extension_type).0r   s     r   
<listcomp>z0CythonScope.load_cythonscope.<locals>.<listcomp>   s4     ; ; ;"!J8;ej ; ; ;r    r   dataclassesr   )r2   )r-   cython_testscope_utility_codedeclare_in_scope!cython_test_extclass_utility_coder   	viewscopedeclare_moduler8   is_cython_builtinr   !cythonview_testscope_utility_coder   view_utility_codeview_utility_allowlistr6   valuesis_cython_builtin_typer   )r   rc   view_utility_scope	ext_typesext_typedc_strdataclassesscopes          r   r.   zCythonScope.load_cythonscopef   s   
 ( 	F(,%%66 $4 	7 	9 	9 	9)::$(t 	; 	= 	= 	= &1$%E%EEAJFIt44>&*	#$(	!)::,5D 	; 	J 	J 	J (9JJ,0N6@6W K Y Y; ;&8&@&G&G&I&I; ; ;	 " 	0 	0H./H++
 ~..&vtTBBBL\F$4$??I-1*+/(((r    )F)__name__
__module____qualname__re   r-   r   r$   r(   r,   r3   r:   rC   r   r.   __classcell__)r*   s   @r   r   r      s        $% % %     : : : : :    ? ? ?> > > > 3 3 3* * *$,0 ,0 ,0 ,0 ,0 ,0 ,0r    r   c                      t          |           S r"   )r   r_   s    r   create_cython_scoperu      s     wr    c                 (    t          j        | dfi |S )NzTestCythonScope.pyx)r   load)cy_util_namekwargss     r   load_testscope_utilityrz      s    !,0EPPPPPr    a  
    /* These methods are undecorated and have therefore no prototype */
    static PyObject *__pyx_TestClass_cdef_method(
            struct __pyx_TestClass_obj *self, int value);
    static PyObject *__pyx_TestClass_cpdef_method(
            struct __pyx_TestClass_obj *self, int value, int skip_dispatch);
    static PyObject *__pyx_TestClass_def_method(
            PyObject *self, PyObject *value);
)proto	TestScopeTestDep	TestClass)r   requireszView.TestScopeN)
__future__r   Symtabr   
PyrexTypesUtilityCoder   Errorsr	   Scanningr
   r5   r   StringEncodingr   r   ru   rz   undecorated_methods_protosr`   test_cython_utility_deprb   rf   rZ   r    r   <module>r      sj   & & & & & &           * * * * * *       , , , , , ,       ) ) ) ) ) )F0 F0 F0 F0 F0+ F0 F0 F0T     Q Q Q )[ 0     !7 6{ C C 00;;  ;[%?%<%>? ? ? "
 %;$:;K$L$L ! ! !r    