o
    i'                     @   s  d Z ddlZddlZddlmZmZmZ ddlm	Z	 ddl
mZ ddlmZmZ edddd	d
 Zdd Zeddddd Zeddddd Zedddd Zeddddd Zeddddd Zeddddd Zeddddd Zeddddd Zedddd d! Zedddd"d# Zedddd$d% Zedddd&d' ZeZedddd(d' ZeZd)d* Zed+Z ed,Z!ed-Z"ed.Z#e$d/Z%edddd0d1 Z&d2Z'e(d3ej)fd4ej*fgZ+ej(d3ej)fd4ej*fgdd5Z,ej-d6e+d7Z.e/e.j0D ]Z1e1d2 e.e1 d3< e1d8 e.e1 d4< qej2e.e,d7Z3edddd9d: Z4G d;d< d<eZ5edd=d>d? Z6edd=d@dA Z7edd=dBdC Z8dDdE Z9eddddFdGdH Z:dS )Iz
This file will be copied to a temporary directory in order to
exercise caching compiled Numba functions.

See test_dispatcher.py.
    N)jitgenerated_jitprange)typesc_sin)TestCasecaptured_stderrTcachenopythonc                 C   s   | S N xr   r   i/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/numba/tests/cache_usecases.pysimple_usecase      r   c                 C      t | S r   )r   r   r   r   r   simple_usecase_caller      r   c                 C      | | t  S r   Zr   yr   r   r   add_usecase      r   )r   Zforceobjc                 C   s   t   | | t S r   )objectr   r   r   r   r   add_objmode_usecase    s   r   )r   c                 C   r   r   r   r   r   r   r   add_nocache_usecase&   r   r    c                 C   s$   t | tjrdd }|S dd }|S )Nc                 S   s   | | S r   r   r   r   r   r   impl.   r   zgenerated_usecase.<locals>.implc                 S   s   | | S r   r   r   r   r   r   r!   1   r   )
isinstancer   Complex)r   r   r!   r   r   r   generated_usecase+   s
   r$   c                 C   r   r   r   r   r   r   r   inner6   r   r%   c                 C      t | | S r   r%   r   r   r   r   outer:   r   r(   Fc                 C   r&   r   r'   r   r   r   r   outer_uncached>   r   r)   c                 C   s$   t   d}t| D ]}|| }q	|S )Nr   )r   range)nresir   r   r   
loopliftedC   s
   
r.   c                 C   r   r   r   r   r   r   r   	use_c_sinL      r/   c                 C   r   r   )r/   r   r   r   r   use_c_sin_nest1P   r0   r1   c                 C   r   r   )r1   r   r   r   r   use_c_sin_nest2T   r0   r2   c                 C      | d S )N   r   r   r   r   r   ambiguous_functionY   r0   r5   c                 C   r3   )N   r   r   r   r   r   r5   _   r0   c                    s   t ddd fdd}|S )NTr
   c                    s    |  S r   r   )r   r   r   r   closureg   r0   zmake_closure.<locals>.closure)r   )r   r7   r   r   r   make_closuref   s   
r8            	   i@B c                   C   s   t S r   )biggier   r   r   r   use_big_arrayu   r   r>      ab)alignr4   )dtypeg     @E@c                 C   s   | | S r   r   )aryr-   r   r   r   record_return   r0   rE   c                   @   s   e Zd ZdZdd ZdS )_TestModulez
    Tests for functionality of this module's functions.
    Note this does not define any "test_*" method, instead check_module()
    should be called by hand.
    c                 C   s   |  |ddd |  |ddd |  |ddd |  |ddd |  |ddd ||jd}|  t|d ||j	d}|  t|d d S )Nr4   r9   r6   r?   )r4   g     E@)
ZassertPreciseEqualr   r   r)   r(   r$   rE   
packed_arrtuplealigned_arr)selfmodZ
packed_recZaligned_recr   r   r   check_module   s   z_TestModule.check_moduleN)__name__
__module____qualname____doc__rL   r   r   r   r   rF      s    rF   )r   c                 C   s   | |  S r   r   r   r   r   r   first_class_function_mul   r0   rQ   c                 C   s   | |  S r   r   r   r   r   r   first_class_function_add   r0   rR   c                 C   s   | |S r   r   )fr   r   r   r   first_class_function_usecase   r0   rT   c                  C   s   t jt } t |  d S r   )sysmodulesrM   rF   rL   )rK   r   r   r   	self_test   s   
rW   )Zparallelr   r   c                 C   s   | |  |  S r   r   )rD   r   r   r   parfor_usecase   r   rX   );rP   rU   numpynpZnumbar   r   r   Z
numba.corer   Znumba.tests.ctypes_usecasesr   Znumba.tests.supportr   r	   r   r   r   r   r    r$   r%   r(   r)   r.   r/   r1   r2   r5   Zrenamed_function1Zrenamed_function2r8   Zclosure1Zclosure2Zclosure3Zclosure4Zaranger=   r>   r   rC   Zint8Zfloat64Zpacked_record_typeZaligned_record_typeemptyrG   r*   sizer-   arrayrI   rE   rF   rQ   rR   rT   rW   rX   r   r   r   r   <module>   s    



































