U
    ,d	                     @   s   d Z ddlZddlmZ ddlmZ ddlmZm	Z	 ddl
mZmZ ddlmZ ddlmZ dd	lmZmZ dddZeejddejfddZdS )z;
Implementation of method overloads for Generator objects.
    N)types)overload_method)as_dtype
from_dtype)
next_floatnext_double)is_nonelike)TypingError)TupleUniTuple	the givenc                 C   s   t |tjr|j}t |tjs6t|}t|}|}n|}t|}t|}|tj	kr\| }n&|tj
krl|}ntd| d| d||fS )a  
        Most of the standard NumPy distributions that accept dtype argument
        only support either np.float32 or np.float64 as dtypes.

        This is a helper function that helps Numba select the proper underlying
        implementation according to provided dtype.
    zUnsupported dtype z for z distribution)
isinstancer   OmittedvalueTypenpdtyper   r   Zfloat32float64r	   )Zfunc_32Zfunc_64r   	dist_namedtnb_dtZnp_dtZ	next_func r   E/tmp/pip-unpacked-wheel-eu7e0c37/numba/np/random/generator_methods.py_get_proper_func   s"    



r   randomc                    s   t tt|d\ t|tjr$|j}t|rFd tj	f fdd	}|S t
t|to^t|jtjt|top|jdkt|tjgstdd tj	f fdd	}|S d S )Nr   c                    s    | j S )N)bit_generator)instsizer   	dist_funcr   r   r   impl9   s    z-NumPyRandomGeneratorType_random.<locals>.implr   zOSize argument either of None, an integer, an empty tuple or a tuple of integersc                    s0   t j||d}t |D ]} | j||< q|S )N)r   )r   emptyZndindexr   )r   r   r   outi)r   r   r   r    D   s    )r   r   r   r   r   r   r   r   r   r   anyr   r   ZIntegerr
   countAssertionError)r   r   r   r    r   r   r   NumPyRandomGeneratorType_random1   s$     
r'   )r   )__doc__Znumpyr   Z
numba.corer   Znumba.core.extendingr   Znumba.np.numpy_supportr   r   Znumba.np.random.generator_corer   r   r   Znumba.core.errorsr	   Znumba.core.types.containersr
   r   r   ZNumPyRandomGeneratorTyper   r'   r   r   r   r   <module>   s   
"
