
    xKg'                         d dl Z d dlZd dlmZ d dlmZmZmZ d dlm	Z	m
Z
mZ d dlmZmZ ed        Z G d de      Zed	k(  r ej$                          yy)
    N)contextmanager)jit	vectorizeguvectorize)NumbaDeprecationWarningNumbaPendingDeprecationWarningNumbaWarning)TestCaseneeds_setuptoolsc               #      K   t        j                  d      5 } t        j                  dt               t        j                  dt               |  d d d        y # 1 sw Y   y xY ww)NTrecordignorecategoryalways)warningscatch_warningssimplefilterr	   r   )ws    a/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/tests/test_deprecations.py!_catch_numba_deprecation_warningsr      sG     		 	 	-h>h1HI 
.	-	-s   A);A	A)A&"A)c                   h   e Zd ZddZej
                  d        Zej
                  d        Zej
                  d        Zej
                  d        Z	ej
                  d        Z
ej
                  d        Zej
                  d        Zej
                  d	        Zej
                  d
        Zej
                  d        Zej
                  d        Zej
                  d        Zej
                  d        Zej
                  d        Zeej
                  d               Zeej
                  d               Zy)TestDeprecationc                    | j                  t        |      d       | j                  |d   j                  |       | j                  |t	        |d   j
                               |r)| j                  dt	        |d   j
                               y y )N   r   https://numba.readthedocs.io)assertEquallenr   assertInstrmessage)selfr   expected_strr   	check_rtds        r   check_warningzTestDeprecation.check_warning   sv    X*!--x8lC(;(;$<=MM8hqk1124     c                     t               5 }t        d      d        } |        d}| j                  ||t        d       d d d        y # 1 sw Y   y xY w)NFnopythonc                       y N r-   r'   r   fooz?TestDeprecation.test_explicit_false_nopython_kwarg.<locals>.foo#   s    r'   2The keyword argument 'nopython=False' was suppliedr%   )r   r   r&   r   r#   r   r.   msgs       r   "test_explicit_false_nopython_kwargz2TestDeprecation.test_explicit_false_nopython_kwarg   sS     /0A%  ! EFCq#'>%P 100s   5A		Ac                     t               5 }t        d      d        }d d d        | j                         y # 1 sw Y   xY w)Nfloat64(float64)c                     | dz   S Nr   r-   as    r   r.   zOTestDeprecation.test_vectorize_missing_nopython_kwarg_not_reported.<locals>.foo3       1ur'   r   r   assertFalser#   r   r.   s      r   2test_vectorize_missing_nopython_kwarg_not_reportedzBTestDeprecation.test_vectorize_missing_nopython_kwarg_not_reported,   sB    
 /0A)* + 1 	 10s	   7A c                     t               5 }t        dd      d        }d d d        d}| j                  |t        d       y # 1 sw Y   %xY w)Nr5   Fr)   c                     | dz   S r7   r-   r8   s    r   r.   zFTestDeprecation.test_vectorize_nopython_false_is_reported.<locals>.foo@   r:   r'   r/   r0   r   r   r&   r   r1   s       r   )test_vectorize_nopython_false_is_reportedz9TestDeprecation.test_vectorize_nopython_false_is_reported9   sT    
 /0A)E: ; 1 C1c#:eL 10s   AAc                     t               5 }t        dd      d        }d d d        | j                         y # 1 sw Y   xY w)Nr5   Tforceobjc                      t                | dz   S r7   objectr8   s    r   r.   zRTestDeprecation.test_vectorize_objmode_direct_compilation_no_warnings.<locals>.fooM       1ur'   r;   r=   s      r   5test_vectorize_objmode_direct_compilation_no_warningszETestDeprecation.test_vectorize_objmode_direct_compilation_no_warningsG   sD     /0A)D9 : 1 	 10	   9Ac                     t               5 }t        ddd      d        }d d d        d}| j                  |t        d       y # 1 sw Y   %xY w)Nr5   TF)rE   r*   c                      t                | dz   S r7   rG   r8   s    r   r.   zTTestDeprecation.test_vectorize_objmode_compilation_nopython_false_warns.<locals>.foo[   rI   r'   r/   r0   rA   r1   s       r   7test_vectorize_objmode_compilation_nopython_false_warnszGTestDeprecation.test_vectorize_objmode_compilation_nopython_false_warnsT   sW    
 /0A)D5I J 1 C1c#:eL 10   AAc                     t               5 }t        dd      d        }d d d        | j                         y # 1 sw Y   xY w)Nr5   paralleltargetc                     | dz   S r7   r-   xs    r   r.   zETestDeprecation.test_vectorize_parallel_true_no_warnings.<locals>.fooi   r:   r'   r;   r=   s      r   (test_vectorize_parallel_true_no_warningsz8TestDeprecation.test_vectorize_parallel_true_no_warningsc   sD    
 /0A)*= > 1
 	 10rK   c                     t               5 }t        ddd      d        }d d d        | j                         y # 1 sw Y   xY w)Nr5   rQ   TrS   r*   c                     | dz   S r7   r-   rU   s    r   r.   zSTestDeprecation.test_vectorize_parallel_true_nopython_true_no_warnings.<locals>.foot   r:   r'   r;   r=   s      r   6test_vectorize_parallel_true_nopython_true_no_warningszFTestDeprecation.test_vectorize_parallel_true_nopython_true_no_warningso   sG     /0A)*tL M 1
 	 10	   :Ac                     t               5 }t        ddd      d        }d d d        d}| j                  |t        d       y # 1 sw Y   %xY w)Nr5   rQ   FrY   c                     | dz   S r7   r-   rU   s    r   r.   zNTestDeprecation.test_vectorize_parallel_true_nopython_false_warns.<locals>.foo   r:   r'   r/   r0   rA   r1   s       r   1test_vectorize_parallel_true_nopython_false_warnszATestDeprecation.test_vectorize_parallel_true_nopython_false_warnsz   sW     /0A)*uM N 1
 C1c#:eL 10rO   c                     t               5 }t        dd      fd       }d d d d        | j                         y # 1 sw Y   xY w)Nr5   TrD   c                      | dz         S r7   r-   )rV   bars    r   r.   zZTestDeprecation.test_vectorize_calling_jit_with_nopython_false_warns_from_jit.<locals>.foo   s    1q5z!r'   c                       y r,   r-   )argss    r   rb   zZTestDeprecation.test_vectorize_calling_jit_with_nopython_false_warns_from_jit.<locals>.bar   s    r'   r;   )r#   r   r.   rb   s      @r   =test_vectorize_calling_jit_with_nopython_false_warns_from_jitzMTestDeprecation.test_vectorize_calling_jit_with_nopython_false_warns_from_jit   sJ     /0A)D9" :" 1 	 10s	   ?Ac                     t               5 }t        dd      d        }d d d        | j                         y # 1 sw Y   xY w)N void(float64[::1], float64[::1])(n)->(n)c                     | dz  } y r7   r-   r9   bs     r   rb   zKTestDeprecation.test_guvectorize_implicit_nopython_no_warnings.<locals>.bar   s    Qr'   r   r   r<   r#   r   rb   s      r   .test_guvectorize_implicit_nopython_no_warningsz>TestDeprecation.test_guvectorize_implicit_nopython_no_warnings   sE     /0A;ZH I 1 	 10s	   8Ac                     t               5 }t        ddd      d        }d d d        | j                         y # 1 sw Y   xY w)Nrg   rh   TrD   c                 "    t                | dz  } y r7   rG   rj   s     r   rb   zBTestDeprecation.test_guvectorize_forceobj_no_warnings.<locals>.bar        Qr'   rl   rm   s      r   %test_guvectorize_forceobj_no_warningsz5TestDeprecation.test_guvectorize_forceobj_no_warnings   sI     /0A;Z"&((	 1 	 10r\   c                     t               5 }t        ddd      d        }d d d        | j                         y # 1 sw Y   xY w)Nrg   rh   rQ   rR   c                     | dz  } y r7   r-   rj   s     r   rb   zTTestDeprecation.test_guvectorize_parallel_implicit_nopython_no_warnings.<locals>.bar   s     Qr'   rl   rm   s      r   7test_guvectorize_parallel_implicit_nopython_no_warningszGTestDeprecation.test_guvectorize_parallel_implicit_nopython_no_warnings   sI     /0A;Z *,,	 1 	 10r\   c                     t               5 }t        dddd      d        }d d d        | j                         y # 1 sw Y   xY w)Nrg   rh   rQ   T)rS   rE   c                 "    t                | dz  } y r7   rG   rj   s     r   rb   zKTestDeprecation.test_guvectorize_parallel_forceobj_no_warnings.<locals>.bar   rq   r'   rl   rm   s      r   .test_guvectorize_parallel_forceobj_no_warningsz>TestDeprecation.test_guvectorize_parallel_forceobj_no_warnings   sM     /0A ;Z *T;; 1 	 10s	   ;Ac                    d }d }||fD ]0  }|j                   j                  d      } t        |      dg      }t        j                  d      5 }t        j
                  dt               t        j
                  d	t                 t        d
      |      |       | j                  t        |      d       | j                  |d   j                  t               t        |d   j                        }d}| j                  ||       d|z  }| j                  ||       | j                  d|       d d d        3 y # 1 sw Y   ?xY w)Nc                 $    | j                  d      S r7   )appendr8   s    r   foo_listzFTestDeprecation.test_reflection_of_mutable_container.<locals>.foo_list   s    88A;r'   c                 $    | j                  d      S r7   )addr8   s    r   foo_setzETestDeprecation.test_reflection_of_mutable_container.<locals>.foo_set   s    558Or'   foo_
   Tr   r   r   r   r)   r   r   z?Encountered the use of a type that is scheduled for deprecationz!'reflected %s' found for argumentr   )__name__stripevalr   r   r   r	   r   r   r   r   r   r!   r"   r    )	r#   r|   r   f	containerinpr   warn_msgr2   s	            r   $test_reflection_of_mutable_containerz4TestDeprecation.test_reflection_of_mutable_container   s   		 G$A

((0I!$y/2&)C((5%%hF%%h/MO%"T"1%c*  Q+  10NOqt||,%c8,<yHc8,<hG 65 % 65s   C"E  E
	c                     t        j                  d      5 }t        j                  dt               dd l}d}| j                  ||t               d d d        y # 1 sw Y   y xY w)NTr   r   r   r   )The 'pycc' module is pending deprecation.)r   r   r   r   
numba.pyccr&   )r#   r   numbar$   s       r   test_pycc_modulez TestDeprecation.test_pycc_module   sO    
 $$D1Q!!(+IKGLq,0NO 211s   9AA"c                     t        j                  d      5 }t        j                  dt               ddlm} d}| j                  ||t               d d d        y # 1 sw Y   y xY w)NTr   r   r   r   )CCr   )r   r   r   r   r   r   r&   )r#   r   r   r$   s       r   test_pycc_CCzTestDeprecation.test_pycc_CC   sO    
 $$D1Q!!(+IK%GLq,0NO 211s   ;AA$N)T)r   
__module____qualname__r&   r
   run_test_in_subprocessr3   r>   rB   rJ   rN   rW   r[   r_   re   rn   rr   ru   rx   r   r   r   r   r-   r'   r   r   r      s   4 $$Q %Q $$
 %
 $$M %M $$
 %
 $$M %M $$	 %	 $$ % $$	M %	M $$ %" $$	 %	 $$ % $$
 %
 $$ % $$H %H4 $$	P % 	P $$	P % 	Pr'   r   __main__)r   unittest
contextlibr   r   r   r   r   numba.core.errorsr   r   r	   numba.tests.supportr
   r   r   r   r   mainr-   r'   r   <module>r      sb      % - -M M :  oPh oPd zHMMO r'   