a
    LªfÛ
  ã                   @  s¤   d dl mZ ddlmZ ddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZ ddlmZ dd	lmZ ee	e
eed
œZdddœdd„Zdefdd„Zdefdd„ZdS )é    )Úannotationsé   )ÚBitGenerator)ÚRandomState)ÚPhilox)ÚPCG64Ú	PCG64DXSM)ÚSFC64)Ú	Generator)ÚMT19937)r   r   r   r   r	   r   zstr | type[BitGenerator])Úbit_generatorc                 C  s8   t | tƒr| }n"| tv r"t|  }ntt| ƒd ƒ‚|ƒ S )a(  
    Pickling helper function that returns a bit generator object

    Parameters
    ----------
    bit_generator : type[BitGenerator] or str
        BitGenerator class or string containing the name of the BitGenerator

    Returns
    -------
    BitGenerator
        BitGenerator instance
    z$ is not a known BitGenerator module.)Ú
isinstanceÚtypeÚBitGeneratorsÚ
ValueErrorÚstr)r   Zbit_gen_class© r   úM/var/www/ai-form-bot/venv/lib/python3.9/site-packages/numpy/random/_pickle.pyÚ__bit_generator_ctor   s    


ÿr   c                 C  s   t | tƒrt| ƒS t|| ƒƒS )aó  
    Pickling helper function that returns a Generator object

    Parameters
    ----------
    bit_generator_name : str or BitGenerator
        String containing the core BitGenerator's name or a
        BitGenerator instance
    bit_generator_ctor : callable, optional
        Callable function that takes bit_generator_name as its only argument
        and returns an instantized bit generator.

    Returns
    -------
    rg : Generator
        Generator using the named core BitGenerator
    )r   r   r
   ©Zbit_generator_nameZbit_generator_ctorr   r   r   Ú__generator_ctor.   s    
r   c                 C  s   t | tƒrt| ƒS t|| ƒƒS )aÙ  
    Pickling helper function that returns a legacy RandomState-like object

    Parameters
    ----------
    bit_generator_name : str
        String containing the core BitGenerator's name
    bit_generator_ctor : callable, optional
        Callable function that takes bit_generator_name as its only argument
        and returns an instantized bit generator.

    Returns
    -------
    rs : RandomState
        Legacy RandomState using the named core BitGenerator
    )r   r   r   r   r   r   r   Ú__randomstate_ctorG   s    
r   N)r   )Ú
__future__r   r   r   Zmtrandr   Z_philoxr   Z_pcg64r   r   Z_sfc64r	   Z
_generatorr
   Z_mt19937r   r   r   r   r   r   r   r   r   Ú<module>   s(   üÿ
ÿ