+
    :i^                     j   ^ RI t ^ RIHt ^ RIt^ RIHtHt ^ RIHt ^ RI	H
t
HtHtHtHtHtHt ^ RIHtHt ^ RIHt ^ RIHtHtHtHt ^ R	IHtHtHtHtH t H!t!H"t" ^ RI#t#^ RI$t$^ RI%t% ! R
 R]&4      t'R t(R t)R t*R t+R t,]! ](4      t-R t.R t/R t0R t1R t2R t3R t4 ! R R]4      t5 ! R R]]4      t6 ! R R]]4      t7 ! R R]]%P0                  4      t8 ! R  R!]]%P0                  4      t9 ! R" R#]]%P0                  4      t: ! R$ R%]]%P0                  4      t;]<R&8X  d   ]%Pz                  ! 4        R# R# )'    N)StringIO)njit	vectorize)typeof)utilstypestypingircompilercpucgutils)CompilerFlags)
cpu_target)MemoryLeakMixinTestCasetemp_directorycreate_temp_module)overloadmodelslower_builtinregister_modelmake_attribute_wrappertype_callabletypeof_implc                   2   a a ] tR t^t oV 3R ltRtVtV ;t# )	Namespacec                F   < W9   d	   W,          # \         \        V `  V4      # N)superr   __getattr__)sk	__class__s   &&Z/var/www/html/photoedit/myenv/lib/python3.14/site-packages/numba/tests/test_array_exprs.pyr!   Namespace.__getattr__   s     vqtE5A#B1#EE     )__name__
__module____qualname____firstlineno__r!   __static_attributes____classdictcell____classcell__)r$   __classdict__s   @@r%   r   r      s     F Fr'   r   c                      W,          V,           # r   r(   axys   &&&r%   axyr6           519r'   c                      W,          V,           # r   r(   r2   s   &&&r%   ax2r9   #   r7   r'   c                 x    V) VR ,          RV ,          V,          ,
          R,          ,           R V ,          ,          # )       @g      @      ?r(   AsBsCss   &&&r%   pos_rootrA   &   s.    CR2X"r'B,/C78R"WEEr'   c                     R V ,          pR V,          V,          pVR ,          V,
          pV) VR,          ,
          V,          # )r;   r<   r(   r>   r?   r@   _2As_4AsCs
_Bs2_4AsCss   &&&   r%   neg_root_common_subexprrG   )   s=    7D$Y^F(V#JC:$%--r'   c                     R V ,          pR V,          V,          pVR ,          V,
          R,           pV) VR,          ,
          V,          # )r;   y                r<   r(   rC   s   &&&   r%   neg_root_complex_subexprrI   /   sB    7D$Y^F(V#r)JC:$%--r'   c                 z    \         P                  ! \        V \         P                  ! V4      R ,
          R 4      4      # )      ?)npcosvaxysin)a0a1s   &&r%   
call_stuffrR   7   s&    66$r266":?B/00r'   c                 D    V^,          ^V ,          V,          ,
          ^ 8  #    r(   r=   s   &&&r%   are_roots_imaginaryrV   :   s    !Ga"frk!Q&&r'   c                      W,          V,           # r   r(   r=   s   &&&r%   div_addrX   =   s    7R<r'   c                     V ^,          # )   r(   )r>   s   &r%   cuber[   @   s    7Nr'   c                 \    \         P                  ! W4       \         P                  ! W!V4      # r   )rL   rM   add)r3   bouts   &&&r%   explicit_outputr`   C   s    FF1N66##r'   c                 R    W,           pW@V,          ,
          pWB,          V,           pV# r   r(   )r3   r^   cdus   &&&& r%   variable_name_reusere   G   s$    	A	E	A		AHr'   c                 D   V P                   ^ ,          p\        P                  ! W3\        P                  R7      p\	        V4       FV  p\	        W14       FD  p\        P
                  ! W,          W,          ,
          ^,          4      R,          ;W#V3&   W$V3&   KF  	  KX  	  V# )r   dtyper<   )shaperL   emptyfloat64rangesum)vectors	n_vectorsresultijs   &    r%   distance_matrixrs   O   s    a IXXy,BJJ?F9q$A(*gj(Q.)036)7 7FQ3K&1+ % 
 Mr'   c                   H   a  ] tR t^[t o ]RR l4       t]RR l4       tRtV tR# )RewritesTesterNc           	         Vf   / pV'       g   \        4       pRVn        Vf   \        P                  pVf   \        P                  pV ! WgWQVW44      # NT)r   nrtr   typing_contexttarget_context)clsargsreturn_typeflagslocalslibraryry   rz   s   &&&&&&&&r%   mk_pipelineRewritesTester.mk_pipeline\   sW     >FGE	!'66N!'66N>7+" 	"r'   c                j    Vf   / pV'       g   \        4       pRVn        V P                  ! WW4V3/ VB # rw   )r   no_rewritesr   )r{   r|   r}   r~   r   r   kwss   &&&&&&,r%   mk_no_rw_pipeline RewritesTester.mk_no_rw_pipelinek   s8     >FGE t%PCPPr'   r(   )NNNNNN)NNNN)	r)   r*   r+   r,   classmethodr   r   r-   r.   r0   s   @r%   ru   ru   [   s-     " " Q Qr'   ru   c                      a  ] tR t^vt o R tR tR tRR lt]3R lt	]
3R ltR tR	 tRR
 ltR tR tR t]3R ltR tR tR tR tRtV tR# )TestArrayExpressionsc                    \         P                  V4      pVP                  V4      pVP                  p\         P	                  V4      pVP                  V4      pVP                  pW5Wh3# )zD
Compile the given function both without and with rewrites enabled.
)ru   r   compile_extraentry_pointr   )	selffnarg_tyscontrol_pipelinecres_0control_cfunctest_pipelinecres_1
test_cfuncs	   &&&      r%   _compile_function&TestArrayExpressions._compile_functionx   sf     *;;GD!//3**&227;,,R0''
IIr'   c                   \         P                  ! ^ ^^
4      p\         P                  ! ^^^
4      p\         P                  ! ^^^
4      pWV3 Uu. uF  p\        V4      NK  	  ppV P                  \        V4      w  rgr\
        P                  V4      p
V
P                  \        4      pVP                  pV! WV4      pV	! WV4      pV! WV4      p\         P                  P                  W4       \         P                  P                  W4       VP                  P                  P                  pVP                  P                  P                  pV
P                  P                  P                  pV P                  \!        V4      \!        V4      4       V P                  \!        V4      \!        V4      4       V P#                  \!        V^ ,          P$                  4      \!        V^ ,          P$                  4      4       V P                  \!        V^ ,          P$                  4      \!        V^ ,          P$                  4      4       R# u upi )z^
Using a simple array expression, verify that rewriting is taking
place, and is fusing loops.
N)rL   linspacer   r   r6   ru   r   r   r9   r   testingassert_array_equalstatefunc_irblocksassertEquallenassertGreaterbody)r   AXYargr   r   nb_axy_0r   nb_axy_1control_pipeline2cres_2nb_ctlexpectedactualcontrolir0ir1ir2s   &                  r%   test_simple_expr%TestArrayExpressions.test_simple_expr   s   
 KK!BKK!BKK!B+,)4)36#;)4 ""30 	<M +<<WE"005##A!$!"q/


%%h7


%%g6$$,,33!!))00%%--44S3s8,S3s8,3s1v{{+SQ-=>SV[[)3s1v{{+;<- 5s   Ic              #     "   V Fr  p\        V\        P                  4      '       g   K%  \        VP                  \        P                  4      '       g   KQ  VP                  P
                  R 8X  g   Kn  Vx  Kt  	  R# 5i)	arrayexprN)
isinstancer
   AssignvalueExprop)r   blockinstrs   && r%   _get_array_exprs%TestArrayExpressions._get_array_exprs   sJ     E%++ekk27733{{~~4#	 s   #A='A=A=3
A=Nc                R   Vf   \        4       p\        V\        4      '       g   \        RP	                  V4      4      hVw  r4. pV F=  p\        V\        4      '       d   V P                  Wb4      w  rgVP                  V4       K?  	  V\        V4      3pVP                  V4       W3# )z;
Convert an array expression tree into a set of operators.
z{0} not a tuple)setr   tuple
ValueErrorformat_array_expr_to_setappendr]   )	r   exprr_   	operationoperandsprocessed_operandsoperand_processed_exprs	   &&&      r%   r   'TestArrayExpressions._array_expr_to_set   s     ;%C$&&.55d;<<"	G'5))!44WB
%%g.   #E*<$==""r'   c                   \         P                  P                  ^
4      p\         P                  P                  ^
4      R,           p\         P                  P                  ^
4      pW#V3 Uu. uF  p\        V4      NK  	  pp\        P	                  V4      pVP                  V4      pVP                  p	\        P                  V4      p
V
P                  V4      pVP                  pV! W#V4      pV	! W#V4      pV! W#V4      p\         P                  P                  W4       \         P                  P                  W4       \        \        4       4      # u upi )
   rK   )rL   randomr   ru   r   r   r   r   r   assert_array_almost_equalr   r   )r   r   r   BCr   r   r   control_cresnb_fn_0r   	test_cresnb_fn_1	np_resultnb_result_0nb_result_1s   &&              r%   _test_root_function(TestArrayExpressions._test_root_function   s   IIR IIR 2% IIR +,)4)36#;)4);;GD'55b9**&227;!//3	''qQK	aA&aA&


,,YD


,,[F""! 5s   +Ec                   \         P                  ! ^
\         P                  R7      p\        V4      3p\        P                  V4      pVP                  V4      pVP                  p\        P                  V4      pVP                  V4      pVP                  p	V^,          p
V P                  W! V4      4       V P                  W! V4      4       \        \        4       4      # )r   rg   )rL   arangerk   r   ru   r   r   r   r   assertPreciseEqualr   r   )r   r   r   r   r   r   r   r   r   r   r   s   &&         r%   _test_cube_function(TestArrayExpressions._test_cube_function   s    IIb

+!9,);;GD'55b9**&227;!//3	''6'!*5'!*5""r'   c                R  a	a
 \         P                  ! ^
\         P                  R7      o	S	^,           o
\        S	4      3^,          pV P	                  W4      w  r4rVV	V
3R lpV! V4      pV P                  W! V4      4       V P                  W! V4      4       \        \        4       4      # )zg
Test function having a (a, b, out) signature where *out* is
an output array the function writes into.
rg   c                 H   < \         P                  ! S4      pV ! SSV4       V# r   )rL   
zeros_like)r   r_   r   r   s   & r%   run_funcETestArrayExpressions._test_explicit_output_function.<locals>.run_func   s!    --"Cq!SMJr'   )rL   r   rk   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   s   &&       @@r%   _test_explicit_output_function3TestArrayExpressions._test_explicit_output_function   s    
 IIb

+E!9," ""2/ 	C	
 B<(=*AB(:*>?""r'   c                n    \        \        V P                  V4      4      4      pV P                  W24       R# )zH
Assert the *block* has the expected number of array expressions
in it.
N)r   listr   r   )r   r   expected_countrewrite_counts   &&& r%   _assert_array_exprs(TestArrayExpressions._assert_array_exprs   s,    
 D!6!6u!=>?7r'   c                >   V P                  \        V4      \        V4      4       V^ ,          P                  pV^ ,          P                  pV P                  V^ 4       V P                  V^4       V'       g'   V P	                  \        V4      \        V4      4       R# R# )z
Given two dictionaries of Numba IR blocks, check to make sure the
control IR has no array expressions, while the test IR
contains one and only one.
N)r   r   r   r   r   )r   
control_irtest_irtrivialcontrol_block
test_blocks   &&&&  r%   _assert_total_rewrite*TestArrayExpressions._assert_total_rewrite  s{     	Z#g,7"1**QZ__
  2  Q/ s=13z?C	 r'   c                L   V P                  \        V4      \        V4      4       VP                  4        Fk  w  r4VP                  pW#,          P                  pV P                  \        V4      \        V4      4       V P	                  V^ 4       V P	                  V^ 4       Km  	  R# )z~
Given two dictionaries of Numba IR blocks, check to make sure
the control IR and the test IR both have no array expressions.
N)r   r   itemsr   r   )r   r   r   r#   vr   r   s   &&&    r%   _assert_no_rewrite'TestArrayExpressions._assert_no_rewrite  s~    
 	Z#g,7$$&DAFFM JS/ZA$$]A6$$Z3 'r'   c                    V P                  4       pV P                  VP                  P                  P                  P
                  VP                  P                  P                  P
                  RR7       R# )zu
Ensure even a non-nested expression is rewritten, as it can enable
scalar optimizations such as rewriting `x ** 2`.
T)r   N)r   r   r   r   r   r   r   r   nss   & r%   test_trivial_expr&TestArrayExpressions.test_trivial_expr(  s]    
 %%'""2#6#6#<#<#D#D#K#K#%#3#3#9#9#A#A#H#H+/ 	# 	1r'   c                    V P                  4       pV P                  VP                  P                  P                  P
                  VP                  P                  P                  P
                  4       R# )z
Using the polynomial root function, ensure the full expression is
being put in the same kernel with no remnants of intermediate
array expressions.
N)r   r   r   r   r   r   r   r   s   & r%   test_complicated_expr*TestArrayExpressions.test_complicated_expr2  sV     %%'""2#6#6#<#<#D#D#K#K#%#3#3#9#9#A#A#H#H	Jr'   c           
       a  S P                  V4      pVP                  P                  P                  P                  pVP
                  P                  P                  P                  pS P                  \        V4      \        V4      4       S P                  \        V^ ,          P                  4      \        V^ ,          P                  4      4       S P                  \        \        S P                  V^ ,          P                  4      4      4      ^ 4       \        S P                  V^ ,          P                  4      4      pS P                  \        V4      ^4       \        V 3R lV 4       4      p\        VRR VR,          4       F@  w  rxVP                  V4      p	V	'       g   K   S P                  RP                  V	4      4       KB  	  R# )zX
Attempt to verify that rewriting will incorporate user common
subexpressions properly.
c              3   |   <"   T F1  pSP                  VP                  P                  4      ^,          x  K3  	  R# 5i)   N)r   r   r   ).0r   r   s   & r%   	<genexpr>BTestArrayExpressions.test_common_subexpressions.<locals>.<genexpr>O  s5      :'8e 11%++2B2BCAFF'8s   9<N:r  NNz9Common subexpressions detected in array expressions ({0}))r   r   r   r   r   r   r   r   r   r   r   r   zipintersectionfailr   )
r   r   r   r   r   array_expr_instrs
array_sets
expr_set_0
expr_set_1intersectionss
   f&        r%   test_common_subexpressions/TestArrayExpressions.test_common_subexpressions<  s]   
 %%b)!!''//66$$,,33S3s8,3s1v{{+SQ-=>T$"7"7A"DEFJ
 !!6!6s1v{{!CD30115  :'8: :
&)*Sb/:b>&J"J&33J?M}		 ..4f].CE 'Kr'   c                ,    V P                  \        4      # r   )r  rI   )r   s   &r%   test_complex_subexpression/TestArrayExpressions.test_complex_subexpressionW  s    ../GHHr'   c                x   \         P                  P                  ^
4      p\         P                  P                  ^
4      pW3 Uu. uF  p\        V4      NK  	  pp\        P                  P
                  p\        P                  VVP                  VP                  R7      pVP                  \        4      pVP                  p\        P                  VVP                  VP                  R7      p	V	P                  \        4      p
V
P                  p\        W4      pV! W4      pV! W4      p\         P                  P                  W4       \         P                  P                  W4       V P!                  VP"                  P$                  P&                  V	P"                  P$                  P&                  4       R# u upi )zV
Verify that ufunc and DUFunc calls are being properly included in
array expressions.
)ry   rz   N)rL   r   r   rN   _dispatchertargetdescrru   r   ry   rz   r   rR   r   r   r   r   r   r   r   r   )r   r   r   r   r   
vaxy_descrr   r   nb_call_stuff_0r   r   nb_call_stuff_1r   r   r   s   &              r%   test_ufunc_and_dufunc_calls0TestArrayExpressions.test_ufunc_and_dufunc_callsZ  sf   
 IIR IIR +,&1&36#;&1%%11
);;%44%44 < 6 "//
; ,,&22%44%44 3 6 ,,Z8 ,,a#!!' &


,,X?


,,X>""#3#9#9#A#A#H#H#0#6#6#>#>#E#E	G/ 2s   F7c                    V P                  \        4      pV P                  VP                  P                  P
                  P                  VP                  P                  P
                  P                  4       R# )zA
Verify that comparison operators are supported by the rewriter.
N)r   rV   r   r   r   r   r   r   r   s   & r%   test_cmp_op TestArrayExpressions.test_cmp_op{  sY     %%&9:""2#6#6#<#<#D#D#K#K#%#3#3#9#9#A#A#H#H	Jr'   c                    V P                  \        4      pV P                  VP                  P                  P
                  P                  VP                  P                  P
                  P                  4       R# )zA
Check that ufunc calls with explicit outputs are not rewritten.
N)r   r`   r   r   r   r   r   r   r   s   & r%   test_explicit_output)TestArrayExpressions.test_explicit_output  sX     00A 3 3 9 9 A A H H " 0 0 6 6 > > E E	Gr'   r(   r   )F)r)   r*   r+   r,   r   r   r   r   rA   r   r[   r   r   r   r   r   r  r  rG   r  r  r   r#  r&  r-   r.   r   s   @r%   r   r   v   sz     J=@$#$ &. #0 &* #$#.8D$41J -D E6IGBJG Gr'   r   c                   J   a  ] tR tRt o R tR tR tR tR tR t	R t
R	tV tR
# )TestRewriteIssuesi  c                   a ^ RI Hp ^ RIpV! RR7      R 4       oV! RR7      V3R l4       pVP                  ! ^
4      pV! V4      w  rVV P	                  WV4       V P	                  WT4       R# )r   )jitNT)nopythonc                     V # r   r(   )arrs   &r%   foo.TestRewriteIssues.test_issue_1184.<locals>.foo  s    Jr'   c                 *   < S! V 4      pS! V 4      pW3# r   r(   )r.  rb   rc   r/  s   &  r%   bar.TestRewriteIssues.test_issue_1184.<locals>.bar  s    CACA4Kr'   )numbar+  numpyr   assertIs)r   r+  rL   r2  r.  out_cout_dr/  s   &      @r%   test_issue_1184!TestRewriteIssues.test_issue_1184  sk    	d		 
	 
d		 
	
 iim3xe#e!r'   c                "   ^dp\         P                  P                  V^,          R7      P                  V^34      p\	        V4      p\        \        4      ! V4      p\         P                  P                  W44       \        P                  ! 4        R# )d   )sizeN)
rL   r   uniformreshapers   r   r   r   gccollect)r   nr4   r   r   s   &    r%   test_issue_1264!TestRewriteIssues.test_issue_1264  se    II1Q3'//16"1%o&q)


,,X>


r'   c                   ^ RI Hp VR 4       p\        P                  P	                  ^
4      p\        P                  P	                  ^
4      pVP                  W44      pV! W44      p\        P                  P                  We4       R# )z*Test array expression with duplicated term)r   c                 L    \         P                  ! V4      pW,           V ,           # r   )rL   rO   r3   r^   s   &&r%   r/  .TestRewriteIssues.test_issue_1372.<locals>.foo  s    q	A519r'   N)r4  r   rL   r   r>  py_funcr   assert_allclose)r   r   r/  r3   r^   expectgots   &      r%   test_issue_1372!TestRewriteIssues.test_issue_1372  sj    		 
	 IIb!IIb!Q"!i


""3/r'   c                    \         R 4       pRp\        P                  ! ^
\        P                  R7      pVP	                  W24      pV! W24      pV P                  WT4       R# )z@
Typing of unary array expression (np.negate) can be incorrect.
c                 "    W,
          V ) ,           # r   r(   rG  s   &&r%   r/  3TestRewriteIssues.test_unary_arrayexpr.<locals>.foo  s    5A2:r'   g      ?rg   N)r   rL   r   int32rI  r   )r   r/  r^   r3   rK  rL  s   &     r%   test_unary_arrayexpr&TestRewriteIssues.test_unary_arrayexpr  sV     
	 
	 IIb)Q"!i,r'   c                    \         R 4       p\        P                  ! . RO4      p\        P                  ! . RO4      pVP                  W#4      pV! W#4      pV P	                  WT4       R# )zL
Typing of bitwise boolean array expression can be incorrect
(issue #1813).
c                     W( ,          ( # r   r(   rG  s   &&r%   r/  5TestRewriteIssues.test_bitwise_arrayexpr.<locals>.foo  s    "X;r'   N)TTFF)FTFT)r   rL   arrayrI  r   )r   r/  r3   r^   rK  rL  s   &     r%   test_bitwise_arrayexpr(TestRewriteIssues.test_bitwise_arrayexpr  s[    
 
	 
	 HH/0HH/0Q"!i,r'   c                   \        \        4      p\        P                  ! ^ ^^
4      pV! W"W"4       \	        4       pVP                  V4       VP                  4       pV P                  RV4       V P                  RV4       R# )zW
Type annotation of array expressions with disambiguated
variable names (issue #1466).
z
#   u.1 = z
#   u.2 = N)r   re   rL   r   r   inspect_typesgetvalueassertIn)r   cfuncr3   bufress   &    r%   test_annotations"TestRewriteIssues.test_annotations  sg    
 ()KK1b!aAjC llnlC(lC(r'   c                    \         R  4       pV! ^4      pVP                  ^4      p\        P                  P	                  W#4       R# )c                     \         P                  ! V 4      p\        ^4       F  pW,          pVP                  4       pK  	  V# rT   )rL   onesrl   copy)r4   r.  r   vals   &   r%   f;TestRewriteIssues.test_issue_5599_name_collision.<locals>.f  s6    ''!*C1Xyhhj  Jr'   N)r   rI  rL   r   r   )r   ri  rL  rK  s   &   r%   test_issue_5599_name_collision0TestRewriteIssues.test_issue_5599_name_collision  s>    		 
	 d1


%%c2r'   r(   N)r)   r*   r+   r,   r9  rC  rM  rS  rY  rb  rk  r-   r.   r   s   @r%   r)  r)    s-     "&0-- ) 3 3r'   r)  c                   &   a  ] tR tRt o R tRtV tR# )TestSemanticsi  c                *   \         p\        V4      p\        P                  ! R R\	        R4      .4      p\        P                  ! . RO4      p\        P
                  ! V4      pV! W4V4      pV! W4V4      p\        P                  P                  Wg4       R# )        rK   infN)rp  rp  rK   )rX   r   rL   rk   float	ones_liker   r   )r   pyfuncr_  r3   r^   rb   rK  rL  s   &       r%   test_division_by_zero#TestSemantics.test_division_by_zero  sn     VJJS%,/0JJ'LLOaA!n


%%f2r'   r(   N)r)   r*   r+   r,   ru  r-   r.   r   s   @r%   rn  rn    s     3 3r'   rn  c                   0   a  ] tR tRt o RtR tR tRtV tR# )TestOptionalsi	  z`Tests the arrival and correct lowering of Optional types at a arrayexpr
derived ufunc, see #3972c                  a \         R  4       o\         V3R l4       p\        P                  ! ^4      R3pV! V!  pVP                  ! V!  p\        P                  P                  W44       SP                  pV^ ,          ^,          pV P                  \        V\        P                  4      4       V P                  \        VP                  \        P                  4      4       R# )c                     W,           # r   r(   r4   r5   s   &&r%   arr_expr9TestOptionals.test_optional_scalar_type.<locals>.arr_expr  	    5Lr'   c                 ,   < V^ 8  d   RpMTpS! W4      # r   Nr(   r4   r5   zr|  s   && r%   do_call8TestOptionals.test_optional_scalar_type.<locals>.do_call      1uA>!r'   Ng333333)r   rL   r   rI  r   rJ  
signatures
assertTruer   r   OptionaltypeFloatr   r  r|   ra  r   r"   otyr|  s   &      @r%   test_optional_scalar_type'TestOptionals.test_optional_scalar_type  s    		 
	 
	" 
	" 		!d# tn??D)


""31 d1g
378
388U[[9:r'   c                j  a \         R  4       o\         V3R l4       p\        P                  ! ^4      \        P                  ! R4      3pV! V!  pVP                  ! V!  p\        P                  P                  W44       SP                  pV^ ,          ^,          pV P                  \        V\        P                  4      4       V P                  \        VP                  \        P                  4      4       V P                  \        VP                  P                  \        P                  4      4       R# )c                     W,           # r   r(   r{  s   &&r%   r|  8TestOptionals.test_optional_array_type.<locals>.arr_expr*  r~  r'   c                 :   < V^ ,          ^ 8  d   RpMTpS! W4      # r  r(   r  s   && r%   r  7TestOptionals.test_optional_array_type.<locals>.do_call.  "    taxA>!r'         @N)r   rL   r   rI  r   rJ  r  r  r   r   r  r  Arrayrh   r  r  s   &      @r%   test_optional_array_type&TestOptionals.test_optional_array_type(  s    		 
	 
	" 
	" 		!biim, tn??D)


""31 d1g
378
388U[[9:
388>>5;;?@r'   r(   N)	r)   r*   r+   r,   __doc__r  r  r-   r.   r   s   @r%   rx  rx  	  s      ;6A Ar'   rx  c                   ,   a  ] tR tRt o R tR tRtV tR# )TestOptionalsExceptionsiE  c                F  a V P                  4        \        R  4       o\        V3R l4       p\        P                  ! ^4      R3pV P	                  \
        4      ;_uu_ 4       pV! V!   RRR4       V P                  R\        XP                  4      4       SP                  pV^ ,          ^,          pV P                  \        V\        P                  4      4       V P                  \        VP                  \        P                  4      4       R#   + '       g   i     L; i)c                     W,           # r   r(   r{  s   &&r%   r|  UTestOptionalsExceptions.test_optional_scalar_type_exception_on_none.<locals>.arr_exprL  r~  r'   c                 ,   < V^ 8  d   RpMTpS! W4      # r  r(   r  s   && r%   r  TTestOptionalsExceptions.test_optional_scalar_type_exception_on_none.<locals>.do_callP  r  r'   rK   Nzexpected float64, got None)disable_leak_checkr   rL   r   assertRaises	TypeErrorr^  str	exceptionr  r  r   r   r  r  r  )r   r  r|   raisesr"   r  r|  s   &     @r%   +test_optional_scalar_type_exception_on_noneCTestOptionalsExceptions.test_optional_scalar_type_exception_on_noneH  s    !		 
	 
	" 
	" 		!c" y))VTN * 	2C8H8H4IJ d1g
378
388U[[9: *)s   "DD 	c                  a V P                  4        \        R  4       o\        V3R l4       p\        P                  ! ^4      \        P                  ! RR4      3pV P	                  \
        4      ;_uu_ 4       pV! V!   RRR4       \        XP                  4      pV P                  RV4       V P                  RV4       SP                  pV^ ,          ^,          pV P                  \        V\        P                  4      4       V P                  \        VP                  \        P                  4      4       V P                  \        VP                  P                   \        P"                  4      4       R#   + '       g   i     EL; i)c                     W,           # r   r(   r{  s   &&r%   r|  TTestOptionalsExceptions.test_optional_array_type_exception_on_none.<locals>.arr_exprj  r~  r'   c                 :   < V^ ,          ^ 8  d   RpMTpS! W4      # r  r(   r  s   && r%   r  STestOptionalsExceptions.test_optional_array_type_exception_on_none.<locals>.do_calln  r  r'   rK   r  Nzexpected array(float64,zgot None)r  r   rL   r   r  r  r  r  r^  r  r  r   r   r  r  r  rh   r  )r   r  r|   r  excstrr"   r  r|  s   &      @r%   *test_optional_array_type_exception_on_noneBTestOptionalsExceptions.test_optional_array_type_exception_on_nonef  s   !		 
	 
	" 
	" 		!biiB/0 y))VTN * V%%&/8j&) d1g
378
388U[[9:
388>>5;;?@ *))s   7E66F	r(   N)r)   r*   r+   r,   r  r  r-   r.   r   s   @r%   r  r  E  s     ;<A Ar'   r  c                   T   a  ] tR tRt o Rt]P                  ! R4      tR tR t	Rt
V tR# )TestExternalTypesi  zETests RewriteArrayExprs with external (user defined) types,
see #5157z
        from numba.core import types

        class FooType(types.Type):
            def __init__(self):
                super(FooType, self).__init__(name='Foo')
        c                8  a  ! R  R\         4      p\        S4       ! R R\        P                  4      4       p\	        SRR4       \        V4      V3R l4       p\        V\        P                  4      R 4       p\        P                  ! V4      V3R l4       pVS3# )c                   &   a  ] tR tRt o R tRtV tR# ),TestExternalTypes.make_foo_type.<locals>.Fooi  c                    Wn         R # r   r   )r   r   s   &&r%   __init__5TestExternalTypes.make_foo_type.<locals>.Foo.__init__  s    "
r'   r  Nr)   r*   r+   r,   r  r-   r.   r   s   @r%   Foor    s     # #r'   r  c                   &   a  ] tR tRt o R tRtV tR# )1TestExternalTypes.make_foo_type.<locals>.FooModeli  c                l    R \         P                  3.p\        P                  P	                  WW#4       R# )r   N)r   intpr   StructModelr  )r   dmmfe_typememberss   &&& r%   r  :TestExternalTypes.make_foo_type.<locals>.FooModel.__init__  s)    #UZZ01""++DwHr'   r(   Nr  r   s   @r%   FooModelr    s     I Ir'   r  r   c                    < V3R  lpV# )c                    < S! 4       # r   r(   )r   FooTypes   &r%   typer@TestExternalTypes.make_foo_type.<locals>.type_foo.<locals>.typer  s    y r'   r(   )contextr  r  s   & r%   type_foo1TestExternalTypes.make_foo_type.<locals>.type_foo  s    ! Lr'   c                     VP                   pVw  p\        P                  ! V4      ! W4      pWVn        VP	                  4       # r   )r}   r   create_struct_proxyr   	_getvalue)r  buildersigr|   typr   r/  s   &&&&   r%   impl_foo1TestExternalTypes.make_foo_type.<locals>.impl_foo  s8    //CGU--c27DCI==?"r'   c                    < S! 4       # r   r(   )rh  rb   r  s   &&r%   
typeof_foo3TestExternalTypes.make_foo_type.<locals>.typeof_foo  s    9r'   )objectr   r   r  r   r   r   r   r  r   register)r   r  r  r  r  r  r  s   &f     r%   make_foo_typeTestExternalTypes.make_foo_type  s    	#& 	# 
	 	Iv)) 	I 
!	I
 	w9	s		 
	 
sEJJ	'	# 
(	# 
		c	"	 
#	 G|r'   c           	     J  aa \        V P                  4      ;_uu_ 4       pV P                  VP                  4      w  oo\	        \
        P                  4      V3R  l4       p\	        \
        P                  4      V3R l4       p\	        \
        P                  4      V3R l4       p\        V3R l4       p\        V3R l4       p\        V3R l4       p\        P                  P                  V! ^ ^4      \        P                  ! ^ ^.4      4       \        P                  P                  V! ^^4      \        P                  ! ^^.4      4       \        P                  P                  V! ^4      \        P                  ! R.4      4       RRR4       R#   + '       g   i     R# ; i)c                 z   < \        V S4      '       d(   \        V\        P                  4      '       d   R  pV# R# R# )c                 T    \         P                  ! V P                  V^ ,          .4      # )r   rL   rX  r   lhsrhss   &&r%   impKTestExternalTypes.test_external_type.<locals>.overload_foo_add.<locals>.imp  s    !xxCF(;<<r'   N)r   r   r  r  r  r  r  s   && r%   overload_foo_add>TestExternalTypes.test_external_type.<locals>.overload_foo_add  s5    c7++
30L0L= J	 1M+r'   c                 ^   < \        V S4      '       d   \        VS4      '       d   R  pV# R# R# )c                 Z    \         P                  ! V P                  VP                  .4      # r   r  r  s   &&r%   r  r    s    !xxCII(>??r'   Nr   r  s   && r%   r  r    s2    c7++
30H0H@ J	 1I+r'   c                 6   < \        V S4      '       d   R  pV# R# )c                 F    \         P                  ! V P                  ) .4      # r   r  )r4   s   &r%   r  KTestExternalTypes.test_external_type.<locals>.overload_foo_neg.<locals>.imp  s    !xx!''
33r'   Nr  )r4   r  r  s   & r%   overload_foo_neg>TestExternalTypes.test_external_type.<locals>.overload_foo_neg  s!    a))4 J	 *r'   c                 L   < S! V 4      \         P                  ! V.4      ,           # r   )rL   rX  r4   r5   r  s   &&r%   arr_expr_sum1;TestExternalTypes.test_external_type.<locals>.arr_expr_sum1  s    1v!--r'   c                 .   < S! V 4      S! V4      ,           # r   r(   r  s   &&r%   arr_expr_sum2;TestExternalTypes.test_external_type.<locals>.arr_expr_sum2  s    1vA&r'   c                    < S! V 4      ) # r   r(   )r4   r  s   &r%   arr_expr_neg:TestExternalTypes.test_external_type.<locals>.arr_expr_neg  s    Awr'   N)r   source_linesr  r  r   operatorr]   negr   rL   r   r   rX  )	r   test_moduler  r  r  r  r  r  r  s	   &      @@r%   test_external_type$TestExternalTypes.test_external_type  sG    1 122k--k.A.ABLC hll# $ hll# $ hll# $ . . ' '   JJ))-1*=rxxA?OPJJ))-1*=rxxA?OPJJ)),q/288RD>J_ 3222s   E'FF"	r(   N)r)   r*   r+   r,   r  textwrapdedentr  r  r   r-   r.   r   s   @r%   r  r    s1      ?? $ L D0K 0Kr'   r  __main__)>r@  ior   r5  rL   r4  r   r   r   
numba.corer   r   r	   r
   r   r   r   numba.core.compilerr   r   numba.core.registryr   numba.tests.supportr   r   r   r   numba.extendingr   r   r   r   r   r   r   r  r  unittestdictr   r6   r9   rA   rG   rI   rN   rR   rV   rX   r[   r`   re   rs   ru   r   r)  rn  rx  r  r  r)   mainr(   r'   r%   <module>r     sD   	   !  G G G / *5 5     F FF.. ~1'	QX Q6SG?H SGli3 i3X3OX%6%6 3"9AOX%6%6 9Ax@Aox/@/@ @AF^K):): ^KB zMMO r'   