o
    1&i                     @   s  d Z ddlZddlmZ ddlmZ eejejfdd Zedd Zed	d
dd Z	ed	d
dd Z
dd ZdZddlmZ dd Zed	d
dd Zed	ddd ZddlZddlmZ ed	d
dd Zdd Zdd Zd d! Zed	d
Zed	dZdS )"z_
Separate module with function samples for serialization tests,
to avoid issues with __main__.
    Njit)typesc                 C      | | S N abr   r   IC:\wamp64\www\opt\env\Lib\site-packages\numba/tests/serialize_usecases.pyadd_with_sig      r   c                 C   r   r   r   r   r   r   r   add_without_sig   r   r   TZnopythonc                 C   r   r   r   r   r   r   r   add_nopython   r   r   c                 C   s   t   | | S r   )objectr   r   r   r   add_nopython_fail   s   r   c                       t dd fdd}|S )NTr   c                    s    |  | S r   r   )r
   cr	   r   r   inner      zclosure.<locals>.innerr   )r	   r   r   r   r   closure      r   g      @)sqrtc                    s   t di | fdd}|S )Nc                    s"   t ttd }t | t| S )N   )maxKmathhypotr   )ykxr   r   r   (   s   z#closure_with_globals.<locals>.innerr   r   )r#   jit_argsr   r   r"   r   closure_with_globals'   s   r%   c                 C   s   t | |S r   r   r   )r#   r    r   r   r   other_function1   r   r'   )Zforceobjc                 C   s   t |  S r   )r   r"   r   r   r   get_global_objmode5   r   r(   c                 C   s   t d t| t  fS )N*   )nprandseednpcosrandomr"   r   r   r   get_renamed_module<   s   
r/   c                    r   )NTr   c                    s   t  | | S r   )r'   )r    zr"   r   r   r   C   s   z-closure_calling_other_function.<locals>.innerr   r#   r   r   r"   r   closure_calling_other_functionB   r   r2   c                    s2   t ddfdd t dd fdd}|S )NTr   c                    s   t  | S r   r&   r    r"   r   r   other_innerI   r   z2closure_calling_other_closure.<locals>.other_innerc                    s    |  S r   r   r3   r4   r#   r   r   r   M   r   z,closure_calling_other_closure.<locals>.innerr   r1   r   r5   r   closure_calling_other_closureH   s
   r6   c                  K   s,   d}i }t | | tdi | |d S )Nz
        def dyn_func(x):
            res = 0
            for i in range(x):
                res += x
            return res
        dyn_funcr   )execstripr   )r$   codensr   r   r   _get_dyn_funcT   s   r<   )__doc__r   Znumbar   Z
numba.corer   Zint32r   r   r   r   r   r   r   r%   r'   r(   numpyr,   Znumpy.randomr.   r*   r/   r2   r6   r<   r7   Zdyn_func_objmoder   r   r   r   <module>   s:    








