o
    i[                     @  sV   d dl mZ d dlZd dlZd dlmZ d dlmZ 	ddddddZdddZ	dS )    )annotationsN)settings)ParametricProfileNamesfastF)set_environmentprofileParametricProfileNames | intr   boolreturnNonec                C  s   ddd}t | }dD ]\}}tjd
d| |d| q| s(td|r@t|dd	}d| }tjd
||d| d|dd	 }t| |rVt	| dS dS )ae  
    Load a named (or custom) hypothesis profile for use with the parametric tests.

    .. warning::
        This functionality is currently considered **unstable**. It may be
        changed at any point without it being considered a breaking change.

    Parameters
    ----------
    profile : {str, int}, optional
        Name of the profile to load; one of "fast", "balanced", "expensive", or
        the integer number of iterations to run (which will create and register
        a custom profile with that value).

    set_environment : bool, default False
        If True, also set the environment variable `POLARS_HYPOTHESIS_PROFILE`
        to the given profile name/value.

    Examples
    --------
    >>> # load a custom profile that will run with 1500 iterations
    >>> from polars.testing.parametric import load_profile
    >>> load_profile(1500)
    TN)Z
print_blobdeadline))r   d   )Zbalancedi  )Z	expensivei'  zpolars.)nameZmax_exampleszpolars\.custom\.[\d_]+$zpolars.custom.  )
strr   Zregister_profileisdigitrematchintreplaceload_profileset_profile)r   r   Zcommon_settingsprofile_namer   Z
iterationsZn_iterationsr   r   Y/home/app/Keep/.python/lib/python3.10/site-packages/polars/testing/parametric/profiles.pyr      s.   
	

r   c                 C  sr   t | dd }|dd rt t|}nddlm} |t}||vr2d|d|}t||t	j
d	< d
S )a  
    Set the env var `POLARS_HYPOTHESIS_PROFILE` to the given profile name/value.

    .. warning::
        This functionality is currently considered **unstable**. It may be
        changed at any point without it being considered a breaking change.

    Parameters
    ----------
    profile : {str, int}, optional
        Name of the profile to load; one of "fast", "balanced", "expensive", or
        the integer number of iterations to run (which will create and register
        a custom profile with that value).

    Examples
    --------
    >>> # prefer the 'balanced' profile for running parametric tests
    >>> from polars.testing.parametric import set_profile
    >>> set_profile("balanced")
    ._r   r   )get_argszinvalid profile name z; expected one of ZPOLARS_HYPOTHESIS_PROFILEN)r   splitr   r   r   typingr   r   
ValueErrorosenviron)r   r   r   Zvalid_profile_namesmsgr   r   r   r   J   s   r   )r   )r   r   r   r	   r
   r   )r   r   r
   r   )

__future__r   r"   r   Z
hypothesisr   Zpolars._typingr   r   r   r   r   r   r   <module>   s    ?