
    -Ph                       d dl Z d dlZd dlZd dlZddlmZ ddlmZmZm	Z	m
Z
 ddlmZ ddlmZmZ ddlmZ dd	lmZmZ dd
lmZmZmZmZmZ ddlmZ ddlmZ d Zd7dZ G d d          Z G d d          Z G d de          Z G d d          Z  G d de           Z! G d de           Z"dZ# G d de           Z$ G d de           Z% G d d e           Z& G d! d"e%          Z' G d# d$e'          Z( G d% d&e           Z) G d' d(e           Z* G d) d*e*          Z+ G d+ d,e*          Z, G d- d.e           Z- G d/ d0e           Z. G d1 d2e           Z/ G d3 d4e           Z0 G d5 d6e           Z1dS )8    N   )try_finally_contextmanager   )warningerrorInternalErrorperformance_hint)EncodedString)OptionsNaming)
PyrexTypes)py_object_typeunspecified_type)pyfunction_signaturepymethod_signaturerichcmp_special_methodsget_slot_tableget_property_accessor_signature)
DebugFlags)Codec                     | d d         dk    r#|                      t          j                  s| dv r| t          j        v rt          j        | z   } | S )Nr   __)__weakref____dict__)
startswithr   pyrex_prefixreserved_cnames)cnames    V/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/Cython/Compiler/Symtab.pyc_safe_identifierr       sW    	rrd		E$4$4V5H$I$I	',0K'K'K...#e+L    c                 R   |                                  r| S |                     d                              dd                              d          } |r|d| } nJ|                     t
          j                  r+|                     t
          j        t
          j        d          } | S )Npunycode   -   _ascii_r   )isasciiencodereplacedecoder   r   r   pyunicode_identifier_prefix)r   mangle_withs     r   punycodify_namer.   "   s     }} LL$$,,T488??HHE 	E ';;.			&-	.	. E f1$@!E E Lr!   c                       e Zd ZdZd Zd ZdS )	BufferAuxFc                 "    || _         || _        d S N)buflocal_nd_var	rcbuf_var)selfr3   r4   s      r   __init__zBufferAux.__init__:   s    ."r!   c                     d| j         z  S )Nz<BufferAux %r>r   r5   s    r   __repr__zBufferAux.__repr__>   s    $-//r!   N)__name__
__module____qualname__writable_neededr6   r:    r!   r   r0   r0   7   s7        O# # #0 0 0 0 0r!   r0   c                      e Zd ZdZdZdZdZdZdZdZ	dZ
dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(g Z)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5dZ6dZ7dZ8dZ9dZ:dZ;dZ<dZ=dZ>dZ?dZ@dZAdZBdZCdZDdZEdZFdZGdZHdZIdZJdZKdZLdZMddZNeOjP        reQd             ZReRjS        d	             ZRd
 ZTd ZUd ZVd ZWddZXd ZYd ZZeQd             Z[d Z\d Z]dS )EntryFr    NprivateTc                     || _         || _        || _        || _        || _        g | _        g | _        g | _        g | _        | | _	        d S r2   )
namer   typeposinitoverloaded_alternativescf_assignmentscf_referencesinner_entriesdefining_entry)r5   rE   r   rF   rG   rH   s         r   r6   zEntry.__init__   sS    	
		')$ "r!   c                     | j         d         S )NrF   r8   r9   s    r   rF   z
Entry.type   s    =((r!   c           
          t          d| j         d| j         d| j                            d           d|            || j        d<   d S )NzENTRY [z] TYPE: rF   z -> )printrE   r   r   get)r5   new_types     r   rF   z
Entry.type  sX    d49ddtzdd4=;L;LV;T;TddZbddeee$,DM&!!!r!   c                 f    dt          |           j        t          |           | j        | j         fz  S )Nz%s(<%x>, name=%s, type=%s))rF   r;   idrE   r9   s    r   r:   zEntry.__repr__  s+    +tDzz/BBtHHdiY]Yb.cccr!   c                 0    t          | j        d           d S )NPrevious declaration is here)r   rG   r9   s    r   already_declared_herezEntry.already_declared_here	  s    dh677777r!   c                 ^    t          |d| j        z             |                                  d S )Nz('%s' does not match previous declaration)r   rE   rX   )r5   rG   s     r   
redeclaredzEntry.redeclared  s2    c=	IJJJ""$$$$$r!   c                     | g| j         z   S r2   )rI   r9   s    r   all_alternativeszEntry.all_alternatives  s    v444r!   c                    d }| j         |                      ||          }|^| j        j        r&| j                                        }d |D             }n|                                 }t          j        ||||          }|S )Nc                     g | ]	}|j         
S r?   )entry).0fs     r   
<listcomp>z-Entry.best_function_match.<locals>.<listcomp>  s    ;;;A;;;r!   )fail_if_emptyarg_is_lvalue_array)specialiserrF   is_fused"get_all_specialized_function_typesr\   r   
best_match)r5   scope	arg_typesrc   rd   
func_entry	functypesalternativess           r   best_function_matchzEntry.best_function_match  s    
'))%;;Jy! 7 IHHJJ	;;;;;#4466#.<}Zmo o oJr!   c                     | g| j         z   S r2   )rL   r9   s    r   all_entrieszEntry.all_entries!  s    v***r!   c                     t          | t                    r3t          |t                    r| j        | j        f|j        |j        fk     S t          S r2   )
isinstancerA   rE   r   NotImplemented)leftrights     r   __lt__zEntry.__lt__$  sH    dE"" 	"z%'?'? 	"Itz*ej%+-FFF!!r!   c                 2    t          | j                  dk    S Nr   )lenrJ   r9   s    r   cf_is_reassignedzEntry.cf_is_reassigned*  s    4&''!++r!   c                     | j         j        sJ d| _        | j        rJ t          j                            dd          | _        d S )NTOptionalLocalsCppSupport.cpp)rF   is_cpp_classis_cpp_optionalutility_coder   UtilityCodeload_cachedutility_code_definitionr9   s    r   make_cpp_optionalzEntry.make_cpp_optional.  sM    y%%%%#$$$$'+'7'C'CDTVf'g'g$$$r!   c                 &    | j         r	|| j         v ndS NF)pytyping_modifiers)r5   modifier_names     r   declared_with_pytyping_modifierz%Entry.declared_with_pytyping_modifier4  s    ;?;R]} 777X]]r!   NN)FN)^r;   r<   r=   inline_func_in_pxdborrowedrH   
annotation
visibility
is_builtin
is_cglobalis_pyglobal	is_memberis_pyclass_attris_variableis_cfunction
is_cmethodis_builtin_cmethodis_unbound_cmethodis_final_cmethodis_inline_cmethodis_anonymousis_type	is_cclassis_cclass_var_entryr~   is_constis_propertyis_cproperty	doc_cnamegetter_cnamesetter_cnameis_self_argis_argis_local
in_closurefrom_closurein_subscopeis_declared_genericis_readonlypyfunc_cname
func_cnamefunc_modifiersfinal_func_cnamedocas_variablexdecref_cleanupin_cinclude	as_moduleis_inheritedpystring_cnameis_identifieris_internedused
is_specialdefined_in_pxdis_implementedapir   re   is_overridable
buffer_aux
prev_entrymight_overflowfused_cfunctionis_fused_specializedr   needs_propertyin_with_gil_blockfrom_cython_utility_codeerror_on_uninitializedcf_usedouter_entry
is_cgetterr   known_standard_library_importr   enum_int_valuevtable_typer6   r   debug_verbose_entry_typespropertyrF   setterr:   rX   rZ   r\   rn   rp   rv   rz   r   r   r?   r!   r   rA   rA   B   s       B HDJJJJKIOKLJLGILHKLILLKFHJLKKLJN
CKOKILNMKDJNN
CLKNJJNO "N#"GKJO$(!NK
# 
# 
# 
# + -		) 	) 
	) 
	- 	- 
	-d d d8 8 8% % %5 5 5   + + +" " " , , X,h h h^ ^ ^ ^ ^r!   rA   c                   (    e Zd ZdZdZd Zd Zd ZdS )
InnerEntryzK
    An entry in a closure scope that represents the real outer Entry.
    Tc                 n   t                               | |j        |j        |j        |j                   || _        || _        |}|j        r|j        }|j        || _        |j	        | _	        |j
        | _
        |j        | _        |j        | _        |j        | _        | j	                            |            d S r2   )rA   r6   rE   r   rF   rG   r   ri   rM   rL   rJ   rK   rI   r   append)r5   r   ri   outermost_entrys       r   r6   zInnerEntry.__init__>  s    t[-"("'"	( 	( 	( '
 &) 	:-9O ) 	:-,:-<,:'6'N$.>!!$'''''r!   c                 t    |                     d          rt          |          t          | j        |          S )Nr   )r   AttributeErrorgetattrrM   r5   rE   s     r   __getattr__zInnerEntry.__getattr__R  s7    ??4   	' &&&t*D111r!   c                 4    | j                                         S r2   )rM   rp   r9   s    r   rp   zInnerEntry.all_entriesX  s    "..000r!   N)r;   r<   r=   __doc__r   r6   r   rp   r?   r!   r   r   r   8  sR          L( ( ((2 2 21 1 1 1 1r!   r   c                   .   e Zd ZdZdZdZdZdZdZdZ	dZ
dZdZdZdZdZdZdZdZdZdZg ZdZi Zd Zd ZdEdZd	 Zd
 ZdFdZd Zd ZdFdZ e!d             Z"d Z#d Z$d Z%e&dFd            Z'dGdZ(dHdZ)d Z*dIdZ+	 	 dJdZ,	 	 dKdZ-	 	 	 dLdZ.	 	 dMdZ/d  Z0d! Z1	 dNd"Z2d# Z3	 	 dOd$Z4dPd%Z5d& Z6d' Z7dQd(Z8dRd)Z9d* Z:d+ Z;d, Z<	 	 dSd-Z=	 	 dTd.Z>dGd/Z?d0 Z@d1 ZAd2 ZBd3 ZCd4 ZDd5 ZEd6 ZFd7 ZGd8 ZHd9 ZId: ZJd; ZKd< ZLd= ZMd> ZNd? ZOd@ ZPdA ZQdUdBZRdC ZSdFdDZTdS )VScoper   FrB   NTc                    || _         || _        || _        dt          |          |                    dd          fz  }|                                 }|r*|                    |          | _        |j        |z   | _        nt          |          | _        || _        i | _
        t                      | _        g | _        g | _        g | _        g | _        g | _        g | _        g | _        g | _        g | _        i | _        i | _        i | _        i | _        i | _        g | _        g | _        i | _        | j        D ],}|                     t          |          t@          d            -d S )Nz%d%s_._dot_rG   )!rE   outer_scopeparent_scopery   r*   qualifying_scopequalify_namequalified_namescope_prefixr
   entriesset	subscopesconst_entriestype_entriessue_entriesarg_entriesvar_entriespyfunc_entriescfunc_entriesc_class_entriesdefined_c_classesimported_c_classescname_to_entryidentifier_to_entrynum_to_entryobj_to_entrybuffer_entrieslambda_defsid_countersscope_predefined_namesdeclare_varr   )r5   rE   r   r   mangled_name
qual_scopevar_names          r   r6   zScope.__init__  sx    	&(#d))T\\#w-G-G!HH**,,
 	-","9"9$"?"?D * 7, FD"/"5"5D ,D !!#"$ #%  3 	P 	PH]844n$OOOO	P 	Pr!   c                     | S r2   r?   )r5   memos     r   __deepcopy__zScope.__deepcopy__      r!   c                 ~   g }|j                                         D ]+\  }}|r||v r |j        s|r|                    ||f           ,| j                             |           dD ]X}t          | |          }d |D             }	t          ||          D ])}|j        s|r|j        |	vr|                    |           *Yd S )N)r   r   r   r   r   r   r   r   c                     h | ]	}|j         
S r?   rE   )r`   es     r   	<setcomp>z!Scope.merge_in.<locals>.<setcomp>  s    222QV222r!   )r   itemsr   r   updater   rE   )
r5   othermerge_unused	allowlistr   rE   r_   attrself_entriesnamess
             r   merge_inzScope.merge_in  s    =..00 	2 	2KD% 2	 1 1: 2 2NND%=111G$$$( 	/ 	/D #4..L22\222E -- / /J /, /EJe4K4K ''.../	/ 	/r!   c                 2    d| j         j        d| j        dS )N< >)	__class__r;   r   r9   s    r   __str__zScope.__str__  s#      N333T5H5H5HIIr!   c                     | j         S r2   r   r9   s    r   r   zScope.qualifying_scope  s      r!   c                 z    |rt          || j        |          S | j                            || j                  S r2   )r.   r   r   manglerE   r5   prefixrE   s      r   r  zScope.mangle  sD     	?"vvt7H7H$$#OPPP$++FDI>>>r!   c                 N    t           j        |d}|                     |          S )Nr'   )r   r   r  )r5   rE   r   s      r   mangle_internalzScope.mangle_internal  s*     #//6{{6"""r!   c                 H    | j         r| j                             |          S |S r2   )r   mangle_class_private_namer   s     r   r$  zScope.mangle_class_private_name  s*     	E$>>tDDDr!   c                     |                                  j        }	 ||         dz   }n# t          $ r d}Y nw xY w|||<   |r|s|S d||fz  S d|z  S )Nr   r   z%s%dz%d)global_scoper   KeyError)r5   rE   counterscounts       r   next_idzScope.next_id  s    $$&&2	TNQ&EE 	 	 	EEE	 	  T5M))%<s   ' 66c                 4    |                                  j        S r2   )r&  contextr9   s    r   r,  zScope.context  s      ""**r!   c                 4    | j                                         S z6 Return the module-level scope containing this scope. )r   r&  r9   s    r   r&  zScope.global_scope  s    ,,...r!   c                 4    | j                                         S r.  )r   builtin_scoper9   s    r   r0  zScope.builtin_scope  s    --///r!   c              #      K   | V  | j         r0t          | j         t          j        d                    E d {V  d S d S )Nr   )key)r   sortedoperator
attrgetterr9   s    r   iter_local_scopeszScope.iter_local_scopes
  s^      


> 	Wdn(2En2U2UVVVVVVVVVVVV	W 	Wr!   c              #   @   K   | j         }||| _         d V  || _         d S r2   )in_c_type_context)r5   r8  old_c_type_contexts      r   new_c_type_contextzScope.new_c_type_context  s4      !3(%6D"!3r!   c                 `   d}| j         }||         }	d}
|j        r|	j        j        r|                                 r|	                                D ]m}|                    |j                  rQ|dk    r
|j        sd}
n	|j        rd}
|
r4|}|rt          j        |          }||_        d|_        ||_	        ||_
         nnd}
|
rnl||         j        rn^|dk    rt          |d|z  | j        rdnd           n8|d	k    r2t          |d|z             | j         |                                          dS |S )
a  
        Returns an entry or None

        If it returns an entry, it makes sense for "declare" to keep using that
        entry and not to declare its own.

        May be overridden (e.g. for builtin scope,
        which always allows redeclarations)
        NF<init>Textern'%s' redeclared r   r   ignore)r   r   rF   is_cppr\   compatible_signature_withargsr   copyr   rG   r   r   r   rX   )r5   rE   r   rF   rG   r   
copy_entryr_   r   	old_entrycpp_override_allowed	alt_entrys               r   handle_already_declared_namez"Scope.handle_already_declared_name  s    ,DM	  % 	,!< 	, 	, '7799 , ,	11).AA x''	'/3,,"/ 4/3,+ ( )% 9$(Ii$8$8E &*
-2*&+$'	E'* (,$ 	T]' 	X%% /$6T=M8TSTUUUUx''c-4555T"88:::4r!   c	                    |j         r%t          | t                    st          |d           | j        s+|r)t          j        d|          rt          |d|z  d           | j        }	d }
|r||	v r|s| 	                    |||||          }
|
st          ||||          }
| j        |
_        ||
_        |rn|                     |          |
_        |sR||	v rI|                                 r5|j        r.|	|         j        s!|	|         j                            |
           n|
|	|<   |j        r|j        |
_        | |
_        ||
_        |
S )Nz5Buffer types only allowed as function local variablesz
^_[_A-Z]+$z'%s' is a reserved name in C.r   )	is_bufferrr   
LocalScoper   r   rematchr   r   rH  rA   create_wrapperr   r   r@  r   r   rI   r   is_memoryviewslicedefault_valuerH   ri   r   )r5   rE   r   rF   rG   r   shadowr   rO  r   r_   s              r   declarezScope.declareV  s    > 	P*T:">"> 	P#NOOO 	FE 	Fbh|U.K.K 	FC85@"EEE, 	ZDGOOFO55dE4jYYE 	.$t3777E $ 0E#1E  .'+'8'8'>'>$ .w4;;==T=NW^_cWdWo=DDUKKKK(-" 	,+EJ%r!   c                 4    t          | j        d|          S Nr   )r
   r   r   s     r   r   zScope.qualify_namez  s     (;(;(;TTBCCCr!   rC   c	                     |s2| j         s|dk    s|r|}n |                     t          j        |          }|                     ||||||          }	d|	_        ||	_        |	S )Npublic)rO  r   )r   r  r   enum_prefixrS  r   
value_node)
r5   rE   rF   valuerG   r   r   r   rO  r_   s
             r   declare_constzScope.declare_const}  ss     	> >J($:$:c$:F$6==T5$ZR`aa r!   r   c
           	          |s|}|                      ||||||d          }
d|
_        ||
_        |r| j                            |
           |	st          |dd           |
|_        |
S )NT)r   r   r_   )rS  r   r   r   r   r   r_   )r5   rE   rF   rG   r   r   r   definingrR  templater_   s              r   declare_typezScope.declare_type  s      	ET5$Z%)  + +	 	,$$U+++  	GD'488@DJ r!   c                    |s2| j         s|dk    s|r|}n |                     t          j        |          }	 | j        r%| j                            | j                  j        }nd }t          j
        ||||dk    |          }n># t          $ r1}	t          ||	j        d                    t          j        }Y d }	~	nd }	~	ww xY w|                     ||||||          }
|
j        |_        |
S )NrC   r=  r   )r   r   )r   r  r   type_prefixis_cpp_class_scoper   lookuprE   rF   r   create_typedef_type
ValueErrorr   rB  
error_typer_  r   )r5   rE   	base_typerG   r   r   r   	namespacerF   r
  r_   s              r   declare_typedefzScope.declare_typedef  s    	> >J)$;$;s$;F$6==
	)& ! ,33DI>>C		 	1$	53=3I2;= =DD  	) 	) 	)#qvay!!!(DDDDDD	) !!$c5/9 " F F#2s   A
B 
B<'B77B<c
           
      F   |s2| j         s|dk    s|r|}n |                     t          j        |          }|                     |          }
|
so|                                 }t          j        ||||||	|          }|                     |||||||d u          }
| j	        
                    |
           |
|_        n|
j        r|
j        j        r|
j        j        |k    st!          |d|z  d           ny|r!|
j        j        rt!          |d|z  d           nV|                     |
||           |                     |
||           |r&||
j        _        | j        
                    |
           | j        r.| j                            | j                  j        |
j        _        |
S )NrW  )in_cpp)r   r   r]  '%s' redeclared  r   2'%s' already defined  (ignoring second definition))r   r  r   ra  lookup_herer@  r   CStructOrUnionTyper_  r   r   r_   r   rF   is_struct_or_unionkindr   ri   check_previous_typedef_flagcheck_previous_visibilityr   rb  r   rc  rE   rh  )r5   rE   rq  ri   typedef_flagrG   r   r   r   packedr_   rk  rF   s                r   declare_struct_or_unionzScope.declare_struct_or_union  s   
  	> >J($:$:c$:F$6==  && 	4[[]]F0dE<! ! !D %%dD#u's , & . .E ##E***DJJM 
4ej&C 
4
4//047;;;; 45:+ 4QTXXZ[\\\\00cJJJ..uj#FFF 4',EJ$%,,U333" 	K#'#3#:#:49#E#E#JEJ r!   r?   r=  c           	        
 |0| j         s|dk    r|}n |                     t          j        |          }t	          |          }|                     |          }|sRt          j        |||||          }	|                     ||	|||d u          }| j	        
                    |           n|j        r|j        j        s)t          d|z             |                                 d S |r!|j        j        rt#          d|z  d           n(|r&||j        _        | j        
                    |           |rM|j        j        r5|j        j        |k    r%t          d           |                                 n||j        _        |s|j        j        r4||j        j        k    r$t          d           |                                 
fd	
|rA 
||           |                    d
d
t          j        |j                  |j                   | j        r.| j                            | j                  j        |j        _        |S )NrC   )	templates)r   r]  r>  rm  r   -Base type does not match previous declarationz5Template parameters do not match previous declarationc                     |D ]Y}|t           j        u r|j        t          d           ) | |j                   | j        j                            |           Zd S )Nz#Cannot inherit from incomplete type)r   rf  ri   r   base_classesrF    declare_inherited_cpp_attributes)r_   r{  
base_classdeclare_inherited_attributesrG   s      r   r~  z=Scope.declare_cpp_class.<locals>.declare_inherited_attributes  s    * R R
!666#+#DEEEE00
8OPPPJ$EEjQQQQR Rr!   this)rE   r   rF   rG   )r   r  r   ra  listrn  r   CppClassTyper_  r   r   r   rF   r~   r   rX   ri   r   r   r{  rx  r   CPtrTyperG   rb  r   rc  rE   rh  )r5   rE   ri   rG   r   r{  r   rx  r_   rF   r~  s      `      @r   declare_cpp_classzScope.declare_cpp_class  s    = >J)$;$;F$6==L))  && 	2*eULiI I ID%%dD#u'E4E & G GE##E****M 	4ej&= 	4c-4555++---t 45:+ 4QTXXZ[\\\\ 4',EJ$%,,U333 ;:* ;uz/F,/V/V#NOOO//1111.:EJ+ 2EJ0 2
 444#VWWW//111	R 	R 	R 	R 	R 	R  	n((===6j>QRWR\>]>]chclmmm" 	K#'#3#:#:49#E#E#JEJ r!   c                     ||j         j        k    r.t          |d|j        dd|j         j                 d           d S d S )N'z' previously declared using ')cdefctypedef)rF   rt  r   rE   )r5   r_   rt  rG   s       r   rr  z!Scope.check_previous_typedef_flag  sa    5:222##


01HIIIK L L L L L 32r!   c                 b    |j         |k    r#t          |d|j        d|j         d           d S d S )Nr  ' previously declared as ')r   r   rE   )r5   r_   r   rG   s       r   rs  zScope.check_previous_visibility  sQ    z))##


E,,,. / / / / / *)r!   c
                 Z   |r|s8| j         s|dk    s|dk    s|r|}n |                     t          j        |          }| j        r%| j                            | j                  j        }
nd }
|rt          j
        |||
|	          }n&t          j        ||||
|	          }nt          j        }|                     ||||||          }|r:t          j                            dd          |_        |                     |           ||_        g |_        | j                            |           |S )NrW  r=  )r   )r   r   r   EnumClassDeclr}   )r   r  r   ra  rb  r   rc  rE   rF   r   CppScopedEnumType	CEnumTypec_anon_enum_typer_  r   r   r   r   use_entry_utility_coderO  enum_valuesr   r   )r5   rE   rG   r   scopedrt  r   r   rO  r   rh  rF   r_   s                r   declare_enumzScope.declare_enum  sY    	/ B$ B
h(>(>%11S1 EE KK(:DAAE& ! ,33DI>>C		 	 [!3D%PSTTT!+D%yVYZZZ.D!!$c5#3 " 0 0 	/!%!1!=!=oO_!`!`E''...-&&&r!   c                 8    | j                             ||          S r2   )r   declare_tuple_type)r5   rG   
componentss      r   r  zScope.declare_tuple_type8  s    223
CCCr!   c
                    |s+|dk    s|r|}n |                      t          j        |          }|                     |||||          }
d|
_        |j        r=|dk    r7| j        d         r|
                                 n|                    |           |r|dk    rd|
_	        d|
_
        |rd|
_        d|
_
        |	r|	|
_        |
S )NrC   r   r=  
cpp_locals)r  r   
var_prefixrS  r   r~   
directivesr   check_nullary_constructorr   r   r   r   r5   rE   rF   rG   r   r   r   in_pxdis_cdefr   r_   s              r   r   zScope.declare_var;  s      	=Y&&#&F$5t<<T5$Z@@ 	4x!7!7|, 4''))))..s333 	jH,,#$E EJ 	EIEJ 	:'9E$r!   c                 F    |sd S |D ]}||vrt          |d|z             d S )Nz"Modifier '%s' is not allowed here.)r   )r5   rG   	modifiersallowedmodifiers        r   _reject_pytyping_modifiersz Scope._reject_pytyping_modifiersU  sN     	F! 	L 	LHw&&c?(JKKK	L 	Lr!   c                 0    |                      |||          S r2   r   r5   rE   rF   rG   s       r   $declare_assignment_expression_targetz*Scope.declare_assignment_expression_target\  s     dC000r!   c                 b    |                      |          }| j                            ||          S r2   )r$  r   declare_builtinr5   rE   rG   s      r   r  zScope.declare_builtina  s.    --d33//c:::r!   c                     |r4|j         j        s(t          |d|z             t          |j        d           |                     |t
          ||          }t          |_        | j        	                    |           |S )Nz'%s' already declaredrW   r   )
rF   r   r   rG   r   r   r   	signaturer   r   )r5   rE   rG   r   r_   s        r   _declare_pyfunctionzScope._declare_pyfunctione  s~     	=0 	=#.5666%);<<<  ~sz RR.""5)))r!   c                    |                      |          }|s|                     ||||          S |rA|j        j        rt          |_        nF|j        t          ur|                     ||||          S n|                     |t          ||           |                     d t          ||d          }t          |          |_        |                     |          |_	        t          |_        d|_        |S )N)r   r_   r  rC   r   r   T)rn  r  rF   is_unspecifiedr   r   r
   rE   r   r   r   r  r   )r5   rE   rG   allow_redefiner   r_   s         r   declare_pyfunctionzScope.declare_pyfunctionn  s     && 	[++D#*TY+ZZZ 	Oz( _+

>11//cjX]/^^^ 2 T>3:NNN  ~s'+	 ! C C"4((
#0066.!r!   c                 p   |                      t          j        dz   |          }|                      t          j        dz   |          }|                     |          }|                     d |t
          |d          }t          |          |_        ||_        ||_	        ||_
        t          |_        d|_        |S )Nfuncdef_methdef_rC   T)r  r   lambda_func_prefixr   rS  r   r
   rE   r   pymethdef_cnamer   r   r  r   )r5   lambda_namerG   r   r  r   r_   s          r   declare_lambda_functionzScope.declare_lambda_function  s    [[!:Z!GUU
++f&?*&LkZZ**;77T:~sINN";//
- /%.!r!   c                 :    | j                             |           d S r2   )r   r   r5   def_nodes     r   add_lambda_defzScope.add_lambda_def  s    )))))r!   c                 :    | j                             |           d S r2   )r   r   r5   r_   s     r   register_pyfunctionzScope.register_pyfunction  s    ""5)))))r!   c           
      "   |s+|dk    s|r|}n |                      t          j        |          }d|	v o|o|}|rd}|                     |          }|r |s(||j        k    r|dk    rd}|j        }||_        ||_        |dk    r+||j        k    r t          |d|d|j        d|d	d
           ||j        k    rt          |d|d|rdndd	d
           |j	        
                    |          r&|j	                            |j                  |_	        nf|dk    r|j        dk    r| j        }|                                 rd}n1|r/|s-|                                D ]}|j        r||j        k    r nd}|rI|                     ||||||	          }|                                |_        |j        |j        |_        |}nt          |dd
           ||_	        n|sg|j        r`|                    |j	                  rF|j	        j        r2|j	        j        &|j        rt/          |j        d|j         d|            ||_	        n9t5          |d           n(|                     ||||||	          }||_        ||_        |rd|_        |r|dk    rd
|_        |rd
|_        |s|s|dk    rt5          |d|z             |rd|_        |	r|	|_        |
r|j        rJ d|d|d            |
|_        |rQtA          ||tB                    }| "                    |          |_#        d
|_$        d
|_%        |j&        |_&        ||_'        ||_(        |j)        rC|j        <|j        r5|d         j*        s(|r&|s$|s"tW          j,        || ||j-        j.                   |S )NrC   inlineFr=  Tz
Function 'r  z', now as 'r  r   cpdefr  6Function signature does not match previous declarationz!No exception value declared for 'z' in pxd file.
Users cimporting this function and calling it without the gil will always require an exception check.
Suggest adding an explicit exception value.3Non-extern C function '%s' declared but not definedz+duplicate utility code definition in entry z ()r   )function_namevoid_return)/r  r   func_prefixrn  r   r   r   r   r   rF   same_aswith_with_gilwith_gilis_builtin_scoper@  r\   add_cfunctionrI   re   r   rA  nogilexception_valuer	   rG   rE   r   r   r   r   r   r   rA   r   r   r   r   r   ri   r   r_   exception_checkin_utility_coder   write_noexcept_performance_hintreturn_typeis_void)r5   rE   rF   rG   r   r   r   r  r]  r  r   overridableinline_in_pxdr_   can_overriderG  temp	var_entrys                     r   declare_cfunctionzScope.declare_cfunction  s     	>Y&&#&F$6== I-E&EX 	F  && ;	/ )jE,<<<xAWAW  "-
##( Y&&:9I+I+IDD%***JJJ89:< < <e222DD[<''f<<>?@B B Bz!!$'' )Y"Z55dmDD

))e.>(.J.J#'#8L{{}} 	0'+ 0| 0 */)?)?)A)A 0 0I#,? &ey6N6N % 7O ,0L# *#11$c5*V_``7<7M7M7O7O4 ,8/4/@D, $%]_`aaa%)

 YE$8 YT=[=[\a\f=g=g Y z' "EJ,F,NSWSg,N(!IJ
 J J J !" " " "&EJJ#WXXXX&&tT3z9UUE$E#.E  	,'+E$ 	%jH,,#$E  	EI 	U 	U:+A+A#LtSTTT 	(#'E  	-#,E  	.)ooocgcgcgininin+oooo!-E 	*dE>::I'+'8'8'>'>I$$%I!$%I!#kIO )E
  	UT%9%Adj%AF* &B  &B "( &B 1> &B 6T4;K;SU U U Ur!   c           	          t          d |D                       sJ t          j        |t          j        d| j        d           gfi |}	|                     ||	|d |||          }
d|
_        |||
_        |
S )Nc              3      K   | ]}|d v V  	dS ))r  r  r  r  is_const_methodis_static_methodNr?   )r`   ks     r   	<genexpr>z(Scope.declare_cgetter.<locals>.<genexpr>  s<       
 
 ss
 
 
 
 
 
r!   r5   )r   r   r  r]  T)allr   	CFuncTypeCFuncTypeArgparent_typer  r   r   )r5   rE   r  rG   r   r   r  r]  cfunc_type_config
cfunc_typer_   s              r   declare_cgetterzScope.declare_cgetter  s     
 
&
 
 
 
 
 	
 	
 	
  )$VT-=tDDE! !  ! !
 &&*c*PYdl ' n n$Er!   c                 `   |                      |||||          }d|_        |r||_        |s|j        r| j                            |           n`t          | j                  }	t          | j                  D ]}
|
j        s|
j	        j        s n|	dz  }	| j        
                    |	|           |S rx   )rS  r   r   rf   r   r   ry   reversedr   rF   insert)r5   rE   rF   rG   r   r   r  	inheritedr_   icfunc_entrys              r   r  zScope.add_cfunction  s    T5$Z@@ 	-#,E  
	0 
	0%%e,,,, D&''A'(:;;  + ;3C3L EQ%%a///r!   c                 ^    |                      |          }|r|S t          |d|z             d S )Nz'%s' is not declared)rc  r   r5   rE   rG   r_   s       r   findz
Scope.find%  s<    D!! 	6L#-455555r!   c                     | }|D ]T}|                     ||          }|s d S |j        r|j        },t          |dd                    |          z              d S |S )Nz'%s' is not a cimported moduler   )r  r   r   join)r5   pathrG   ri   rE   r_   s         r   find_imported_modulezScope.find_imported_module-  sy      	 	DJJtS))E tt c;chhtnnLMMMttr!   c                 6   |                      |          }|                     |          p"| j        o| j                            |          pd }|r|S | j        r| j                            |          pd }|r"|j        r|                     |j        |           |S r2   )r$  rn  r   rc  r   _emit_class_private_warningrG   )r5   rE   r   r_   s       r   rc  zScope.lookup<  s     55d;;!!$'' $N)9)@)@)N)N 	  	L !Cd&6&=&=d&C&CL 	>U& 	>,,UY===r!   c                     | j                             |                     |          d           }|r|S | j                             |d           S r2   )r   rR   r$  r5   rE   r_   s      r   rn  zScope.lookup_hereN  sP       !?!?!E!EtLL 	L |d+++r!   c                 8    | j                             |d           S r2   )r   rR   r   s     r   lookup_here_unmangledzScope.lookup_here_unmangledY  s    |d+++r!   c                 ,    |                      |          S r2   )rn  r   s     r   #lookup_assignment_expression_targetz)Scope.lookup_assignment_expression_target\  s     %%%r!   c                     |                      |          }|s9|                     |          }|r"|j        r|                     |j        |           |s|                     |t          d           }|S r2   )rn  r  r   r  rG   r   r   r  s      r   lookup_targetzScope.lookup_targeta  s       && 	B..t44E B* B00DAAA 	A$$T>4@@Er!   c                     |r@|j         r;|j        j        r&| j        r|j                            | j                  S |j        S d S d S r2   )r   rF   rf   fused_to_specific
specializer  s     r   $_type_or_specialized_type_from_entryz*Scope._type_or_specialized_type_from_entrym  sa     	U] 	z" Et'= Ez,,T-CDDD:	 	 	 	r!   c                     |                      |          }|                     |          }|r|S |r|j        rddlm}  ||j                  }|                     |          S )Nr   ) get_known_standard_library_entry)rc  r  r   Builtinr  )r5   rE   r_   tpr  s        r   lookup_typezScope.lookup_types  s    D!! 66u== 	I 	ZU8 	ZAAAAAA44U5XYYE88???r!   c                    |d         j         j        rk|d         j         }|j                            d|z            }|?d |dd          D             }t	          j        ||                                          }||S |                     d|z            }g }||                                }g }	t          |          dk    rgt          d          D ]W}
||
         j         j        rC||
         j         }|j                            d|z            }||	|                                z  }	X|	s|sd S t          t          |	|z                       }t	          j        d |D             |          S )Nr   z
operator%sc                     g | ]	}|j         
S r?   rF   r`   args     r   rb   z)Scope.lookup_operator.<locals>.<listcomp>  s    >>>#SX>>>r!   r   r   c                     g | ]	}|j         
S r?   r  r  s     r   rb   z)Scope.lookup_operator.<locals>.<listcomp>  s    %C%C%C3ch%C%C%Cr!   )rF   r~   ri   rc  r   rh   r\   ry   ranger  r   )r5   r4  operandsobj_typemethodrj   resfunctionfunction_alternativesmethod_alternativesnr\   s               r   lookup_operatorzScope.lookup_operator  s   A;( 	{'H^**<(+BCCF!>>!"">>>	 +Iv7N7N7P7PQQ?J;;|h677 "$,$=$=$?$?! !x==A1XX I IA;#0 I'{/H%^22<(3JKKF)+v/F/F/H/HH+# 	.C 	4  $7:O$O P PQQ$%C%C(%C%C%C%57 7 	7r!   c                 x    ddl m}  G d d|          fd|D             }|                     ||          S )Nr   )Nodec                       e Zd ZdS )4Scope.lookup_operator_for_types.<locals>.FakeOperandN)r;   r<   r=   r?   r!   r   FakeOperandr    s        Dr!   r  c                 *    g | ]} |           S )r  r?   )r`   rF   r  rG   s     r   rb   z3Scope.lookup_operator_for_types.<locals>.<listcomp>  s(    BBBDKK$///BBBr!   )Nodesr  r  )r5   rG   r4  typesr  r  r  s    `    @r   lookup_operator_for_typeszScope.lookup_operator_for_types  sr    	 	 	 	 	$ 	 	 	BBBBBEBBB##Hh777r!   c                 .    t          |d|z  d           d S )NzGlobal name %s matched from within class scope in contradiction to to Python 'class private name' rules. This may change in a future release.r   )r   )r5   rG   rE   s      r   r  z!Scope._emit_class_private_warning  s7     CEIJKL	N 	N 	N 	N 	Nr!   c                 T    |                                                      |           d S r2   )r&  use_utility_coder5   new_codes     r   r$  zScope.use_utility_code  s(    ,,X66666r!   c                 T    |                                                      |           d S r2   )r&  r  r  s     r   r  zScope.use_entry_utility_code  s(    22599999r!   c                 (    |D ]}|| j         v r dS dS Nr   r   )r   r5   r  rE   s      r   defines_anyzScope.defines_any  s/     	 	Dt|##qq $qr!   c                 L    |D ] }|| j         v r| j         |         j        r dS !dS r)  )r   r   r*  s      r   defines_any_specialzScope.defines_any_special  s:     	 	Dt|##T(:(E#qqqr!   c                 L    ddl m}  |                                |            d S )Nr   )get_type_inferer)TypeInferencer/  infer_types)r5   r/  s     r   r1  zScope.infer_types  s7    333333&&t,,,,,r!   c                 @    | j         }|dS |                                S r   )r   r@  )r5   outers     r   r@  zScope.is_cpp  s"     =5<<>>!r!   c                 >    | j                             |||           d S r2   )r   add_include_file)r5   filenameverbatim_includelates       r   r5  zScope.add_include_file  s$    ))(4DdKKKKKr!   c                 $    t           j         d| S )N->)r   modulestateglobal_cname)r5   r   s     r   name_in_module_statezScope.name_in_module_state  s     0;;E;;;r!   c                    |t                      }| j         }| j                                        D ]}|s|j        s|j        dk    s|j        st          j        |j	                  }t          fd|D                       r dS t          |j	        dd           }|||v rr|                    |           |                    |          r dS dS )NrW  c              3   .   K   | ]} |          V  d S r2   r?   )r`   sub_tptype_check_predicates     r   r  z3Scope.find_shared_usages_of_type.<locals>.<genexpr>  s/      MMF''//MMMMMMr!   Tri   F)r   is_module_scoper   valuesr   r   r   r   get_all_subtypesrF   anyr   addfind_shared_usages_of_type)r5   r@  _seen_scopesinclude_all_entriesr_   entry_subtypes
type_scopes    `     r   rF  z Scope.find_shared_usages_of_type  s	   55L"&"66\((** 	 	E' 5+? 5CSW_C_C_chclC_'8DDNMMMMnMMMMM tt Wd;;J!Z<%?%?Z(((445I<XX ttur!   )TNr2   F)r   r   r   )NrC   r   r   )NrC   r   r   r   r   )NrC   r   )NrC   r   F)Nr?   r=  N)rC   r   r   NNrC   FFFN)r?   )r=  N)Fr=  NrC   r   r   r   r?   NF)NNrC   r?   Fr   )Ur;   r<   r=   r  is_py_class_scopeis_c_class_scopeis_closure_scopeis_local_scopeis_generator_expression_scopeis_comprehension_scopeis_passthroughrb  is_property_scoperA  is_c_dataclass_scopeis_internalr   r   r  r  r  r   r8  node_positions_to_offsetr6   r  r  r  r   r  r"  r$  r*  r   r,  r&  r0  r6  r   r:  rH  rS  r   r[  r_  ri  rv  r  rr  rs  r  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  rc  rn  r  r  r  r  r  r  r!  r  r$  r  r+  r-  r1  r@  r5  r<  rF  r?   r!   r   r   r   \  s       H N$%!NO KLKEK!"P "P "PH  / / / /0J J J! ! !? ? ? ?# # #  
         + + X+/ / /0 0 0W W W
  4 4 4  4< < < <~" " " "HD D D
 
 
 
 GH#$   ( =A67   0 <@>?).# # # #L /1/34 4 4 4lL L L
/ / / @D   >D D D ,5OS   4L L L L1 1 1
; ; ;      (  * * ** * * KLSXh h h hT BFEJ   "   &6 6 6    $	, 	, 	,, , ,& & &

 
 
  @ @ @ 7 7 7B8 8 8N N N
7 7 7: : :    - - -" " "L L L L< < <
     r!   r   c                   (    e Zd Zej        Zd Zd ZdS )PreImportScopec                 T    t                               | t          j        d d            d S r2   )r   r6   r   
pre_importr9   s    r   r6   zPreImportScope.__init__  s#    tW/t<<<<<r!   c                 ^    |                      ||t          |d          }d|_        d|_        |S )NrC   T)rS  r   r   r   r  s       r   r  zPreImportScope.declare_builtin  s0    T4iHH  r!   N)r;   r<   r=   r   preimport_cnamenamespace_cnamer6   r  r?   r!   r   rZ  rZ    s:        ,O= = =    r!   rZ  c                   R    e Zd ZdZd ZddZd ZddZdej	        fdZ
d Zdd
ZdS )BuiltinScopeTc                     t           j        t                              | dd d            n)t                              | dt	                      d            i | _        d S )N__builtin__)r   r\  r   r6   rZ  
type_namesr9   s    r   r6   zBuiltinScope.__init__  sO    %NN4d;;;;NN40@0@$GGGr!   Nc                 r    |dk    s|dk    rd}n|dk    r|dk    rd}t                               | |          S )Nunicode
basestringstrlongr   int)r   rc  )r5   rE   language_levels      r   rc  zBuiltinScope.lookup  sJ    9 4 4DDV^^! 3 3D||D$'''r!   c                     |t           j        vrY| j        | j                            ||          S t          j        rt          |d|z             d S t          |d|z  d           d S d S )Nundeclared name not builtin: %sr   )r   KNOWN_PYTHON_BUILTINSr   r  r   error_on_unknown_namesr   r   r  s      r   r  zBuiltinScope.declare_builtin  s    t111+'77cBBB1 N#@4GHHHHHC!BT!I1MMMMM 21r!   c                 P   t          |          }|                     ||d |d|          }|||_        |rp|dk    r|}nt          |          }t          ||t                    }|                     |          |_        d|_        d|_        ||_	        |j
        |_
        ||_        |S )Nr=  )r   r   *r   )r
   r  re   rA   r   r   r   r   r   r   ri   r   )	r5   rE   rF   r   python_equivr   re   r_   r  s	            r   declare_builtin_cfunctionz&BuiltinScope.declare_builtin_cfunction  s     T""&&tT48bn&oo" +E 	*s""#,\::lL.III'+'8'8'>'>I$$%I!#$I %1I"#kIO )Er!   c                    t          |          } ||||          }t          |d d|          }i |_        |                    |           d| j        |<   |                     ||d d          }t          |j        |                     d          j	        |j
        |j	        j                  }|                     |          |_        d|_        d|_        d|_        d|_        | |_        t&          j        rd|_        ||_        |S )Nr=  )r   r   r  r   r  rF   rE   rF   rG   r   T)r
   CClassScoper  	set_scoperd  r_  rA   rE   rc  rF   rG   typeptr_cnamer   r   r   r   r   r   ri   r   cache_builtinsr   r   )	r5   rE   r   objstruct_cname
type_classrF   ri   r_   r  s	            r   declare_builtin_typez!BuiltinScope.declare_builtin_type-  s   T""z$77DdxUYZZZu !!!$dx!HHV$$)	**	
 
 
	 $(#4#4T#:#:	  !	 	 !	 		! 	&!%I%r!   c                     | S r2   r?   r9   s    r   r0  zBuiltinScope.builtin_scopeI  r  r!   Fc                     d S r2   r?   )r5   rE   r   rF   rG   r   rD  s          r   rH  z)BuiltinScope.handle_already_declared_nameL  s    tr!   r2   )NNNrK  )r;   r<   r=   r  r6   rc  r  rs  r   BuiltinObjectTyper|  r0  rH  r?   r!   r   ra  ra    s           ( ( ( (N N N   , .2j>Z   8       r!   ra  c                      e Zd ZdZdZdZdZdZg dZd'dZ	d Z
ed             Zd Zd(d
Zd Zd Zd Zd)dZd'dZd Zd*dZd Zd Zd Zd Z	 	 d+dZ	 	 d,dZd Zd Zd Z	 	 	 	 	 d-dZd Z d  Z!d! Z"d" Z#d# Z$d$ Z%d% Z&d& Z'd	S ).ModuleScoper   r   F)	__builtins__r;   __file__r   __path____spec__
__loader____package__
__cached__c                    ddl m} || _        |j        }t                              | |||           || _        || _        t          | j                  | _        || _	        t          j        | _        t          j        | _        t          j        | _        d| _        t          j        | _        g | _        i | _        i | _        t-          |j                  | _        d| _        g | _        t5                      | _        g | _        d| _        g | _        g | _        | j        | _         i | _!        i | _"        | #                    tI          j%        dd                     d S )Nr   r  rB   r   zPython.hT)initial)&rB   r  parent_moduler0  r   r6   
is_packagemodule_namer
   _contextr   module_cnamemoddict_cnamemodule_dict_cnamemethtable_cnamemethod_table_cnamer   moddoc_cnamer   utility_code_listmodule_entries
c_includesdictrd  pxd_file_loadedcimported_modulesr   types_importedincluded_fileshas_extern_classcached_builtinsundeclared_cached_builtinsr_  _cached_tuple_types _cached_defaults_c_class_entriesprocess_includer   IncludeCode)r5   rE   r  r,  r  r  r   s          r   r6   zModuleScope.__init__u  sA   *+tT;>>>$()9::"/!'!5"("8,!# {566 !#!ee  !!*,'#0#% 02-T-j$GGGHHHHHr!   c                     | j         S r2   )r  r9   s    r   r   zModuleScope.qualifying_scope  s    !!r!   c                     | j         S r2   )r  r9   s    r   r,  zModuleScope.context  s
    }r!   c                     | S r2   r?   r9   s    r   r&  zModuleScope.global_scope  r  r!   Nc                     |                      |          }||S || j        | j        j        nd}| j                            ||          S )N   )rk  )rn  r,  rk  r   rc  )r5   rE   rk  r_   s       r   rc  zModuleScope.lookup  sY      &&L!<@L<TT\88Z[N&&tN&KKKr!   c                    t          |          }	 | j        |         }n.# t          $ r! t          j        |          x}| j        |<   Y nw xY w|j        }|                     |          }|st          |          }t          |          D ] \  }}|	                    d|z  ||           !| 
                    |dz   d|d||          }	| j                            |	           |	|_        |                     ||||          }||_        |S )Nzf%s)rE   rF   rG   _structstructT)rt  rG   r   )tupler  r'  r   c_tuple_typer   rn  StructOrUnionScope	enumerater   rv  r   removestruct_entryr_  r_   )
r5   rG   r  ttyper   r_   ri   ix	componentr  s
             r   r  zModuleScope.declare_tuple_type  sI   :&&
	_,Z8EE 	_ 	_ 	_;E;RS];^;^^ED,Z888	_  '' 	@&u--E!*:!6!6 L LI!!urz	s!KKKK77	!8U3V[ 8 ] ]L$$\222!-E%%eUC??Es    (A
	A
c                 l   t          |          }	 | j        |         S # t          $ r Y nw xY w|                     t          j                  }t          |          }|                     ||dd|          x}| j        |<   |                     |           d|j	        _
        |j	        j        }d|_        d|_        t          t          t          |                              }d|z  j        }t#          |          D ]6\  }}	t           ||                    }
|                    |
|	d d           7|S )NT)r]  implementingrz  zarg{:0>%dd})rG   r  )r  r  r'  r*  r   defaults_struct_prefixr
   declare_c_classcheck_c_classrF   is_final_typeri   rW  is_defaults_class_scopery   rh  formatr  r   )r5   rG   r  r   r_   ri   	num_zerosbuild_argnamer  type_arg_names              r   declare_defaults_c_classz$ModuleScope.declare_defaults_c_class  s[   :&&
	8DD 	 	 	D	 V:;;e$$DHDXDX3D! EY E# E# 	#5jA 	5!!!#'
 
  (,% C
OO,,--	&2:!*-- 	G 	GHAu$]]1%5%566Hh4FFFFs    
++c                    |t           j        vr|t           j        vr|t           j        vr| j        r|                     |t          |          }|S t          j        rt          |d|z             nt          |d|z  d           |                     |d t          |d          }d|_        |S t          j        r| j        D ]}|j        |k    r|c S |dk    r!| j        s| j                            d          S |                     d d t          |d          }t          j        rl|t           j        vr^d|_        d|_        ||_        t(          j        |z   |_        | j                            |           | j                            |           nd|_        ||_        |                                                     |          |_        |S )Nrm  r   rC   r   globals__Pyx_Globals)r   rn  renamed_py2_builtins_mapuncachable_builtinshas_import_starr   r   r   ro  r   r   rS  r   ry  r  rE   old_style_globalsr   rc  r   r   builtin_prefixr   r   r  r0  r   r   r  s       r   r  zModuleScope.declare_builtin  s   t111t<<<t777# ((~sCC1 N#@4GHHHHC!BT!I1MMMT4iPP#$ ! 	!- ! !:%% LLL &9T%;#**?;;;LLt^S)LLE! 		d$2J&J&J EENEJ /$6EK ''...+2259999 EEJ#1133@@FFr!   rJ  c                    |d uo|dk    }d }d}|0|dk    r*| }| j         rdnd}||k    r|r|j        }|dz  }||k    r|n|dk    r	| j        }d}|                                 }|j                            |||||          S )Nr   Fr   T)from_modulerG   absolute_fallbackrelative_import)r  r  r&  r,  find_module)	r5   r  rG   relative_levelis_relative_importr  r  	top_levelmodule_scopes	            r   r  zModuleScope.find_module  s    
 ,47NNQ<N!%.1*<*< K!_3!I
 !9,,,)7!# !9,,, q  ,K $((**#//[cM^  qC 0 D D 	Dr!   c                     d|v r|                     dd          \  }}nd }|                     |          }|s&t          || | j        |rdn|          }|| j        |<   |r|                    ||          }|S )Nr   r   T)r  r,  r  )
as_package)splitlookup_submoduler  r,  r  find_submodule)r5   rE   r  	submoduleri   s        r   r  zModuleScope.find_submodule  s     $;;"jja00OD))I%%d++ 	.D$,cl[|[_[_r|}}}E(-D% 	K((z(JJEr!   c                     d|v r|                     dd          \  }}nd }| j                            |d           }|r||                    |          }|S )Nr   r   )r  r  rR   r  )r5   rE   r  modules       r   r  zModuleScope.lookup_submodule(  sf    $;;"jja00OD))I$((t44 	8+,,Y77Fr!   c                 ^    t          j        |||          }|                     |           dS )z
        Add `filename` as include file. Add `verbatim_include` as
        verbatim text in the C file.
        Both `filename` and `verbatim_include` can be `None` or empty.
        )r8  N)r   r  r  )r5   r6  r7  r8  incs        r   r5  zModuleScope.add_include_file3  s6     x)9EEES!!!!!r!   c                     |                                 }||                                }|                    | j        |           | j        |         }dS )a  
        Add `inc`, which is an instance of `IncludeCode`, to this
        `ModuleScope`. This either adds a new element to the
        `c_includes` dict or it updates an existing entry.

        In detail: the values of the dict `self.c_includes` are
        instances of `IncludeCode` containing the code to be put in the
        generated C file. The keys of the dict are needed to ensure
        uniqueness in two ways: if an include file is specified in
        multiple "cdef extern" blocks, only one `#include` statement is
        generated. Second, the same include might occur multiple times
        if we find it through multiple "cimport" paths. So we use the
        generated code (of the form `#include "header.h"`) as dict key.

        If verbatim code does not belong to any include file (i.e. it
        was put in a `cdef extern from *` block), then we use a unique
        dict key: namely, the `sortkey()`.

        One `IncludeCode` object can contain multiple pieces of C code:
        one optional "main piece" for the include file and several other
        pieces for the verbatim code. The `IncludeCode.dict_update`
        method merges the pieces of two different `IncludeCode` objects
        if needed.
        N)	mainpiecesortkeydict_updater  )r5   r  r2  s      r   r  zModuleScope.process_include<  sI    2 mmoo;++--C---oc"r!   c                     || j         vrj|j                                        D ]}|                     |           | j                             |           |j         D ]}|                     |           d S d S r2   )r  r  rB  r  r   add_imported_module)r5   ri   r  ms       r   r  zModuleScope.add_imported_module[  s    ...'..00 * *$$S))))"))%000, , ,((++++ /., ,r!   c                 t    |j         rd|_        || j        vr|| j        |<   d S t          |d|z  d           d S )NTrl  r   )r   r   r   r   )r5   rE   r_   rG   s       r   add_imported_entryzModuleScope.add_imported_entryc  sR     	% $E$$!&DLC,t3Q77777r!   c                     |                      |          }|r#|j        r|j        |u r|S |j        r|j        r|S n#|                     |t          |          }d|_        ||_        |                     |           |S )Nr   )rn  r   r   r   r   r   r  )r5   rE   ri   rG   r_   s        r   declare_modulezModuleScope.declare_modulel  s    
   && 	"  U_%=%=% eo   $$T>3??E !E  '''r!   rC   c
                    |dvrt          |d|z             |                     ||	d           |s-|t          u rt          }|j        r|j        rt          d          |rE|dk    r?| j        d         dk    r.d}
d}|j        rd	}
d
}t          |d| d|
z   d|
rdndz              |s4| }|dk    s|dk    r|r|}n | 	                    t          j        |          }|                     |          }|r|j        r|j                            |          s,|dk    r&|j        dk    rt          |d|z  d           ||_        |j        dk    r4| 	                    t          j        |          }|j        |k    r	|}||_        |j        s	d|_        |S t&                              | |||||||||	
  
        }|r?d|_        |j        j        r|j        j        |_        | j                            |           nd|_        t6          j        rd|_        |S )N)rC   rW  r=  z+Module-level variable cannot be declared %s)ztyping.Optionalz7Non-cdef global variable is not a generic Python objectr=  subinterpreters_compatiblenorB   z9
Python objects should not be shared between interpreterszPython zGlobal cdef zvariable used with subinterpreter support enabled.
This variable is not currently in the per-interpreter module state but this will likely change in future releases.r   r   r   rW  z6Variable '%s' type does not match previous declarationrC   Tr   r   r   r  r  r   )r   r  r   r   is_pyobjectis_extension_typer   r  r   r  r   r  rn  r   rF   r  r   r   r   r   r   r   declaration_valuerH   r   r   r   r   cimport_from_pyxr   )r5   rE   rF   rG   r   r   r   r  r  r   extra_warningpyobject_warningr]  r_   mangled_cnames                  r   r   zModuleScope.declare_var  s    <<<#DzQRRR''-?AUVVV 	O'''%$ OT-C O#MO O O 	/
h..O$@ATIIM! - \#, B/ B B B  ,111-/ / /  	=!zHX%%**@*@X*@F$5t<<  && 	U) 	 :%%d++ &))e.>(.J.JC!Y\`!`bcddd!%EJ 9,, $F,=t D D;-// E"&EK' '+$!!$dC(-*&)&'^p " r r  	" Ez+ :"Z9
##E**** !E# 	EJr!   r?   c                    |sd|	v rt          |dd           |s1|dk    s|dk    r|r|}n |                     t          j        |          }|dk    r|j        rt          |d           |                     |          }|rM|j        rF|j        dk    r;|                     t          j        |          }|j	        |k    r|}||_	        ||_
        t                              | |||||||||	|
|          }|S )	Nr  z+Declarations should not be declared inline.r   r=  rW  z6Extern functions cannot have default arguments values.rC   )r   r   r   r  r]  r  r   r  )r   r  r   r  optional_arg_countr   rn  r   r   r   r   r   r  )r5   rE   rF   rG   r   r   r   r  r]  r  r   r  r_   r  s                 r   r  zModuleScope.declare_cfunction  s4     	KH	11CFJJJ 	>X%%**@*@X*@F$6==!!d&=!#OPPP  && 	-U) 	-9,, $F,> E E;-// E"'EK',E$''$cJC#	 ( % %
 r!   c                 p    |                      |          }|s|                     |t          |           d S d S r2   )rn  r   r   r  s       r   declare_globalzModuleScope.declare_global  sE      && 	8T>377777	8 	8r!   c                 B    || j                             |           d S d S r2   )r  r   r%  s     r   r$  zModuleScope.use_utility_code  s-    "))(33333  r!   c                     |d S |j         r| j                            |j                    |j        r!| j                            |j                   d S d S r2   )r   r  r   r   r  s     r   r  z"ModuleScope.use_entry_utility_code  si    =F 	>"))%*<===( 	I"))%*GHHHHH	I 	Ir!   c                    |r$|
dk    r|
dk    s|st          |dd           |}d}nd }|                     |          }|r|s~|j        }|j        r|j        sd }nf|j        }|r |r|j        r|                     |||           |r|j        s	|r"|j        r|r||j        urt          |d           |r|j        s||_        |r|rt          j        ||||
dk    |          }||_        ||_        |||_        |
dk    r||_        n| j        |_        |	r|	|_        n%|                     t&          j        |          |_        |                     ||||
d|          }d	|_        |r||_        nB|j        s&|                     t&          j        |          |_        nt          |j        d
           |                     |           | j                            |           |j        s|s|rt;          || |
|          }| j                                        |_        |r!|j        r|                     |j                   |!                    |           | j"                            |           nC|r |j        j        rt          |d|z             n!|r|j        j#        rt          |d|z             |rd|_$        |r||_        |
dk    r'|j%        |
k    rt          |d|d|j%        d           |rd|_&        |r)|j        r|j        |k    rt          |d           ||_        |r)|j'        r|j'        |k    rt          |d           ||_'        | j        (                    d          rd	|j        _)        | j        (                    d          }|r&ddl*m+} tY          | |          st          |d           |dk    rd	|j        _-        d	|_.        |S )Nr=  rW  z6ctypedef only valid for 'extern' , 'public', and 'api'r   r   ry  )
check_size)r   r]  rR  Tz5Object name required for 'public' or 'extern' C class)rE   r   r   r  zC class '%s' already definedz C class '%s' already implementedr   rC   zClass 'r  r  z4Object struct name differs from previous declarationz2Type object name differs from previous declarationfinalcollection_type)NonManglingModuleScopez2'collection_type' is not a public cython directivesequence)/r   rn  rF   r   r  ri   definedrr  rg  r   r   PyExtensionTyperG   buffer_defaultsobjtypedef_cnamer  r   rx  r  r   typeptr_prefixr_  r   rz  r   objstruct_prefixattach_var_entry_to_c_classr   r   rv  r  rC  declare_inherited_c_attributesrw  r   implementedr   r   r   typeobj_cnamerR   r  r   r  rr   has_sequence_flagr   )r5   rE   rG   r]  r  r  rg  rz  r	  rx  r   rt  r   r  r  rR  r  r_   rF   ri   r  r  s                         r   r  zModuleScope.declare_c_class  s     	$J(22(**c*UWXYYY.LL#   && 	/ 	/:DM 
/d&< 
/
 O O%- O44UL#NNN Tem T Tt~ T  TYdn%D%Dc#RSSS /T^ /%.DN  	/ 	/-lIzX/ER\^ ^ ^DDH#2D +(8%X%%#.  #'#6  N%2""%)[[1F%M%M"%%dD#Jv & / /E"EO M'6$$& M'+{{63JD'Q'Q$$eiKM M M,,U333 ''... z 	F 0< 0#4t) $& & & $(?#7#7#9#9  J J88IIIu%%%!((/// FDJ. Fc9D@AAAA F$*"8 Fc=DEEE  	%#$E  	EI""u'7:'E'E##44)))+ , , , 	EI 	3# S(<(O(OcQRRR#2D  	/! Ud&8M&I&I#STTT!.D?w'' 	,'+EJ$/--.?@@ 	Q;;;;;;d$:;; Q cOPPPj((+/EJ( 

 r!   c                 0   |j         }|j        r-|j        j        r!t          j        d|j        j        |_        n}|j        rv|j        j        rjt          |j        j                  }|j        }|r7|j        r|t          |j        j                  k    rn|j        rd S |j        }|7t          j        |_        |j        rV| 	                    t          j
        |j                  |_        | 	                    t          j        |j                  |_        d S d S rU  )rF   rg  vtabslot_cnamer   obj_base_cnameri   r   ry   is_builtin_typer  vtabstruct_prefixrE   vtabstruct_cnamevtabptr_prefixvtabptr_cname)r5   r_   rF   entry_countrg  s        r   allocate_vtable_namesz!ModuleScope.allocate_vtable_namest  s'    z> 	8dn; 	8 %%%t~'D'D#FDZ 	8DJ4 	8 dj677KI 0  +IO<Y8Z8Z*Z*Z, F%/	  0 #)"7D 	P$(KK0H%*$U$UD!!%V-BEJ!O!OD	P 	Pr!   c                 l    | j         D ]+}|j        j        st          |j        d|j        z             ,d S )N(C class '%s' is declared but not defined)r   rF   ri   r   rG   rE   r  s     r   check_c_classes_pxdzModuleScope.check_c_classes_pxd  sM     ) 	Z 	ZE:# Zei!Kej!XYYY	Z 	Zr!   c                    |j         }|j        }|j        }|j        st	          |j        d|z             |dk    r,|j        s%|                     t          j	        |          |_        |j        r:|j        j
        D ]-}|j        s$|j        st	          |j        d|j        z             .|j        r,|                     t          j        |j                  |_        d S d S )Nr  r=  z)C method '%s' is declared but not defined)rF   rE   r   ri   r   rG   r	  r  r   typeobj_prefixr   r   r   r  vtable_prefixvtable_cname)r5   r_   rF   rE   r   method_entrys         r   r  zModuleScope.check_c_class  s    zz%
z 	P%)G$NOOO!!$*<!!%V-BD!I!ID : 	+ $
 8 + +#0 +9P +,*,W$)-* + + +  	N $F,@%* M MD	N 	Nr!   c                    d}|rt          d| j        z              | j        D ]]}|rDt          d|j        d|           t          d|j                   t          d|j                   |                     |           ^d S )Nr   z&Scope.check_c_classes: checking scope z	...entry r  z......type = z......visibility = )rQ   r   r   rE   rF   r   r  )r5   debug_check_c_classesr_   s      r   check_c_classeszModuleScope.check_c_classes  s     !"  	R:T=PPQQQ) 	& 	&E$ ?%***ee<===o
333+U-=>>>u%%%%	& 	&r!   c                     | j                                         D ]M\  }}|j        rA|j        r:|j        | u r1|j        dk    r&|j        s|j        st          |j	        d|z             Nd S )Nr=  r  )
r   r  r   r   ri   r   r   r   r   rG   r  s      r   check_c_functionszModuleScope.check_c_functions  s      <--// 	c 	cKD%! c( c!K4//!,88 % 1 9 % 4 9 %)%Z]a%abbb	c 	cr!   c                     ddl m} t          |j        |j        |j        |j        j                  }|j        |_        d|_	        d|_
        d|_        d|_        |j        |_        ||_        d S )Nr   r  ru  T)rB   r  rA   rE   	type_typerG   rF   rx  r   r   r   r   r   ri   r   )r5   r_   r  r  s       r   r  z'ModuleScope.attach_var_entry_to_c_class  s     	$)J,. . .	 $)#7	  !	 	 !	(,	%+	%r!   c                     | j         S r2   )cppr9   s    r   r@  zModuleScope.is_cpp  s	    xr!   c                 L    ddl m}  |                                |            d S )Nr   )PyObjectTypeInferer)r0  r'  r1  )r5   r'  s     r   r1  zModuleScope.infer_types  s7    666666))$/////r!   rK  r2   )rJ  r   rL  rM  )r   r   NNNNNrC   r   r   NNr   )(r;   r<   r=   rA  r  is_cython_builtinr  namespace_cname_is_typer   r6   r   r   r,  r&  rc  r  r  r  r  r  r  r5  r  r  r  r  r   r  r  r$  r  r  r  r  r  r  r!  r  r@  r1  r?   r!   r   r  r  S  s       0 OO#  
I I I I<" " "   X  L L L L  (  6# # #JD D D D>   	 	 	" " " "# # #>, , ,8 8 8  4 ,5OSE E E EP KLSX   :8 8 8
4 4 4I I I CD>B?H.2)*	x x x xtP P P:Z Z Z N N N.& & &0
c 
c 
c& & &(  0 0 0 0 0r!   r  c                   X    e Zd ZdZdZdZddZd Zd Z	 	 ddZ	d	 Z
d
 Zd Zd Zd ZdS )rL  TFNc                 H    ||}t                               | |||           d S r2   r   r6   )r5   rE   r   r   s       r   r6   zLocalScope.__init__  s+    &LtT;=====r!   c                 &    t          ||z             S r2   )r.   r  s      r   r  zLocalScope.mangle  s    v}---r!   c                    |                      |          }|                     t          j        |          }|                     ||||d          }d|_        |j        rd|_        d|_        | j	        
                    |           |S )NrC   r   0)r$  r  r   r  rS  r   r  rH   r   r   r   )r5   rE   rF   rG   r   r_   s         r   declare_argzLocalScope.declare_arg	  s    --d33F-t44T5$Y?? 	EJ&&&r!   rC   c
                 :   |                      |          }|dv rt          |d|z             t                              | |||||||||	
  
        }
|
j        j        r|
j        j        |
_        d|
_        | j        |
_	        | j
                            |
           |
S )NrW  readonlyz$Local variable cannot be declared %sr  r   )r$  r   r   r   rF   r  rH   r   _in_with_gil_blockr   r   r   r  s              r   r   zLocalScope.declare_var  s     --d33///#=
JKKK!!$dC(-*&)&'^p " r r :' 	65EJ"&"9&&&r!   c                     |                      |          rt          |dd           d S |                                                     |          }|| j        |<   d S Nrl  r   rn  r   r&  r  r   r  s       r   r  zLocalScope.declare_global(  b    D!! 	'C,a00000%%''55d;;E!&DLr!   c                    |                      |          }|r9|j        | u r0|j        s)t          |d|z             |                                 d S |                     |          }||j        st          |d|z             d S d S Nz'%s' redeclared as nonlocalz"no binding for nonlocal '%s' found)rn  ri   r   r   rX   rc  r5   rE   rG   
orig_entryr_   s        r   declare_nonlocalzLocalScope.declare_nonlocal0  s    %%d++
 	H**d22:;R2#4t;<<<,,.....KK%%E}E$6}c?$FGGGGG }r!   c                 V    d|_         t          ||           }d|_        || j        |<   |S NT)r   r   r   r   )r5   rE   r_   inner_entrys       r   _create_inner_entry_for_closurez*LocalScope._create_inner_entry_for_closure;  s3     --"&(Tr!   c                    t                               | |          }|a|j        }|j        r|j        }|j        || urA|j        r:t          |j        d          rt          d          |                     ||          S |S )Nscope_classz#lookup() after scope class created.)	r   rc  ri   rS  r   rP  hasattrr   rA  )r5   rE   r_   entry_scopes       r   rc  zLocalScope.lookupB  s     T4((+K4 6)5 4 6$&&;+G&5;66 O'(MNNN ;;D%HHHr!   c                    |                                  D ]}|j                                        D ]}|j        rk|j        j        }| j        r||_        $|                    t          j	                  r$|t          t          j	                  dz   d          }|d||_        t|j        rY|j        |_        t          j	        d|j        |_        |j        j        r&|j        j        d         r|                                 Ռd S )Nr   r:  r  )r6  r   rB  r   r   r   rT  r   r   cur_scope_cnamery   r   original_cnamerF   r~   ri   r  r   )r5   outer_scope_cnameri   r_   r   s        r   mangle_closure_cnamesz LocalScope.mangle_closure_cnamesS  s#   ++-- 	2 	2E--// 2 2% 2!-3E* L&+ ++F,BCC J$)#f.D*E*Ea*G*H*H$IE2C2C2CUU&K% 2+0;E(.4.D.D.Dekk"REKz. 25;3I,3W 2//1112	2 	2r!   r2   rL  )r;   r<   r=   rQ  has_with_gil_blockr4  r6   r  r0  r   r  r=  rA  rc  rJ  r?   r!   r   rL  rL    s        N  > > > >
. . .   ,5OS   $' ' '	H 	H 	H    "2 2 2 2 2r!   rL  c                   N    e Zd ZdZdZd Zd Z	 	 ddZd	 Zdd
Z	d Z
d Zd ZdS )ComprehensionScopezScope for comprehensions (but not generator expressions, which use ClosureScope).
    As opposed to generators, these can be easily inlined in some cases, so all
    we really need is a scope that holds the loop variable(s).
    Tc                    |}|j         r|j        }|j         |                                                    t          j                  }t                              | |||           |j        | _        dt          j	        t          |          |fz  | _        |j         s|j        s|j        r|j        }|j         |j        |j        |j        | _        |j                            |            d S )Nz%s%d%s)rS  r   r&  r*  r   genexpr_id_refr   r6   r  r   ry   genexp_prefixrO  rN  r   r   r   rE  )r5   r   r   rE   s       r   r6   zComprehensionScope.__init__l  s    "1 	5'4L 1 	5((**2263HIItT;===%0%)<c$ii(NN 0 	2K4P 	2T_Tq 	2%1K 0 	2K4P 	2T_Tq 	2&2!!$'''''r!   c                 J    | j         | j                            ||          S r2   )rP  r   r  r  s      r   r  zComprehensionScope.mangle}  s)    ++T->-E-Efd-S-S-STTr!   NrC   Fc
                    |t           u r*| j                            |          }
|
r|
j        r|
j        }|                     ||	           | j        | j                            t          j
        |p|                                           }|                     |||||          }d|_        | j        j        rd|_        nd|_        d|_        | j                            |           || j        |<   |S r?  )r   r   rc  r   rF   r  rP  r   r  r   r  r*  rS  rA  r   r   r   r   r   r   )r5   rE   rF   rG   r   r   r   r  r  r   r   r_   s               r   r   zComprehensionScope.declare_var  s    ###*11$77K ({6 ("'''-?@@@ ,,d.?.F.FvGXZ^Zpbfbnbnbpbp.q.q.qrT5$Z@@ , 	"#E!EN &&&"Tr!   c                 :    | j                             |||          S r2   )r   r   r  s       r   r  z7ComprehensionScope.declare_assignment_expression_target  s     ,,T4===r!   c                 :    | j                             |||          S r2   )r   r  r5   rE   rG   r  s       r   r  z%ComprehensionScope.declare_pyfunction  s$    22#~' ' 	'r!   c                 8    | j                             ||          S r2   )r   r  )r5   r   rG   s      r   r  z*ComprehensionScope.declare_lambda_function  s    77
CHHHr!   c                 6    | j                             |          S r2   )r   r  r  s     r   r  z!ComprehensionScope.add_lambda_def  s    ..x888r!   c                 h    |                      |          }|s| j                            |          }|S r2   )rn  r   r  r  s      r   r  z6ComprehensionScope.lookup_assignment_expression_target  s9      && 	P%II$OOEr!   )NrC   FFTNrK  )r;   r<   r=   r   rS  r6   r  r   r  r  r  r  r  r?   r!   r   rM  rM  e  s          "( ( ("U U U ,5NR   .> > >' ' ' 'I I I9 9 9    r!   rM  c                   (    e Zd ZdZddZddZd ZdS )	ClosureScopeTNc                 j    t                               | |||           t          j        || _        d S r2   )rL  r6   r   closure_scope_prefixclosure_cname)r5   rE   
scope_namer   r   s        r   r6   zClosureScope.__init__  s7    D$\BBB'-'B'BJJOr!   Fc                 @    t                               | |||d          S )NrC   r  )rL  r  rU  s       r   r  zClosureScope.declare_pyfunction  s"    ,,T4nYb,cccr!   c                 0    |                      |||          S r2   r  r  s       r   r  z1ClosureScope.declare_assignment_expression_target  s    dC000r!   r2   rK  )r;   r<   r=   rP  r6   r  r  r?   r!   r   rZ  rZ    sY        P P P Pd d d d1 1 1 1 1r!   rZ  c                       e Zd ZdZd Zd ZdS )GeneratorExpressionScopeTc                 f    | j                             |||          }|                     ||          S r2   )r   r   rA  )r5   rE   rF   rG   r_   s        r   r  z=GeneratorExpressionScope.declare_assignment_expression_target  s2    !--dD#>>33D%@@@r!   c                     |                      |          }|s2| j                            |          }|r|                     ||          S |S r2   )rn  r   r  rA  r  s      r   r  z<GeneratorExpressionScope.lookup_assignment_expression_target  sX      && 	I%II$OOE I;;D%HHHr!   N)r;   r<   r=   rR  r  r  r?   r!   r   rb  rb    s;        $(!A A A    r!   rb  c                   0    e Zd Zd
dZ	 	 	 ddZ	 	 dd	ZdS )r  ?c                 B    t                               | |d d            d S )N)r   r   r,  r   s     r   r6   zStructOrUnionScope.__init__  s"    tTt$GGGGGr!   NrC   Fc                    |s|}|dk    rt          |          }|j        rt          j        |          }|                     ||	           |                     |||||          }d|_        | j                            |           |j	        r|
st          |d           n6|j        r|st          |d           n|j        r|st          |d|z             |S )NrC   r   z/C struct/union member cannot be a Python objectz-C struct/union member cannot be a memory viewz;C struct/union member cannot be reference-counted type '%s')r    r   r   r  r  rS  r   r   r   r  r   rP  needs_refcounting)r5   rE   rF   rG   r   r   r   r  r  r   allow_pyobjectallow_memoryviewallow_refcountedr_   s                 r   r   zStructOrUnionScope.declare_var  s   
  	1EY&&)%00 	-&t,,D''-?@@@T5$Z@@&&& 		a! NcLMMM$ 	a# LcJKKK# 	a# acX[__```r!   r   r?   c                 Z    |
rt          |d           |                     |||||          S )Nz0C struct/union member cannot be declared 'cpdef'r  )r   r   )r5   rE   rF   rG   r   r   r   r  r]  r  r  s              r   r  z$StructOrUnionScope.declare_cfunction  sI      	K#IJJJdC&+
   D D 	Dr!   )rf  )	NrC   FFFNFFF)NrC   r   r   r   r?   F)r;   r<   r=   r6   r   r  r?   r!   r   r  r    so        H H H H ,5OSSX   8 KL@ED D D D D Dr!   r  c                   (    e Zd ZddgZd Zd Zd ZdS )
ClassScoper<   r=   c                    |r)|                                                     d          r|S |rV|                    d          rA|                    d          s,t          d| j                            d          |          }|S )N__pyx_r   r'   )lowerr   endswithr
   
class_namelstripr   s     r   r$  z$ClassScope.mangle_class_private_name		  s     	DJJLL++H55 	K 	PDOOD)) 	P$--2E2E 	P =DO,B,B3,G,G,G!NOODr!   c                 \    t                               | |||           || _        d | _        d S r2   )r   r6   rt  r   r5   rE   r   s      r   r6   zClassScope.__init__	  s,    tT;<<<r!   c                    t                               | |          }|r|S |dk    rt          ddt          j        t
          t          j        dt
          d           gdd                    }t          j        	                    dd          |_
        |                     |           d|_        |                                 |_        |S )Nclassmethod__Pyx_Method_ClassMethodrB   r   ClassMethodzCythonFunction.cr   )r   rc  rA   r   r  r   r  r   r   r   r   r  r   r0  ri   r  s      r   rc  zClassScope.lookup	  s    T4(( 	L=  
 *$",RFFGAO OP PE -1,<,H,HXj,k,kE)''...!"E,,..EKr!   N)r;   r<   r=   r   r$  r6   rc  r?   r!   r   ro  ro    sN         +N;    
    r!   ro  c                   4    e Zd ZdZdZ	 	 d	dZd Zd Zd ZdS )
PyClassScoper   FNrC   c
                     |                      |          }|t          u rt          }t                              | |||||||||	
  
        }
d|
_        d|
_        |
S )Nr  r   )r$  r   r   r   r   r   r   r  s              r   r   zPyClassScope.declare_var4	  sr     --d33###!D!!$dC(-*&)&'^p " r r  !r!   c                    |                      |          }|r9|j        | u r0|j        s)t          |d|z             |                                 d S |                     |          }|t          |d|z             d S || j        |<   d S r:  )rn  ri   r   r   rX   rc  r   r;  s        r   r=  zPyClassScope.declare_nonlocalB	  s    %%d++
 
	+**d22:;R2#4t;<<<,,.....KK%%E}c?$FGGGGG &+T"""r!   c                     |                      |          rt          |dd           d S |                                                     |          }|| j        |<   d S r6  r7  r  s       r   r  zPyClassScope.declare_globalQ	  r8  r!   c                 6    | j                             |          S r2   )r   add_default_value)r5   rF   s     r   r  zPyClassScope.add_default_valueY	  s    11$777r!   rL  )	r;   r<   r=   rN  r)  r   r=  r  r  r?   r!   r   r}  r}  ,	  sk        
 # ,5OS   + + +' ' '8 8 8 8 8r!   r}  c                        e Zd ZdZdZdZdZdZdZdZ	dZ
dZd Zd Zd Zd Zd Z	 	 dd	Z	 	 ddZddZd Z	 	 ddZddZddZddZ	 	 	 ddZd Zd  fd	Z xZS )!rv  r   Fc                 j   t                               | ||           |dk    rJ|                    t          j        |          | _        |                    t          j        |          | _        g | _        g | _	        || _
        |j        s|j        r#|j        r| j
        j        | _        d| _        d S d S d S )Nr=  T)ro  r6   r  r   methtab_prefixr  gstab_prefixgetset_table_cnameproperty_entriesinherited_var_entriesr  r  r  rx  r_  r)  )r5   rE   r   r   r  s        r   r6   zCClassScope.__init__z	  s    D$444!!&1&8&89NPT&U&UD#&1&8&89Ld&S&SD# "%'"&
 ( 	0K,I 	0-	0#'#3#AD +/D(((	0 	0 	0 	0r!   c                     | j         r| j                            dd          sdS | j        j        }|r |j        |j                                        S | j        j        r| j        j         S dS )Nno_gcFT)	has_cyclic_pyobject_attrsr  rR   r  rg  ri   needs_gcr  is_gc_simple)r5   rg  s     r   r  zCClassScope.needs_gc	  s}     ) 	$/2E2Egu2U2U 	4$.	 	54?++---- 	5'444ur!   c                     | j                             d          }|du rdS |r	| j        rdS | j        j        }|r |j        |j                                        S | j        j        S )NtrashcanFT)r  rR   r  r  rg  ri   needs_trashcanbuiltin_trashcan)r5   	directiverg  s      r   r  zCClassScope.needs_trashcan	  s|     O''
33	5  	7 	4$.	 	44?1133300r!   c                 b    |                                  o| j                            dd           S )z
        Do we need to generate an implementation for the tp_clear slot? Can
        be disabled to keep references for the __dealloc__ cleanup function.
        no_gc_clearF)r  r  rR   r9   s    r   needs_tp_clearzCClassScope.needs_tp_clear	  s,    
 }}Pt':':=%'P'P#PPr!   c                     | }|rZ|                     d          }|r	|j        rdS |j        j        s|j        r|j        j        rdS |j        j        }|r|j        nd}|ZdS )z
        This covers cases where we definitely have a __del__ function
        and also cases where one of the base classes could have a __del__
        function but we don't know.
        __del__TNF)rn  r   r  is_externalr  multiple_basesrg  ri   )r5   current_type_scope	del_entrycurrent_base_types       r   may_have_finalizezCClassScope.may_have_finalize	  s     "  		X*66yAAI Y1 t".: BTB` &2A t 2 > H<M!W!2!8!8SW ! 		X ur!   Tc                 \   g }g }g }| j         D ]}|j        j        r8|s| j        s|j        dk    r#|s|j        j        s|                    |           F|j        t          j        k    r|                    |           q|j        j	        r|                    |           |p|p|}||||ffS )Nr   )
r   rF   r  is_closure_class_scoperE   r  r   r   c_py_buffer_typerP  )r5   include_weakrefinclude_gc_simplepy_attrs
py_buffersmemoryview_slicesr_   have_entriess           r   get_refcounted_entriesz"CClassScope.get_refcounted_entries	  s    
% 	0 	0Ez% 0" /t'B /ejTaFaFa( /
0G / ...z:::!!%((((. 0!((///B:B1Bh
4EFFFr!   NrC   c
                    |                      |          }|	rQd|	v r2d}|j        s)|j        st          |d|z             t          }n|j        }d|	v r| j        st          |d           |r)| j        rt          |d           | j        s:t          | j
                                      |          rt          |d|z             |s]|}| j        j        s5| j        j        j        s$| j        j        j        dk    st#          |          }t%          |t&          j                  }|                     |||||          }
d	|
_        | j                            |
           |	|
_        |j        r=|d
k    r7| j
        d         r|
                                 n|                    |           |j        rd| _        nf|                    |           rd| _         nI|j        rB| j        s|dk    r5d| _!        |j"        r |j#        r|j#        $                                rd| _%        |dvrt          |d|z             |dv rTd|
_&        | j        s|dk    rt          |d           |j        s(|'                    |           st          |d|z             nd|
_&        |
S |tP          u rt          }tR          *                    | |||||||||	
  
        }
d	|
_+        d	|
_,        |
S )Nztyping.ClassVarr   zZClassVar[] requires the type to be a Python object type. Found '%s', using object instead.zdataclasses.InitVarzIUse of cython.dataclasses.InitVar does not make sense outside a dataclasszVC attributes cannot be added in implementation part of extension type defined in a pxdz/The name '%s' is reserved for a special method.rW  r   r=  r  Tr   )rC   rW  r3  z1Attribute of extension type cannot be declared %sr2  z9Special attribute __weakref__ cannot be exposed to Pythonz7C attribute of type '%s' cannot be accessed from PythonFr  )-r$  r  equivalent_typer   r   rV  r   r   r  r   r  get_special_method_signaturer  r  r_   r   r   r    r.   r   unicode_structmember_prefixrS  r   r   r   r   r~   r   r  rP  has_memoryview_attrsneeds_explicit_construction"has_explicitly_constructable_attrshas_pyobject_attrsr  ri   r  r  r   can_coerce_to_pyobjectr   r   r   r   r   r  s              r   r   zCClassScope.declare_var	  s    --d33 
	h $666' 4/ 4  &B  EI  &I  J  J  J-#3%);;;DD];cfggg ?	| 8c78 8 8 /  "4?33PPQUVV cE       S(4 58H8N8R 5(.9XEE-e44E'v/QRRLLudCDDE !E##E***'9E$  8Z8%;%;?<0 8++----223777& :,0))11$77 ::>77! :t'B :dmF[F[*.', :#z:-1Z-@-@-B-B:59D2!BBBcG*TV V V333 (,$2 \t}7L7L#Z[[[( aD,G,G,M,M a#X[__```',$L'''%%%dD$,1j*-fgbt & v vE  EO !"ELr!   c                    |t           v r)|                     d          rt          |d|z             n8|dk    r2t           D ]*}|                     |          rt          |d|z             +|dk    rt          |d           |                     |t          |d          }t          | j                                      |          }|r||_        d|_	        nt          |_        d|_	        | j                            |           |S )	N__richcmp__z$Cannot define both % and __richcmp____new__zv__new__ method of extension type will change semantics in a future version of Pyrex and Cython. Use __cinit__ instead.r=  r  r   r   )r   rn  r   r   r   r   r  r  r  r   r   r   r   )r5   rE   rG   r  r  r_   special_sigs          r   r  zCClassScope.declare_pyfunction&
  s6   ***.. JcADHIII]"", K K##A&& K#EIJJJ9# R S S S  ~s,4 ! 6 6$T_55RRSWXX 	! *EO E0EO E""5)))r!   c                     | j         s|dk    rt          d          }t                              | |          }|r!|j        r| j        j        s| j        j        sd S |S )Nr  	__cinit__)r  r
   ro  rn  r   r  r  r  r  s      r   rn  zCClassScope.lookup_hereA
  ss    * 	.ty/@/@ --D&&tT22 	 U- 	 #3   '5  4r!   r   r?   c           
         |                      |          }t          | j                                      |          r| j        j        st          |d           |j        }|j        sb|st          |d           nO| j        	                    |d         j
                  s*t          |d|d         j
        d|d| j        d           |                     |          }|'t          t          |          t          j                  }|r|j        s)t          |d|z             |                                 n|r|j        rt          |d	|z             |j        r|j        rt          |d
           n`|                    |j
        d          r;|j        |j
        j        k    r&|j
                            |j                  |_
        n	|                    |j
        d          r|j        |j
        j        k    ru| j        rR|sP|                    |j
        dd          s3t9          |d|d| j        dd           t9          |j        dd           |                     ||||d|	          }nct          |d           t          |j        d           n=| j        rt          |d|d| j        d           |                     ||||||	          }|r%|                      t          j!        |          |_        |
|_"        ||_#        d|	v rd|_$        | j        j%        s!|j$        s| j        &                    d          r-d|_        |j        |_'        |j(        s|j
        |_)        ||_
        |S )Nz7Special methods must be declared with 'def', not 'cdef'zC method has no self argumentr   zSelf argument (z) of C method 'z' does not match parent type (r  r>  z'%s' already definedz'Overriding final methods is not allowedr   )
as_cmethod)r  as_pxd_definitionz'Compatible but non-identical C method 'z7' not redeclared in definition part of extension type 'z5'.  This may cause incorrect vtables to be generated.r   rW   r?  )r   r  z2Signature not compatible with previous declarationz
C method 'z@' not previously declared in definition part of extension type 'r  r  Tr  )*r$  r   r  r  r  r  r   rB  r  assignable_fromrF   rn  r.   r    r   unicode_vtabentry_prefixr   rX   r   r   r   same_c_signature_asr  r  r  rA  r   !same_c_signature_as_resolved_typer   rt  rG   r  r  r  r   r_   r   r  rR   r   rf   r   )r5   rE   rF   rG   r   r   r   r  r]  r  r   r  rB  r_   s                 r   r  zCClassScope.declare_cfunctionP
  s    --d334?++HHNN 	R(8	R#PQQQy$ 	> >c:;;;;%55d1glCC >ccAw|||TTT4+;+;+;= > > >  &&=#$5d$;$;V=\]]E !	V% Ec-4555++---- > 0 >#5<===) Ee.@ E#HIIII--ejq-II Edj\a\f\lNlNl!&!9!9$-!H!HEJJ33EJQ3OO ETXT^bgblbrTrTr 	NV 	N$($J$J %
qA %K %O %O	N   !%dooo7 9:	; ; ;
  	+I1MMM ..tT3RZfo.ppEE#STTT%)%CDDDD| Fcc.2ddDOOOEF F F &&tT3z9UUE 	E#{{6+=tDDE)
y  &*E#) 	"U-D 	"H[H[\cHdHd 	"%)E"%*%5E"= "$)J!!
r!   c           
          |                      |          }t                              | |||||||          }	d|	_        ||	_        |	S )Nr  r   )rn  ro  r  r   r   )
r5   rE   rF   rG   r   r   r  r  r   r_   s
             r   r  zCClassScope.add_cfunction
  sW    %%d++
(($c5*i9 ) V V%r!   c                     t          |          }|                     ||d |d|          }t          ||t                    }||_        d|_        d|_        ||_        |j        |_        ||_	        |S )Nr=  )rG   r   r   r   r   )
r
   r  rA   r   r   r   r   r   ri   r   )r5   rE   rF   r   r   r_   r  s          r   rs  z%CClassScope.declare_builtin_cfunction
  s     T""&&$D(Q] ' _ _$n55	#'	  !	 	!-	+	%r!   c                    |                      |          }|"|                     |||t          n||d          }d|_        |d|_        ||_        |t          ||           |_        n||_        | j        	                    |           |S )NrC   T)class_scope)
rn  rS  r   r   r   r   PropertyScoperi   r  r   )r5   rE   r   rG   ctypeproperty_scoper_   s          r   declare_propertyzCClassScope.declare_property
  s      &&=LLtu}^^RWY\^ghhE !%E	!'$???EKK(EK$$U+++r!   r=  c                     |                      ||||          }|j                            |t          j        |t          j        d| j        d          g|||	|
          ||||          }||fS )zPInternal convenience method to declare a C property function in one go.
        )r   r  rG   r5   Nr   )r  r  r  r  )rE   rF   r   r   r   rG   )r  ri   r  r   r  r  r  )r5   rE   rF   
cfunc_namer   rG   r   r  r  r  r  r   property_entryr  s                 r   declare_cpropertyzCClassScope.declare_cproperty
  s    
 ..tDc.RR$*<<%(1AtLLLM! / /   %! = 
 
 {**r!   c           
         fd}|j         |j        z   }|D ]g|                     j         |j                  j        d d          }d|_        d|_        j        |_        | j         	                    |           h|j
        d d          D ]'j        j        rj                                         (|j
        D ]j        }j        }|o|j        }|s ||          }|                     j        j        j        |j        j        d          }d|_        j        r6d|_        j        |_        | j        |j        k    s|j        rj        |_        |rd|_        ||_        j        rj        |_        d S )Nc                 0    t           j        dj        S rU  )r   r  r   )r   
base_entrys    r   adaptz9CClassScope.declare_inherited_c_attributes.<locals>.adapt
  s    $333Z5E5EFFr!   rC   r   Tr  )r  r   rS  rE   r   rF   r   r   r   r   r   rf   rg   r   r   r  rG   r   r   r   r   r   r   r   r   )	r5   
base_scoper  r   r_   r   r  r   r  s	           @r   r  z*CClassScope.declare_inherited_c_attributes
  s   	G 	G 	G 	G 	G 2Z5KK! 	5 	5JLLz'7!8!8y2 2E !"E!%E)4E&--e4444
 %21115 	E 	EJ' EBBDDD$2 	= 	=J$E".I";y';J %e&&*.%%z'@D ' R RE "#E* I)-&*4*F'%)@@@/ A-7-HE* .+/($-!& =%/%<")	= 	=r!   c                 T    t                                          ||||||           d S r2   )superrH  )r5   rE   r   rF   rG   r   rD  r  s          r   rH  z(CClassScope.handle_already_declared_name  s,    ,,T5$ZQ[\\\\\r!   )FTrL  rK  rM  r2   r   )NNr=  FFNFN)T)r;   r<   r=   rO  r  r  r  r  r  r  r   r  r6   r  r  r  r  r  r   r  rn  r  r  rs  r  r  r  rH  __classcell__r  s   @r   rv  rv  ]	  s       $ "# ).& %GK0 0 0"
 
 
1 1 1 Q Q Q  & 6;15G G G G( ,5OSP P P Pd   6    KLSXB B B BH          X`]b'++ + + +.,= ,= ,=^] ] ] ] ] ] ] ] ] ]r!   rv  c                   \     e Zd ZdZdZdZddZ	 	 ddZ	 	 dd	Zd
 Z	d Z
 fdZd Z xZS )CppClassScoper   Nc                     t                               | ||d            |j        | _        g | _        |7|D ]6}|                     ||t          j        |          d d          }d|_        5d S d S )Nr=  r   )r   r6   r  r  rS  r   TemplatePlaceholderTyper   )r5   rE   r   rx  Ttemplate_entrys         r   r6   zCppClassScope.__init__  s    tT;555%0%'"  + +!%q*<Q??x"Q "Q)*&&	 ! + +r!   r=  Fc                    |s|}|                      ||
           |                     |          }|	rs|q|j        r|                     |||||          }ny|j                            |          r%|j                            |j                  |_        n:t          |d           n)|                     |||||          }|j        r	|	sd|_	        d|_
        |j        rJd|_        | j        r<| j                                        s#| j                                        d||_        |dk    r"|	s|dk    r| j                            |           |S )Nr  r   ::r  r<  )r  rn  r   rS  rF   r  r  r  r   r   r   get_fused_typesempty_declaration_coder   r   r   )r5   rE   rF   rG   r   r   r   r  r  r]  r   r_   s               r   r   zCppClassScope.declare_var  s     	E''-?@@@  && 	')  UT5$ZHH##D)) U"Z55dmDD

cSTTTTLLudCDDE  ' '%&" 	Z!"Ey Z!:!:!<!< Z/3y/O/O/Q/Q/Q/QSXSX#Y 6>>x>48+;+;##E***r!   r   r?   c                    | j                             d          d         }||dfv rb|`t          j        d|}t	          d          }t          j                    |_        |j        |_	        d fd|j        D             |_        n@|dk    r:|8t          j        d|}t	          d          }t          j                    |_        |d	v rc|j
        r\| j        j        D ]O}|j                            |          }|r1|j        j
        s%t          |d
           t          |j        d           P|                     ||||||          }|
|_        ||_        |S )Nr  rJ  r6   r<  c                     | j         j        rC| j         j        s7t          j        | j        t          j        | j                   | j                  S | S r2   )rF   r~   is_referencer   r  rE   
c_ref_typerG   )r  s    r   	maybe_refz2CppClassScope.declare_cfunction.<locals>.maybe_ref?  sR    8( 1F %2*"7"A"A37L L L Jr!   c                 &    g | ]} |          S r?   r?   )r`   r  r  s     r   rb   z3CppClassScope.declare_cfunction.<locals>.<listcomp>E  s!    ===C3===r!   __dealloc__<del>r<  r  zdConstructor cannot be called without GIL unless all base constructors can also be called without GILzBase constructor defined here.)r]  r   r   )rE   r  r   r  r
   r   	CVoidTyper  rB  original_argsr  rF   r{  ri   rc  r   rG   r   r   r_   )r5   rE   rF   rG   r   r   r   r  r]  r  r   r  rt  baser  r_   r  s                   @r   r  zCppClassScope.declare_cfunction4  s    Y__T**2.
J
+++&,&8&8&8**EE **D)355D "&D   >===49===DII]""u})/);););ZZHE ))D)355D&&&4:&	. L L!Z..t44
 Ljo&; L#   F  G  G  G*.*JKKK  tS*2', ! E E *
r!   c                 (   |j         }|}t          |dd           r|j        }t          |dd           t          |dd           rd |j        D             }nd}|j        |j        z   D ]}|j        dv r|j        | j        v r|j         |                     |j        |j	        |j
        d d          }d|_        d|_        |j        rd|_        |j        |_        | j                            |           |j        D ]I}|                     |j        |j
        |j        |j	        |j        d|j        |j        	          }d|_        J|j        D ]F}|j        |vr;|                     |j        |j
        |j        |j	        |j        d
          }d|_        Gd S )Ntemplate_typerx  c                     g | ]	}|j         
S r?   r	  )r`   r  s     r   rb   zBCppClassScope.declare_inherited_cpp_attributes.<locals>.<listcomp>^  s    FFFafFFFr!   r?   r  r=  r   r   )r   r  r   F)r]  )ri   r   r  rx  r  r   rE   r   rS  r   rF   r   r   r   r   r   r   r  rG   r   r   r   r   r_  )r5   r}  r  r  base_templatesr  r_   s          r   r|  z.CppClassScope.declare_inherited_cpp_attributesX  s   %
"m_d;; 	8)7M m_d;; 	8=+t44 	 FFm.EFFFNNN %:Z=SS 	5 	5J"555$,..LL*2Bx1 1E !E!"E& 9%&"#-#8 &--e4444$2 	# 	#J**:?JO+5>:;K+5+@a5?5N8B8O	 + Q QE
 "#E$1 	' 	'Jn44))*/:?*4.*:J*4*?% * Q Q &'"	' 	'r!   c           	      p   t          | j        | j                  }||_        | j                                        D ]}|j        rB|                    |j        |j                            |          |j	        |j
        d           K|j        j        r^|                                D ]H}|                    |j        |j                            |          |j	        |j
        |j                   I|                    |j        |j                            |          |j	        |j
        |j                   |S )Nr   )r^  )r   )r  rE   r   rF   r   rB  r   r_  r  rG   r   r   r\   r  r   r   r   )r5   rB  
type_entryri   r_   r
  s         r   r  zCppClassScope.specialize  sU   di)9::
\((** 	4 	4E} 4""5:#(:#8#8#@#@#(9#(;,-	 # / / / /
 ( 4//11 I IA++AF,-F,=,=f,E,E,-E,-G9:	 , I I I II !!%*"'*"7"7"?"?"')"'+"'"2	4 4 4 4 r!   c                 v    |dk    rd}n|dk    rd}t          t          |                               |          S )Nr6   r<  r  r  )r  r  rn  )r5   rE   r  s     r   rn  zCppClassScope.lookup_here  sC    :DD]""D]D))55d;;;r!   c                     dS r?  r?   r9   s    r   r@  zCppClassScope.is_cpp  s	     tr!   r2   )Nr=  FFFFN)Nr=  r   r   r   r?   NF)r;   r<   r=   rb  default_constructorrF   r6   r   r  r|  r  rn  r@  r  r  s   @r   r  r    s         D+ + + + ,4_c   < JKSX" " " "H'' '' ''R  4< < < < <      r!   r  c                       e Zd Zd Z	 ddZdS )CppScopedEnumScopec                 @    t                               | ||d            d S r2   r,  rw  s      r   r6   zCppScopedEnumScope.__init__  s     tT;55555r!   Nr=  c                 z    |s|}|                      ||           |                     |||||          }d|_        |S r?  )r  rS  r   )r5   rE   rF   rG   r   r   r   r_   s           r   r   zCppScopedEnumScope.declare_var  sN      	E''-?@@@T5$Z@@ r!   )Nr=  N)r;   r<   r=   r6   r   r?   r!   r   r  r    s>        6 6 6 IM     r!   r  c                   &    e Zd ZdZd Zd ZddZdS )r  r   c                     |j         r|                                nd }t                              | |||           |j        | _        |j        | _        d S )Nr  )r   r&  r   r6   r  r  )r5   rE   r  r   s       r   r6   zPropertyScope.__init__  sT    4?4KUk..000QUtT;[III&2%0r!   c                    |j         j        rt          |d           |j        r6|j        d         j        t
          u r| j        j        |j        d         _        nnt          |j                  dk    rt          |d           nE|j        d         j        j	        s.|j        d         j        | j        j        u st          |d           t          j        | |||g|R i |}d|_        |S )z'Declare a C property function.
        z&C property method cannot return 'void'r   r   z4C property method must have a single (self) argumentz6C property method must have a single (object) argumentT)r  r  r   rB  rF   r   r   r  ry   r  r   r  r   )r5   rE   rF   rG   rB  kwargsr_   s          r   r  zPropertyScope.declare_cfunction  s     # 	A#?@@@9 	Q1*n<< $ 1 =DIaL^^q  #MNNNN)A,#/ 	Q49Q<3DHYHe3e3e#OPPP'dD#OOOOOO!r!   Fc                     t          |          }|r.|                     ||t          |d          }d|_        ||_        |S t          |d           d S )NrC   r   zKOnly __get__, __set__ and __del__ methods allowed in a property declaration)r   rS  r   r   r  r   )r5   rE   rG   r  r  r_   s         r   r  z PropertyScope.declare_pyfunction  sb    3D99	 	LLt^S)LLE E'EOL# , - - -4r!   NrK  )r;   r<   r=   rU  r6   r  r  r?   r!   r   r  r    sN         1 1 1  $     r!   r  c                       e Zd ZddZd ZdS )CConstOrVolatileScoper   c                     t                               | d|j        z   |j        |j                   || _        || _        || _        d S )Ncv_)r   r6   rE   r   r   base_type_scoper   is_volatile)r5   r  r   r  s       r   r6   zCConstOrVolatileScope.__init__  sQ    O(('(		* 	* 	*
  / &r!   c                     | j                             |          }|@t          j        |          }t          j        |j        | j        | j                  |_        |S d S r2   )r  rn  rC  r   c_const_or_volatile_typerF   r   r  r  s      r   rn  z!CConstOrVolatileScope.lookup_here  s^    $0066Ie$$E#<Jt/?A AEJL	 r!   N)r   r   )r;   r<   r=   r6   rn  r?   r!   r   r  r    s7        ' ' ' '    r!   r  c                       e Zd Zd ZdS )TemplateScopec                 X    t                               | ||d            |j        | _        d S r2   )r   r6   r  rw  s      r   r6   zTemplateScope.__init__  s(    tT;555%0r!   N)r;   r<   r=   r6   r?   r!   r   r  r    s#        1 1 1 1 1r!   r  r2   )2rM  rC  r4  mathUtilsr   Errorsr   r   r   r	   StringEncodingr
   rB   r   r   r   r   r   	TypeSlotsr   r   r   r   r   r   r   r    r.   r0   rA   r   r   rZ  ra  const_counterr  rL  rM  rZ  rb  r  ro  r}  rv  r  r  r  r  r  r?   r!   r   <module>r     s   
			    . . . . . . C C C C C C C C C C C C ) ) ) ) ) )               8 8 8 8 8 8 8 85 5 5 5 5 5 5 5 5 5 5 5 5 5                 *0 0 0 0 0 0 0 0s^ s^ s^ s^ s^ s^ s^ s^l!1 !1 !1 !1 !1 !1 !1 !1HK K K K K K K K\    U   V V V V V5 V V Vr b
0 b
0 b
0 b
0 b
0% b
0 b
0 b
0Jj2 j2 j2 j2 j2 j2 j2 j2ZD D D D D D D DN1 1 1 1 1: 1 1 10    |    'D 'D 'D 'D 'D 'D 'D 'DT+ + + + + + + +\.8 .8 .8 .8 .8: .8 .8 .8bf] f] f] f] f]* f] f] f]P` ` ` ` `E ` ` `F       ", , , , ,E , , ,^    E   *1 1 1 1 1E 1 1 1 1 1r!   