+
    VBi                         ^ RI t ^ RIt^RIHtHtHtHtHtHt ^RIH	t	H
t
HtHt ^RIHtHtHt ^RIHt ^RIHtHt  ! R R]4      tR# )	    N)	ExprNodes
PyrexTypesParseTreeTransformsStringEncodingErrorsNaming)	CloneNodeCodeObjectNode	ProxyNode	TupleNode)FuncDefNodeStatListNodeDefNode)
OrderedSet)errorCannotSpecializec                     a a ] tR t^t oRtRtRtRtRtRt	Rt
]P                  . RO,           tV 3R ltR tR tR tR tR tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R t#R t$V 3R lt%R t&Rt'Vt(V ;t)# )FusedCFuncDefNodea#  
This node replaces a function with fused arguments. It deep-copies the
function for every permutation of fused types, and allocates a new local
scope for it. It keeps track of the original function in self.node, and
the entry of the original function in the symbol table is given the
'fused_cfunction' attribute which points back to us.
Then when a function lookup occurs (to e.g. call it), the call can be
dispatched to the right function.

node    FuncDefNode    the original function
nodes   [FuncDefNode]  list of copies of node with different specific types
py_func DefNode        the fused python function subscriptable from
                       Python space
__signatures__         A DictNode mapping signature specialization strings
                       to PyCFunction nodes
resulting_fused_function  PyCFunction for the fused DefNode that delegates
                          to specializations
fused_func_assignment   Assignment of the fused function to the function name
defaults_tuple          TupleNode of defaults (letting PyCFunctionNode build
                        defaults would result in many different tuples)
specialized_pycfuncs    List of synthesized pycfunction nodes for the
                        specializations

fused_compound_types    All fused (compound) types (e.g. floating[:])
Nc                  < \         SV `  VP                  4       . V n        Wn        \        V P                  \        4      pV'       d   V P                  V4       MV P                  V4       V P                   F  pVP                  P                  P                  '       d   Q hVP                  P                  P                  '       d   Q hVP                  P                  '       d   VP                  P                  '       d   Q hV'       d   K  VP                  P                  '       g   K  VP                  P                   '       d   K  Q h	  WP                  n        V P                  R ,          V n        R# )NNNN)super__init__posnodesnode
isinstancer   copy_def	copy_cdefentrytypeis_fusedlocal_scopereturn_typecfunc_declaratoroptional_arg_countop_arg_structfused_cfunctionstats)selfr   envis_defn	__class__s   &&&  >/usr/lib/python3.14/site-packages/Cython/Compiler/FusedNode.pyr   FusedCFuncDefNode.__init__2   s   "
	DIIw/MM#NN3 Aww||,,,,,}}0099999(((==111116a00CCCvv+++++  &*

" ZZ]
    c           
        \         P                  ! V P                  P                   Uu. uF,  q"P                  P
                  '       g   K   VP                  NK.  	  up4      pV P                  V4      p\         P                  ! V4      pW0n        V P                  P                  VP                  9   d0   VP                  P                  V P                  P                  4       V EF  w  rg\        P                  ! V P                  4      pV P                  P                  P                  VP                  n        V P                  VP                  V4       V P                  P                   P#                  V4      Vn        \%        V4      Vn        VP)                  V4       V P+                  WV4       V P-                  WV P                  P                  Ws4       \         P.                  ! VP                  V4       RVP                  n        VP                  VP2                  VP                  P4                  &   \7        V P                  P                  VP                  4       U	U
u. uF@  w  rV	P                  P
                  '       g   K#  V
P                  P9                  RRR7      NKB  	  pp	p
\:        P<                  ! VP4                   RRP?                  V4       R24      Vn        V PA                  V4      '       d   EK   M	  V P                  V n!        V PE                  V P                  VRR7      V n#        R# u upi u up
p	i )	zP
Create a copy of the original def or lambda function for specialized
versions.
T )for_display[,]r+   N)$r   uniquer   argsr    r!   _get_fused_base_types get_all_specialized_permutationsfused_compound_typesr   pyfunc_entriesremovecopydeepcopy	signature_specialize_function_argsr#   
specializer
   code_objectanalyse_declarationscreate_new_local_scopespecialize_copied_defspecialize_entryusedentriesnamezipdeclaration_coder   EncodedStringjoinreplace_fused_typechecksorig_py_funcmake_fused_cpdefpy_func)r)   r*   argr<   fused_typespermutationscnamefused_to_specificcopied_nodefargsargspecialised_type_namess   &&          r.   r   FusedCFuncDefNode.copy_defO   s   
  *00!%E#883D3DXSXXE G001EF!BB;O$8!99??c000%%diioo6(4$E--		2K*.))//*C*CK'**;+;+;=NO&*ii&;&;&F&F4E'GK#&4[&AK#,,S1 '':KL&&{499??'8P ''(9(95A%)K"2=2C2CCKK))../ %(		8H8H$I&$ILT99%% A		**24*@$I # &
  .;;{?O?O>PPQRURZRZ[qRrQsst<uvK00==9 )5< !II,,TYYD,IQ F:&s   L=L=& M!Mc                   V P                   P                  P                  4       pV P                   P                  ;V n        pRV P                   n        V'       d&   VP
                  P                  VP                  4       V P                   P                  P                  4       pW@n	        . pV EF  w  rg\        P                  ! V P                   4      p VP                  P                  V4      p	TP                  p
T	P!                  Y4       TP"                   F  pT
P$                  TP$                  8X  g   K   T	P'                  TP                  4      '       g   KC  Yn        TP                  P(                  '       g   T
P(                  TP                  n        Tp
TP                  p	 M	  TP+                  T
4       Yn        YuT
n        T	n        T
P,                  ;'       gI    T P                   P                  P.                  ;'       g!    TP0                  ;'       g    T
P2                  T
n        T P                   P4                  P6                  '       d(   T P                   P4                  P9                  YTR7       T	P:                  Tn        T P=                  YT4       T P?                  TP4                  P@                  T4       TPC                  T4       TP                  '       dk   TP
                  P                  TP                  P                  4       T PE                  TP                  Y`P                   P                  PF                  Yt4       T PI                  T4      '       d   EK   M	  V P                   P                  VP"                  9   dE   VP"                  PK                  V P                   P                  4      pWQP"                  W^,           % MVP"                  PM                  V4       V'       d   V PO                  W1RR7      V n        R# W0n        R#   \         d#    \        TP                  R4       RT n          R# i ; i)zN
Create a copy of the original c(p)def function for all specialized
versions.
NzQReturn type is a fused type that cannot be determined from the function arguments)fused_cnameFr7   )(r   r    r;   rS   rQ   r=   r>   r   get_fused_typesr<   r?   r@   rC   r   r   r   rH   cfunc_entriesrW   same_as_resolved_type
func_cnameappendrI   defined_in_pxdis_c_class_scope
is_cmethodr$   r%   declare_optional_arg_structr#   rF   rB   r9   declare_cpdef_wrapperrG   as_variablerP   indexextendrR   )r)   r*   rV   rQ   rU   new_cfunc_entriesrW   rX   rY   r    r   
orig_entrycindexs   &&           r.   r   FusedCFuncDefNode.copy_cdef   sq   
 yy~~FFH ,099+<+<<L 		%%l&8&89iinn446$/!(4$E--		2K"''223DE  %%E!!%/ "//
;;*"2"22t7Q7QR\RaRa7b7b(2%&,,7777<7G7G))4&E%??D 0 "((/#%)"EJ
** + +))//88+ +..+ +  ** J
 yy))<<<		**FF+/% G I '+&6&6K#'':KL **;+G+G+L+L+<>
 --c2"""""))+*=*=*C*CD**#++UIIOO4O4O)8 00==s )5x 99??c///&&,,TYY__=F1BfAX.$$%67008= 1 ?DL (LA $ koo (B C#s   P  (QQc                T    . p\        4       pV F  pVP                  W#R7       K  	  V# )zY
Get a list of unique basic fused types, from a list of
(possibly) compound fused types.
)resultseen)setr`   )r)   r<   
base_typesrs   
fused_types   &&   r.   r:   'FusedCFuncDefNode._get_fused_base_types   s1    
 
u.J&&j&D /r0   c                `   V F  pVP                   P                  '       g   K!  VP                   P                  V4      Vn         VP                   P                  '       d&   VP                   P	                  VP
                  4       VP                  '       g   K  R VP                  n        K  	  R# )TN)r    r!   rC   is_memoryviewslicevalidate_memslice_dtyper   
annotationuntyped)r)   r9   rX   rT   s   &&& r.   rB   +FusedCFuncDefNode._specialize_function_args   sp    Cxx   88../@A88...HH44SWW=>>> .2CNN* r0   c                    VP                  V4       W1P                  n        RVn        V P                  P                  V4       R# )am  
Create a new local scope for the copied node and append it to
self.nodes. A new local scope is needed because the arguments with the
fused types are already in the local scope, and we need the specialized
entries created after analyse_declarations on each specialized version
of the (CFunc)DefNode.
f2s is a dict mapping each fused type to its specialized version
FN)create_local_scoper"   rX   has_fused_argumentsr   rd   )r)   r   r*   f2ss   &&&&r.   rF   (FusedCFuncDefNode.create_new_local_scope   s:     	$-0* $) 

$r0   c                   V P                  V4      pV Uu. uF  p\        P                  ! Wt4      NK  	  ppRP                  V4      Vn        \        P
                  ! W!P                  P                  4      VP                  n        VP                  VP                  n        VP                  VP                  n	        R# u upi )zoSpecialize the copy of a DefNode given the copied node,
the specialization cname and the original DefNode entry|N)
r:   r   specialization_signature_stringrO   specialized_signature_stringget_fused_cnamer   pymethdef_cnamedoc	doc_cname)	r)   r   rW   py_entryr   r<   rU   rv   type_stringss	   &&&&&&   r.   rG   'FusedCFuncDefNode.specialize_copied_def  s     001EF #.
"-J 66zG"- 	 

 -0HH\,B)%/%?%?(-zz/I/I&K

"!

'11


s   B>c                    \         P                  ! 4       p\        P                  ! VP                  4      pV! V4       \         P                  ! 4       V8  d   R# R# )z
Branch-prune fused type checks like

    if fused_t is int:
        ...

Returns whether an error was issued and whether we should stop in
in order to prevent a flood of errors.
FT)r   get_errors_countr   ReplaceFusedTypeChecksr"   )r)   rY   
num_errors	transforms   &&  r.   rP   *FusedCFuncDefNode.replace_fused_typechecks  sK     ,,.
'>>'2'>'>@	+""$z1r0   c                |    V F5  pVP                  4       pVP                  RV RVP                   R24       K7  	  R# )zT
Generate Cython code for instance checks, matching an object to
specialized types.
z(
                    if isinstance(arg, z#):
                        return ''
                N)py_type_name	put_chunkspecialization_string)r)   normal_typespyx_coder*   specialized_typer   s   &&&&  r.   _fused_instance_checks(FusedCFuncDefNode._fused_instance_checks&  sQ    
 !-+88:L((4~ 6!!1!G!G H I !-r0   c                    \        V4      P                  R R4      P                  RR 4      pVP                  '       d   \        P                  V,           pV# )___ )strreplace
is_typedefr   fused_dtype_prefix)r)   dtyperK   s   && r.   _dtype_nameFusedCFuncDefNode._dtype_name5  sF    5z!!#t,44S#>,,t3Dr0   c                ^    VP                   '       d   V P                  V4      # \        V4      # N)r   r   r   r)   r   s   &&r.   _dtype_typeFusedCFuncDefNode._dtype_type;  s)    ##E**5zr0   c                T    VP                   '       d   R # RV P                  V4       R2# )zsizeof(void *)zsizeof())is_pyobjectr   r   s   &&r.   _sizeof_dtypeFusedCFuncDefNode._sizeof_dtype@  s,    #T--e45Q77r0   c                   VP                  R4      ;_uu_ 4        VP                  R4       VP                  R4       RRR4       VP                  R4      ;_uu_ 4        VP                  R4       VP                  R4       RRR4       VP                  R4      ;_uu_ 4        VP                  R4       VP                  R4       RRR4       R#   + '       g   i     L; i  + '       g   i     Li; i  + '       g   i     R# ; i)	z?Setup some common cases to match dtypes against specializationszif kind in u'iu':pass	dtype_intNzelif kind == u'f':dtype_floatzelif kind == u'c':dtype_complex)indenterputlnnamed_insertion_point)r)   r   s   &&r.   %_buffer_check_numpy_dtype_setup_cases7FusedCFuncDefNode._buffer_check_numpy_dtype_setup_casesF  s    233NN6"**;7 4 344NN6"**=9 5 344NN6"**?; 54 43 54 544s#   #C#C""#C5C	"C2	5D	c           	        V P                  V4       W2,            EF;  pTpVP                  '       d   VP                  pVP                  pV P	                  V4      R,           pRV P                  V4       R2pVP                  VR,          3VP                  VR,          3VP                  VR,          3.p	V	 F  w  rV
'       g   K  V RVP                   2pVP                  '       d	   W,          pVP                  '       d
   VR,          pVP                  R	V R
24      ;_uu_ 4        VP                  RVP                   R24       RRR4       K  	  EK>  	  R#   + '       g   i     K  ; i)z?
Match a numpy dtype object to the individual specializations.
z == itemsizez
 and not (z_is_signed ^ dtype_signed)r   r   r   z and (<Py_ssize_t>arg.ndim) == z and arg_is_pythran_compatiblezif :zreturn ''N)r   is_pythran_expr
org_bufferr   r   r   is_intis_float
is_complexndimr   r   r   )r)   r   specialized_buffer_typespythran_typesr   
final_typer   itemsize_matchsigned_matchdtypesdtype_category
codewriterconds   &&&&         r.   _buffer_check_numpy_dtype+FusedCFuncDefNode._buffer_check_numpy_dtypeT  s]    	228< - F F)J///#3#>#> $**E!//6GN'(8(8(?'@@Z[L x45-!89!!8O#<=F /5*%())HIYI^I^H_`<<<(D---<<D((3tfA77$$x
0P0P/QQR%ST 87 /5 !G2 877s   ) E	E-c                   VP                   pVP                  '       d   R.VP                  ,          pMVP                  p\        P
                  ! WV4      pVP                  V4       VP                  pVP                  \        P                   RV R24       VP                  p	V P                  V4      p
VP                  pVP                  RV RV
 RV
 RV RV RV	 R	24       R
# )z
For each specialized type, try to coerce the object to a memoryview
slice of that type. This means obtaining a buffer and parsing the
format string.
TODO: separate buffer acquisition from format parsing
r   z(object, int)z
                # try zH
                if (((itemsize == -1 and arg_as_memoryview.itemsize == z))
                        or itemsize == z8)
                        and arg_as_memoryview.ndim == z"):
                    memslice = z(arg_as_memoryview, 0)
                    if memslice.memview:
                        __PYX_XCLEAR_MEMVIEW(&memslice, 1)
                        # print 'found a match for the buffer through format parsing'
                        return 'zT'
                    else:
                        __pyx_PyErr_Clear()
            N)directstrided)r   	is_bufferr   axesr   MemoryViewSliceTypecreate_from_py_utility_codefrom_py_functionr   r   memviewslice_cnamer   r   r   )r)   r   	decl_coder   r*   r   r   memslice_typecoerce_from_py_funcmatchsizeof_dtype
ndim_dtypes   &&&&&       r.   !_buffer_parse_format_string_check3FusedCFuncDefNode._buffer_parse_format_string_checkw  s    !&&%%%)*-=-B-BBD#((D"66uC11#6+<<(()+>*?}M	O !66))%0%**
 	g HHT~ V((4~ 677Al C  34 5! "' (	
r0   c           	     B   TP                  RV'       d   RMR,           R,           V'       d   RMR,           R,           4       VP                  ^4       V'       d   VP                  R4       V P                  W1V4       VP                  ^4       V'       d'   VP                  RV^ ,          P                   R	24       VP                  R
4       VP                  R4      ;_uu_ 4        V F  pV P                  W4Wv4       K  	  RRR4       R#   + '       g   i     R# ; i)a.  
Generate Cython code to match objects to buffer specializations.
First try to get a numpy dtype object and match it against the individual
specializations. If that fails, try naively to coerce the object
to each specialization, which obtains the buffer each time and tries
to match the format string.
z
                z!arg_is_pythran_compatible = Falser2   z
                if ndarray is not None:
                    if isinstance(arg, ndarray):
                        dtype = arg.dtype
                        z arg_is_pythran_compatible = TrueaD  
                    elif __pyx_memoryview_check(arg):
                        arg_base = arg.base
                        if isinstance(arg_base, ndarray):
                            dtype = arg_base.dtype
                        else:
                            dtype = None
                    else:
                        dtype = None

                    itemsize = -1
                    if dtype is not None:
                        itemsize = dtype.itemsize
                        kind = ord(dtype.kind)
                        dtype_signed = kind == u'i'
            aS  
                        # Pythran only supports the endianness of the current compiler
                        byteorder = dtype.byteorder
                        if byteorder == "<" and not __Pyx_Is_Little_Endian():
                            arg_is_pythran_compatible = False
                        elif byteorder == ">" and __Pyx_Is_Little_Endian():
                            arg_is_pythran_compatible = False
                        if arg_is_pythran_compatible:
                            cur_stride = itemsize
                            shape = arg.shape
                            strides = arg.strides
                            for i in range(arg.ndim-1, -1, -1):
                                if (<Py_ssize_t>strides[i]) != cur_stride:
                                    arg_is_pythran_compatible = False
                                    break
                                cur_stride *= <Py_ssize_t> shape[i]
                            else:
                                arg_is_pythran_compatible = not (arg.flags.f_contiguous and (<Py_ssize_t>arg.ndim) > 1)
                z=
                if arg is None:
                    return 'r   z
            try:
                arg_as_memoryview = memoryview(arg)
            except (ValueError, TypeError):
                pass
            zelse:N)r   indentr   dedentr   r   r   )r)   buffer_typesr   r   r   accept_noner*   r   s   &&&&&&& r.   _buffer_checks FusedCFuncDefNode._buffer_checks  s    	>K:QSUX
 FSAXZ\
_	, 	( 	&&x}M
 )!_BBC D 		 w''$0 66 -=D %1 ('''s   'DD	c           
         VP                  R\        P                   R\        P                   R24       VR,          P                  R\        P                   R24       V'       d   VR,          P                  R4       VR,          P                  R4       \        4       p\        4       p\        4       pV EFR  pVP                  p	V P                  V	4      p
V	P                  '       dL   W9  dE   VP                  V
4       VP                  R	V	P                   R
V
 RV	P                  4        R24       M`V	P                  '       dO   W9  dI   VP                  V
4       VP                  R	V	P                  4        R
V
 RV	P                  4        R24       V	P                  '       g   K  \        V	4      V9  g   EK  VP                  \        V	4      4       V P                  V	4      pVR,          P                  RV
 RV
 RV R24       EKU  	  R# )zW
If we have any buffer specializations, write out some variable and type declarations.
z!
                ctypedef struct zO:
                    void *memview

                void __PYX_XCLEAR_MEMVIEW(zR *, int have_gil)
                bint __pyx_memoryview_check(object)
            local_variable_declarationsz
                cdef z memslice
                cdef Py_ssize_t itemsize
                cdef bint dtype_signed
                cdef Py_UCS4 kind

                itemsize = -1
            z
                cdef bint arg_is_pythran_compatible
                cdef Py_ssize_t cur_stride
                cdef Py_ssize_t i
            z?
                cdef memoryview arg_as_memoryview
            z	ctypedef r   z "z": pass"z'
                            cdef bint z'_is_signed
                            z_is_signed = not (<z"> -1 > 0)
                        N)r   r   r   rt   r   r   is_struct_or_unionaddr   kindempty_declaration_coder   resolver   r   r   )r)   r   r   all_buffer_typesr   seen_typedefsseen_int_dtypesseen_structsbuffer_typer   
dtype_name
dtype_types   &&&&&       r.   _buffer_declarations&FusedCFuncDefNode._buffer_declarations  s    	!!'!:!: ; <+ ,2+D+D*E F		 	./99//0 1	 23== ?  	./99	
 %u+K%%E))%0J'''1 $$Z0OO#EJJ<qBu?[?[?]>^^efh !!!2!%%j1OO#EMMO#4Aj\ED`D`DbCccdeg |||u:_4#''E
3!%!1!1%!8J:;EE''1l 3'L(;J< H) ,r0   c                   \         P                  ! VP                  4      pVP                  4        \	        4       p. . . repRpV F  pVP                  4       p	V	'       d8   W9   d   K#  VP                  V	4       V	R8X  d   RpK?  VP                  V4       KR  VP                  '       d   VP                  V4       Kw  VP                  '       g   VP                  '       g   K  VP                  V4       K  	  WEWg3# )zF
Specialize fused types and split into normal types and buffer types.
FobjectT)r   get_specialized_typesr    sortrt   r   r   rd   r   r   ry   )
r)   rT   specialized_typesseen_py_type_namesr   r   r   has_object_fallbackr   r   s
   &&        r.   _split_fused_types$FusedCFuncDefNode._split_fused_types5  s     '<<SXXF 	  U46BM# 1+88:L5"&&|48+*.' ''(89!111$$%56!+++/?/R/R/R##$45 !2 =MMr0   c                   VP                  R V RV RV RVP                   RVP                   R24       VP                  4        VP                  '       d   VP	                  RV R24       MGW48  d#   TP	                  RT R	V^8w  d   R
MR R24       MVP	                  RVP                   R24       VP                  4        R# )z'
                # PROCESSING ARGUMENT z
                if z= < len(<tuple>args):
                    arg = (<tuple>args)[z/]
                elif kwargs is not None and 'z=' in <dict>kwargs:
                    arg = (<dict>kwargs)['z%']
                else:
            zarg = (<tuple>defaults)[r6   z=raise TypeError("Expected at least %d argument%s, got %d" % (, z"s"z""z, len(<tuple>args)))z9raise TypeError("Missing keyword-only argument: '%s'" % "z")N)r   rK   r   defaultr   r   )r)   r   rT   arg_tuple_idxmin_positional_argsdefault_idxs   &&&&&&r.   _unpack_argument"FusedCFuncDefNode._unpack_argumentR  s    ''4o 6!? #))6 8..1hhZ 8++.88* 5		
 	;;;NN*;-q9;0NNO()5HA5MESW+XXlp
 NNXY\YaYaXbbdghr0   c                   ^RI HpHpHp V'       d2   V P                  P
                  V P                  P                  ,
          M%\        R V P                  P                   4       4      pVP                  4       pVP                  4       p	VP                  4       p
V	P                  R4       V	P                  4        VP                  R4       VP                  4        VP                  R4       ^ p^ p\        4       p\        4       p\        V P                  P                  4       EF  w  ppVP                   P"                  '       d?   VP                   P%                  4       p\'        V4      ^8  d   \)        R4      hV^ ,          pVP                   P"                  '       Ed   XV9  Ed   VP+                  V4       V P-                  V4      w  ppppV P/                  VVWV4       RR.pR	.pV'       g	   V'       d   VP1                  R
4       RP3                  R \5        VV4       4       4      pRP3                  V4      pV
P7                  4       pVP                  R4       VP                  4        V
P9                  R4       V
P9                  R4       V
P;                  RV R24      ;_uu_ 4        V
P                  R4       V'       d   V P=                  VW4       V'       g	   V'       dh   \        4       pVP?                  V4       VP?                  R V 4       4       V PA                  V
VVV4       V PC                  VVV
VVPD                  V4       T
P9                  V'       d   RMR4       RRR4       V
PG                  4       pV
PI                  4        \J        PL                  ! VPO                  R4      4      PQ                  4       pRVR,           R\'        V4       R\'        VPR                  4       R\T        PV                  ! VPR                  4       2pVPY                  RRV R24      pVP[                  VP]                  VVR7      4       V	P9                  RV R V R!24       VP9                  R"V R#V R V R!24       V^,          pVP?                  V4       VP?                  R$ V 4       4       VP^                  '       g   EK  V^,          pEK  	  V'       d   VP[                  VP                  Pa                  R%R&4      4       VP[                  VP                  Pa                  R'R(4      4       VP[                  VP                  Pa                  R)R(4      4       VR,          P                  R*4       \'        V4      ^8X  d>   VP[                  VP\                  Pc                  R+R,4      4       VP                  R-4       MjVP[                  VP\                  Pc                  R.R,4      4       RP3                  R/ \e        \'        V4      4       4       4      p VP                  R0V  R124       TPG                  4       p!^R2I3H4p" VP                  V!R3V"! 4       .R47      p#VPk                  V P                  Pl                  4      ! V#Pn                  4      p$VPq                  V	PG                  4       VPs                  4       4       VV$n:        V$Pw                  V4       V$Px                  R6,          p%V$Pt                  V n=        \}        V P                  \~        4      '       d   V P                  R5,          V%nA        V%# V P                   U&u. uF  p&V&P                  NK  	  up&V%nA        V%#   + '       g   i     EL; iu up&i )7z
This creates the function that is indexable from Python and does
runtime dispatch based on the argument types. The function gets the
arg tuple and kwargs dict (or None) and the defaults tuple
as arguments from the Binding Fused Function's tp_call.
)TreeFragmentCodeUtilityCodec              3   D   "   T F  qP                   e   K  ^x  K  	  R # 5ir   )r  ).0rT   s   & r.   	<genexpr>5FusedCFuncDefNode.make_fused_cpdef.<locals>.<genexpr>v  s     C^c{{^s    
 af  
                cdef extern from *:
                    type __Pyx_ImportNumPyArrayTypeIfAvailable()

                    # from FusedFunction utility code
                    object __pyx_ff_match_signatures_single(dict signatures, dest_type)
                    object __pyx_ff_match_signatures(dict signatures, tuple dest_sig, dict sigindex)
            a  
                def __pyx_fused_cpdef(signatures, args, kwargs, defaults, _fused_sigindex={}):
                    # FIXME: use a typed signature - currently fails badly because
                    #        default arguments inherit the types we specify here!

                    if kwargs is not None and not kwargs:
                        kwargs = None

                    # instance check body
            importszODetermination of more than one fused base type per argument is not implemented.r   r    rT   ndarrayr  c              3   4   "   T F  w  rV R V 2x  K  	  R# 5i)r   N )r  atypeanames   &  r.   r  r    s     &vNule%%'9Nus   z
                    cdef extern from *:
                        void __pyx_PyErr_Clear "PyErr_Clear" ()
                        int __Pyx_Is_Little_Endian()
                    r2   z@TYPE_MAPPER_CNAME_PLACEHOLDERzcdef str map_fused_type(z):r   c              3   8   "   T F  qP                   x  K  	  R # 5ir   r   r  tys   & r.   r  r    s     2Y=R===   zreturn 'object'zreturn NoneNzutf-8__pyx_ff_map_fused_:N   Nr   z 
@TYPE_MAPPER_CNAME_PLACEHOLDER
z	
@cname('z')
)rK   zstr (r   dest_sigz = c              3   8   "   T F  qP                   x  K  	  R # 5ir   r  r  s   & r.   r  r    s     'N"r  IsLittleEndianzModuleSetupCode.cImportzImportExport.cImportNumPyArrayz}
                    cdef type ndarray
                    ndarray = __Pyx_ImportNumPyArrayTypeIfAvailable()
                match_signatures_singlezFusedFunction.pyxzg
                return __pyx_ff_match_signatures_single(<dict> signatures, dest_sig0)
                match_signaturesc              3   ,   "   T F
  pR V 2x  K  	  R# 5i)r!  Nr  )r  is   & r.   r  r    s     &\?[!!~?[s   zF
                return __pyx_ff_match_signatures(<dict> signatures, (z+), <dict> _fused_sigindex)
                )ConstantFoldingmodule)levelpipeliner   )Cr2   r  r  r  r   num_required_argsnum_required_kw_argssumr9   PyxCodeWriterr   r   r   r   rt   	enumerater    r!   r`   lenNotImplementedErrorr   r  r	  rd   rO   rL   insertion_pointr   r   r   updater   r   r   getvalueresethashlibsha256encode	hexdigesttypesr   type_list_identifierr   use_utility_codeCythonUtilityCoder  load_cachedloadrangeOptimizer*  SetPosTransformr   rootdeclare_declarations_in_scopeglobal_scopescoperE   r(   fragment_scoper   r   r   specialized_cpdefsrS   )'r)   rQ   r*   r+   r  r  r  r  r   r   type_mapperfused_indexr  r   seen_fused_typesr)  rT   arg_fused_typesrv   r   r   r   r   mapper_arg_typesmapper_arg_names
mapper_sigmapper_argsmapper_decl_codemapper_buffer_typestype_mapper_impl	impl_hashtype_mapper_cnamedest_sig_tuplefragment_coder*  fragmentastrS   r,   s'   &&&&                                   r.   rR   "FusedCFuncDefNode.make_fused_cpdefj  s    	65  II''$))*H*HHCTYY^^CC 	 %%'&&(	((*	 		
	 	&&y1%<5		/FAsxx   "%((":":"<'!+- /V W W,Q/
xx   Z7G%G $$Z0QUQhQhilQmNlM;N%%hQ[Y$,f#5 $)7 =$++I6!YY&vcRbdtNu&vv
"ii(89#.#>#>#@  ** !'')!!"%!!"BC )),DZLPR*STT556ST#33L+S#}.8l++22<@+222Y=2YY11+?OQdfst++(-FVOOS2  %%;N&7Tab% U( $/#7#7#9 !!# $NN+;+B+B7+KLVVX	))B-,-.aJ4D4D0E/F
77
8H8HIJL "
 $4#;#;8JGXFYY]:^$`  $$112BIZ1[] $'8&9:,a HI+c:K9LAk]Z[\]q  ''5 '''N'NN{{{q _ 0b     ,,-=?RSU    ,,X7GHJ    ,,-?AQRT Y))  A%  --223LNabd   --223EGZ[]!YY&\uSIYEZ?[&\\NFFTEU V !))+ 	.,,_5F4G - I**499==9(--H11 #"2"2"4	6	  %))B-!iidii)))-AG&  >BZZ)HZ!))Z)HG&K UTTF *Is%   03]&$]&,A9]&&]&]:&]7c           	        RpV P                   P                  pV F-  p\        W4\        V P                  P                  V4      4       K/  	  V P                  P
                  V P                   n        V P                  P                  V P                   n        VP                  P                  RR4       \        V P                  \        4      '       d   W1P                  VP
                  &   M!W1P                  VP
                  ,          n        VP                  P                  V4       W P                   P                  n        . pV P                    F  p\        V P                  \        4      '       d%   VP                  V4       V P                   Vn        KG  VP                  VP                   4       V P                   VP                   n        W6P                  n        K  	  V P%                  V4       R# )rK   __pyx_fused_cpdefN)
rK   r   rW   rc   pyfunc_cnamer   r   r   	is_memberrJ  )rS   r   setattrgetattrrQ   rK   r   rJ   popr   r   r   rj   r=   rd   r'   r   fused_py_funcsynthesize_defnodes)r)   r*   copy_attributesr   attr	def_nodesr   s   &&     r.   update_fused_defnode_entry,FusedCFuncDefNode.update_fused_defnode_entry#  s[   
 ""#DED--33T:< $ !--22,,00+T2dii))&+KK

#27KK

#/!!%(-1*	JJD$))W--  &%)\\"  .-1\\*).

&  	  +r0   c                   V P                    FR  pVP                  4        F;  pVP                   F(  pVP                  '       g   K  VP	                  V4       K*  	  K=  	  KT  	  V P
                  '       d   V P                  P                  V4      V n        V P
                  P                  V4      V n        V P                  P                  V4      V n        V P                  P                  V4      V n	        . ;V n
        pV P                  P                   F  pVP                  '       d   VP                  P                  V4      Vn        VP                  P                  '       d2   VP                  \         P                   ! VP                  4      4       K  VP                  \#        VP                  P%                  V4      4      4       K  VP                  R4       K  	  \'        V P(                  4       F  w  rxVP                  V4      ;qP(                  V&   \+        V\,        4      '       g   K<  WP
                  Jg   KM  \/        VP                  V4       Fy  w  riV	f   K  V	P                  '       d$   V	P1                  VP2                  V4      Vn        K@  \5        V	4      P                  V4      P1                  VP2                  V4      Vn        K{  	  K  	  V P
                  '       Ed   V U	u. uF  q'       g   K  \5        V	4      NK  	  p
p	\7        V P8                  V
R7      V n        V P:                  P=                  VRR7      P?                  V4      V n        \#        V P:                  4      V n        V P                  P@                  p\5        V P:                  4      Vn        \'        V PB                  4       F>  w  r|VP=                  V4      ;qPB                  V&   \5        V P:                  4      Vn        K@  	  V # u up	i )zy
Analyse the expressions. Take care to only evaluate default arguments
once and clone the result for all specializations
N)r9   T)skip_children)"r<   r`   r>  r   create_declaration_utility_coderS   __signatures__analyse_expressionsresulting_fused_functionfused_func_assignmentdefaultsr   r9   r  
is_literalrd   r?   r   coerce_to_tempr3  r(   r   r   rL   	coerce_tor    r	   r   r   defaults_tupleanalyse_typescoerce_to_pyobjectrT   specialized_pycfuncs)r)   r*   fused_compound_typerv   specialization_typert  rT   r)  statr  r9   
fused_funcpycfuncs   &&           r.   rq  %FusedCFuncDefNode.analyse_expressionsH  s    
 $(#<#<1AAC
+5+;+;'*555+KKCP ,< D $= <<<"&"5"5"I"I#"ND<<;;C@DL,0,I,I,],]^a,bD))-)C)C)W)WX[)\D&#%%99>>C{{{!kk==cB;;)))OODIIckk$:; OOIckk.H.H.M$NO% " !,GA#'#;#;C#@@D::a=$,,\\1I$'		8$<LC*"---*1*;*;CHHc*JCK*3G*<*P*PQT*U*_*_`c`h`hjm*nCK %=	 - <<<6>Jh7'&Ig&hDJ"+DHH4"@D"&"5"5"C"CCW["C"\"o"ops"tD"+D,?,?"@D66::J(1$2E2E(FJ%'(A(AB
9@9N9Ns9SS33A6)243F3F)G& C  Ks   0	O?>O?c           	        V F  pRVP                   P                  n        K   	  V Uu. uF#  p\        P                  ! VP
                  4      NK%  	  pp\        W4       UUu. uF'  w  r$\        P                  ! VP                  VR7      NK)  	  pppV Uu. uF$  p\        P                  P                  VRR7      NK&  	  pp\        P                  P                  V P                  \        WV4      4      V n        W`n        V F
  pRVn        K  	  \#        V^ ,          4      V P$                  n        R# u upi u uppi u upi )zD
Create the __signatures__ dict of PyCFunctionNode specializations.
F)valueT)bindingN)r   rA   use_fastcallr   rN   r   rL   r   UnicodeNoder   PyCFunctionNodefrom_defnodeDictNode
from_pairsrp  r{  is_specializationr
   rS   rD   )r)   r   r   
signaturessigkeysvaluespycfuncnodes   &&      r.   rg  %FusedCFuncDefNode.synthesize_defnodes  s)   
 D05DJJ  -  #()"'$ %2243T3TU"' 	 ) "%U!79!7ID %%dhhc:!7 	 9 $%#d ++88t8L# 	 % (00;;DHHc$FWX$*!!K,0K) " $2%(#; )9%s   )D3"-D8*D>c                   V P                   '       d-   R V P                   n        V P                  P                  W4       ^RIHp V P                   F  p\        V\        4      '       g   K  VP                  P                  '       g2   VP                  '       g   KK  VP                  P                  R8X  d   Kh  VP                  VP                  4       VP                  W4       K  	  R# )T)OptionsexternN)rS   pymethdef_requiredrs  generate_function_definitionsr2   r  r(   r   r   r   rI   cimport_from_pyx
visibilitymark_posr   )r)   r*   coder  r~  s   &&&  r.   r  /FusedCFuncDefNode.generate_function_definitions  s    <<<.2DLL+&&DDSOJJD$,,JJOOO---djj6K6Kx6Wdhh'223= r0   c                  < V P                    F  pVf   K	  VP                  V4       K  	  V P                  '       d   V P                  P                  V4       \        SV `  V4       V P                  '       Ed   V P                  pVP                  V4       V P                  pVP                  V4       VP                  RVP                  4        RVP                  4        R24       VP                  V4       VP                  V4       VP                  V4       V P                  P                  V4       VP                  V4       VP                  V4       V P                  P                  V4       V P                  P                  V4       V P                    F+  pVf   K	  VP                  V4       VP                  V4       K-  	  R # )Nz((__pyx_FusedFunctionObject *) z)->__signatures__ = ;)rt  generate_evaluation_coderS   rx  r   generate_execution_coderp  rr  r   rr   generate_giverefgenerate_post_assignment_code
free_tempsrs  generate_disposal_code)r)   r  r  r  r  r-   s   &&   r.   r  )FusedCFuncDefNode.generate_execution_code  s}    }}G"006 % <<<88>'-,,J//566J//5JJ1*2C2C2E1FFZ[e[l[l[nZoopqs ''-44T:!!$'&&>>tD --d3!!$'66t<**40}}G"..t4""4( %r0   c                N    V P                    F  pVP                  V4       K  	  R # r   )r(   annotate)r)   r  r~  s   && r.   r  FusedCFuncDefNode.annotate  s    JJDMM$ r0   )rp  rt  rx  rK  r<   rs  r   r   rQ   rS   rr  r{  r(   )rp  rr  rs  )*__name__
__module____qualname____firstlineno____doc__rp  rr  rs  rS   rx  
decoratorsr   child_attrsr   r   r   r:   rB   rF   rG   rP   r   r   r   r   r   r   r   r   r   r  r	  rR   rk  rq  rg  r  r  r  __static_attributes____classdictcell____classcell__)r-   __classdict__s   @@r.   r   r      s     4 N# GNJ** .O OK#:.J`Z(x		2 "2 (
8<!UF(
TQDf?BN:0wr#,J5n<.>$)L   r0   r   )r?   r:  r2   r   r   r   r   r   r   r	   r
   r   r   Nodesr   r   r   Utilsr   r   r   r   r  r0   r.   <module>r     s8       G F 5 5  +~  ~ r0   