
    J/Ph'                         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                     dS dS )
    N)contextmanager)jit	vectorizeguvectorize)NumbaDeprecationWarningNumbaPendingDeprecationWarningNumbaWarning)TestCaseneeds_setuptoolsc               #      K   t          j        d          5 } t          j        dt                     t          j        dt                     | V  d d d            d S # 1 swxY w Y   d S )NTrecordignorecategoryalways)warningscatch_warningssimplefilterr	   r   )ws    ]/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/tests/test_deprecations.py!_catch_numba_deprecation_warningsr      s      		 	-	-	- h>>>>h1HIIII                 s   ;A  A$'A$c                   6   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dS )TestDeprecationTc                 N   |                      t          |          d           |                      |d         j        |           |                     |t	          |d         j                             |r0|                     dt	          |d         j                             d S d S )N   r   https://numba.readthedocs.io)assertEquallenr   assertInstrmessage)selfr   expected_strr   	check_rtds        r   check_warningzTestDeprecation.check_warning   s    X***!-x888lC(;$<$<=== 	4MM8hqk1224 4 4 4 4	4 	4    c                     t                      5 }t          d          d             } |             d}|                     ||t          d           d d d            d S # 1 swxY w Y   d S )NFnopythonc                      d S 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   s     /00 		QA%     !  CEEEFCq#'>%PPP		Q 		Q 		Q 		Q 		Q 		Q 		Q 		Q 		Q 		Q 		Q 		Q 		Q 		Q 		Q 		Q 		Q 		Qs   AA  A$'A$c                     t                      5 }t          d          d             }d d d            n# 1 swxY w Y   |                     |           d S )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,   s    
 /00 	A)**  +*	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   488c                     t                      5 }t          dd          d             }d d d            n# 1 swxY w Y   d}|                     ||t          d           d S )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   s    
 /00 	A)E:::  ;:	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 C1c#:eLLLLL   6::c                     t                      5 }t          dd          d             }d d d            n# 1 swxY w Y   |                     |           d S )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   s     /00 	A)D999  :9	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	rC   c                     t                      5 }t          ddd          d             }d d d            n# 1 swxY w Y   d}|                     ||t          d           d S )Nr5   TF)rF   r*   c                 (    t                       | dz   S r7   rH   r8   s    r   r.   zTTestDeprecation.test_vectorize_objmode_compilation_nopython_false_warns.<locals>.foo[   rJ   r'   r/   r0   rA   r1   s       r   7test_vectorize_objmode_compilation_nopython_false_warnszGTestDeprecation.test_vectorize_objmode_compilation_nopython_false_warnsT   s    
 /00 	A)D5III  JI	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 C1c#:eLLLLL   7;;c                     t                      5 }t          dd          d             }d d d            n# 1 swxY w Y   |                     |           d S )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   s    
 /00 	A)*===  >=	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 	rC   c                     t                      5 }t          ddd          d             }d d d            n# 1 swxY w Y   |                     |           d S )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   s     /00 	A)*tLLL  ML	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 	rO   c                     t                      5 }t          ddd          d             }d d d            n# 1 swxY w Y   d}|                     ||t          d           d S )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   s     /00 	A)*uMMM  NM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 C1c#:eLLLLLrO   c                     t                      5 }t          dd          fd            }d d d d            n# 1 swxY w Y   |                     |           d S )Nr5   TrE   c                       | dz             S r7   r-   )rV   bars    r   r.   zZTestDeprecation.test_vectorize_calling_jit_with_nopython_false_warns_from_jit.<locals>.foo   s    s1q5zz!r'   c                      d S r,   r-   )argss    r   ra   zZTestDeprecation.test_vectorize_calling_jit_with_nopython_false_warns_from_jit.<locals>.bar   s    r'   r;   )r#   r   r.   ra   s      @r   =test_vectorize_calling_jit_with_nopython_false_warns_from_jitzMTestDeprecation.test_vectorize_calling_jit_with_nopython_false_warns_from_jit   s     /00 	A)D999" " " " :9"  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s    <A A c                     t                      5 }t          dd          d             }d d d            n# 1 swxY w Y   |                     |           d S )N void(float64[::1], float64[::1])(n)->(n)c                     | dz  } d S r7   r-   r9   bs     r   ra   zKTestDeprecation.test_guvectorize_implicit_nopython_no_warnings.<locals>.bar   s    Qr'   r   r   r<   r#   r   ra   s      r   .test_guvectorize_implicit_nopython_no_warningsz>TestDeprecation.test_guvectorize_implicit_nopython_no_warnings   s     /00 	A;ZHH  IH	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   599c                     t                      5 }t          ddd          d             }d d d            n# 1 swxY w Y   |                     |           d S )Nrf   rg   TrE   c                 ,    t                       | dz  } d S r7   rH   ri   s     r   ra   zBTestDeprecation.test_guvectorize_forceobj_no_warnings.<locals>.bar        Qr'   rk   rl   s      r   %test_guvectorize_forceobj_no_warningsz5TestDeprecation.test_guvectorize_forceobj_no_warnings   s     /00 	A;Z"&( ( ( ( (		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	rO   c                     t                      5 }t          ddd          d             }d d d            n# 1 swxY w Y   |                     |           d S )Nrf   rg   rQ   rR   c                     | dz  } d S r7   r-   ri   s     r   ra   zTTestDeprecation.test_guvectorize_parallel_implicit_nopython_no_warnings.<locals>.bar   s     Qr'   rk   rl   s      r   7test_guvectorize_parallel_implicit_nopython_no_warningszGTestDeprecation.test_guvectorize_parallel_implicit_nopython_no_warnings   s     /00 	A;Z *, , , , ,		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	rO   c                     t                      5 }t          dddd          d             }d d d            n# 1 swxY w Y   |                     |           d S )Nrf   rg   rQ   T)rS   rF   c                 ,    t                       | dz  } d S r7   rH   ri   s     r   ra   zKTestDeprecation.test_guvectorize_parallel_forceobj_no_warnings.<locals>.bar   rp   r'   rk   rl   s      r   .test_guvectorize_parallel_forceobj_no_warningsz>TestDeprecation.test_guvectorize_parallel_forceobj_no_warnings   s     /00 	A ;Z *T; ; ; ; ;	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   8<<c                    d }d }||fD ]g}|j                             d          } t          |          dg          }t          j        d          5 }t          j        dt                     t          j        d	t                       t          d
          |          |           | 	                    t          |          d           | 	                    |d         j        t                     t          |d         j                  }d}|                     ||           d|z  }|                     ||           |                     d|           d d d            n# 1 swxY w Y   id S )Nc                 ,    |                      d          S r7   )appendr8   s    r   foo_listzFTestDeprecation.test_reflection_of_mutable_container.<locals>.foo_list   s    88A;;r'   c                 ,    |                      d          S r7   )addr8   s    r   foo_setzETestDeprecation.test_reflection_of_mutable_container.<locals>.foo_set   s    5588Or'   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$ 	H 	HA
((00I!$y//2&))C(555 H%hFFFF%h/MO O O O%"T"""1%%c***  Q+++  10NOOOqt|,,%c8,,,<yHc8,,,<hGGGH H H H H H H H H H H H H H H	H 	Hs   DE''E+	.E+	c                     t          j        d          5 }t          j        dt                     dd l}d}|                     ||t                     d d d            d S # 1 swxY w Y   d S )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   s    
 $D111 	PQ!(+IK K K KGLq,0NOOO	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	Ps   >A!!A%(A%c                     t          j        d          5 }t          j        dt                     ddlm} d}|                     ||t                     d d d            d S # 1 swxY w Y   d S )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   s    
 $D111 	PQ!(+IK K K K%%%%%%GLq,0NOOO	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	Ps   A A##A'*A'N)T)r   
__module____qualname__r&   r
   run_test_in_subprocessr3   r>   rB   rK   rN   rW   r[   r^   rd   rm   rq   rt   rw   r   r   r   r   r-   r'   r   r   r      sE       4 4 4 4 $Q Q %$Q $
 
 %$
 $M M %$M $
 
 %$
 $M M %$M $	 	 %$	 $  %$ $	M 	M %$	M $  %$" $	 	 %$	 $  %$ $
 
 %$
 $  %$ $H H %$H4 $	P 	P %$ 	P $	P 	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      s     % % % % % % - - - - - - - - - -M M M M M M M M M M : : : : : : : :   oP oP oP oP oPh oP oP oPd zHMOOOOO r'   