
    Ae                         d dl mZ ddlmZ ddl 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y)    )absolute_import   )ModuleScope)*)CythonUtilityCodeerror)StringSourceDescriptor)
MemoryViewc                   Z     e Zd ZdZdZd Zd Z fdZ fdZd Z	d Z
d	 Zd
 Zd Z xZS )CythonScoper   Fc                     t        j                  | dd d        d| _        | j                          || _        t
        t        t        fD ](  }| j                  |j                  |d d      }d|_
        * y )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       ;lib/python3.12/site-packages/Cython/Compiler/CythonScope.pyr   zCythonScope.__init__   sv    T9dD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                 H    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[$3D99r   c                     t         t        |   |      }|/| j                  s#| j	                          t         t        |   |      }|S r!   )r&   r   lookup_cythonscope_initializedload_cythonscope)r   r   r   r)   s      r   r+   zCythonScope.lookup)   sC    k4/5=!>!>!!#+t3D9Er   c                 "    t        d|z  |       y )Ncython.%s is not availabler   )r   module_nameposs      r   find_modulezCythonScope.find_module2   s    *[8#>r   c                    | j                   j                  |d       }|s,| j                          | j                   j                  |d       }|r|j                  r|j                  S t	        t        dd      ddfd|z        )Nr    r   r/   )entriesgetr-   	as_moduler	   r
   )r   r0   r   s      r   find_submodulezCythonScope.find_submodule5   sx      d3!!#LL$$[$7EU__??" /	3?AF.<> >r   c                     |j                  d      }| }t        |      dkD  r7|j                  |d         }|r|j                  }|d= |y t        |      dkD  r7|j                  |d         S )N.r   r   )splitlenlookup_herer7   )r   qname	name_pathscopes       r   lookup_qualified_namez!CythonScope.lookup_qualified_nameE   su    KK%	)nq %%il3E!} )nq  $$Yq\22r   c                     | j                  dt        d d      }d|_        |j                  }| j	                  dt        t        t        dt        d       t        dt        |      d       g      d dd       y )	NPyTypeObject)	base_typer1   r   TPyObject_TypeCheckotr   )r1   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_scopeS   s    **#"	 + $
 #&++ kLnd$K$0jAQ6RTX$Y$[ \( 	 	*r   c                    | j                   ryd| _         t        j                  | |        t        j                  | |        t	        d| d      x| _        }|| j                  d|d      _        d|_        d|_	        t        j                  ||        t        j                  j                  | j
                  | t        j                        }y)zy
        Creates some entries for testing purposes and entries for
        cython.array() and for cython.view.*.
        NT)cython_scopeview)rT   	whitelist)r,   cython_testscope_utility_codedeclare_in_scope!cython_test_extclass_utility_coder   	viewscopedeclare_moduler7   is_cython_builtinr   !cythonview_testscope_utility_coder   view_utility_codeview_utility_whitelist)r   rZ   view_utility_scopes      r   r-   zCythonScope.load_cythonscopee   s    
 (((,%%66 $4 	7 	9)::$(t 	; 	= &1$%EEAJFIt4>&*	#$(	!)::,5D 	; 	J (99JJ,0NN6@6W6W K Yr   )__name__
__module____qualname__r\   r,   r   r#   r'   r+   r2   r8   rA   r   r-   __classcell__)r)   s   @r   r   r      s=    $% :?> 3*$Yr   r   c                     t        |       S r!   )r   )r   s    r   create_cython_scoperf      s     wr   c                 0    t        j                  | dfi |S )NzTestCythonScope.pyx)r   load)cy_util_namekwargss     r   load_testscope_utilityrk      s    !!,0E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
   r4   r   r   rf   rk   undecorated_methods_protosrW   test_cython_utility_deprY   r]    r   r   <module>rz      s    &   *  , uY+ uYt Q ) 0   !7{ C 0;  ;[%?%<%>? "
 %;;K$L !r   