B
    0dg                 @   s   d Z ddlZddlmZ ddlZeejddeejdddd	d
Z	e
 Zdd Zdd ZdddZeddddd
ddZdS )z8Global configuration state and functions for management
    N)contextmanagerZSKLEARN_ASSUME_FINITEFZSKLEARN_WORKING_MEMORYi   Ttext)assume_finiteworking_memoryprint_changed_onlydisplayc               C   s   t tdst t_tjS )z|Get a threadlocal **mutable** configuration. If the configuration
    does not exist, copy the default global configuration.global_config)hasattr_threadlocal_global_configcopyr    r   r   A/var/www/html/venv/lib/python3.7/site-packages/sklearn/_config.py_get_threadlocal_config   s    

r   c               C   s
   t   S )a^  Retrieve current values for configuration set by :func:`set_config`.

    Returns
    -------
    config : dict
        Keys are parameter names that can be passed to :func:`set_config`.

    See Also
    --------
    config_context : Context manager for global scikit-learn configuration.
    set_config : Set global scikit-learn configuration.
    )r   r   r   r   r   r   
get_config   s    r   c             C   sJ   t  }| dk	r| |d< |dk	r&||d< |dk	r6||d< |dk	rF||d< dS )a>  Set global scikit-learn configuration

    .. versionadded:: 0.19

    Parameters
    ----------
    assume_finite : bool, default=None
        If True, validation for finiteness will be skipped,
        saving time, but leading to potential crashes. If
        False, validation for finiteness will be performed,
        avoiding error.  Global default: False.

        .. versionadded:: 0.19

    working_memory : int, default=None
        If set, scikit-learn will attempt to limit the size of temporary arrays
        to this number of MiB (per job when parallelised), often saving both
        computation time and memory on expensive operations that can be
        performed in chunks. Global default: 1024.

        .. versionadded:: 0.20

    print_changed_only : bool, default=None
        If True, only the parameters that were set to non-default
        values will be printed when printing an estimator. For example,
        ``print(SVC())`` while True will only print 'SVC()' while the default
        behaviour would be to print 'SVC(C=1.0, cache_size=200, ...)' with
        all the non-changed parameters.

        .. versionadded:: 0.21

    display : {'text', 'diagram'}, default=None
        If 'diagram', estimators will be displayed as a diagram in a Jupyter
        lab or notebook context. If 'text', estimators will be displayed as
        text. Default is 'text'.

        .. versionadded:: 0.23

    See Also
    --------
    config_context : Context manager for global scikit-learn configuration.
    get_config : Retrieve current values of the global configuration.
    Nr   r   r   r   )r   )r   r   r   r   Zlocal_configr   r   r   
set_config*   s    .r   c          	   c   s2   t  }t| |||d z
dV  W dtf | X dS )a	  Context manager for global scikit-learn configuration.

    Parameters
    ----------
    assume_finite : bool, default=None
        If True, validation for finiteness will be skipped,
        saving time, but leading to potential crashes. If
        False, validation for finiteness will be performed,
        avoiding error. If None, the existing value won't change.
        The default value is False.

    working_memory : int, default=None
        If set, scikit-learn will attempt to limit the size of temporary arrays
        to this number of MiB (per job when parallelised), often saving both
        computation time and memory on expensive operations that can be
        performed in chunks. If None, the existing value won't change.
        The default value is 1024.

    print_changed_only : bool, default=None
        If True, only the parameters that were set to non-default
        values will be printed when printing an estimator. For example,
        ``print(SVC())`` while True will only print 'SVC()', but would print
        'SVC(C=1.0, cache_size=200, ...)' with all the non-changed parameters
        when False. If None, the existing value won't change.
        The default value is True.

        .. versionchanged:: 0.23
           Default changed from False to True.

    display : {'text', 'diagram'}, default=None
        If 'diagram', estimators will be displayed as a diagram in a Jupyter
        lab or notebook context. If 'text', estimators will be displayed as
        text. If None, the existing value won't change.
        The default value is 'text'.

        .. versionadded:: 0.23

    Yields
    ------
    None.

    See Also
    --------
    set_config : Set global scikit-learn configuration.
    get_config : Retrieve current values of the global configuration.

    Notes
    -----
    All settings, not just those presently modified, will be returned to
    their previous values when the context manager is exited.

    Examples
    --------
    >>> import sklearn
    >>> from sklearn.utils.validation import assert_all_finite
    >>> with sklearn.config_context(assume_finite=True):
    ...     assert_all_finite([float('nan')])
    >>> with sklearn.config_context(assume_finite=True):
    ...     with sklearn.config_context(assume_finite=False):
    ...         assert_all_finite([float('nan')])
    Traceback (most recent call last):
    ...
    ValueError: Input contains NaN...
    )r   r   r   r   N)r   r   )r   r   r   r   Z
old_configr   r   r   config_contextd   s    D
r   )NNNN)__doc__os
contextlibr   	threadingboolenvirongetintr   localr
   r   r   r   r   r   r   r   r   <module>   s   
9