Ë
    :�Djµ  ã                   ód  — d Z ddlZddlZddlmZ ddlmZ ddlmZm	Z	m
Z
mZmZmZ ddlmZ ddlmZmZmZmZ dddddd	œd
ee   dee   dee   dee   dee   de	egef   fd„Z edd¬«      deddfd„«       Z edd¬«      de
eef   fd„«       Ze edddd¬«      deded   fd„«       «       Zy)z Global configuration for XGBoosté    N)Úcontextmanager)Úwraps)ÚAnyÚCallableÚDictÚIteratorÚOptionalÚcasté   )Ú_F)Ú_LIBÚ_check_callÚc_strÚpy_str)ÚheaderÚ
extra_noteÚ
parametersÚreturnsÚsee_alsor   r   r   r   r   Úreturnc           	      ó~   ‡ ‡‡‡‡‡‡‡— dŠdŠdt         t           dt        fd„Šdt        dt        fˆˆˆˆ ˆˆˆˆfd„}|S )aD  Decorator to format docstring for config functions.

    Parameters
    ----------
    header: str
        An introducion to the function
    extra_note: str
        Additional notes
    parameters: str
        Parameters of the function
    returns: str
        Return value
    see_also: str
        Related functions
    a  
    {header}

    Global configuration consists of a collection of parameters that can be applied in the
    global scope. See :ref:`global_config` for the full list of parameters supported in
    the global configuration.

    {extra_note}

    .. versionadded:: 1.4.0
    af  
    Example
    -------

    .. code-block:: python

        import xgboost as xgb

        # Show all messages, including ones pertaining to debugging
        xgb.set_config(verbosity=2)

        # Get current value of global configuration
        # This is a dict containing all parameters in the global configuration,
        # including 'verbosity'
        config = xgb.get_config()
        assert config['verbosity'] == 2

        # Example of using the context manager xgb.config_context().
        # The context manager will restore the previous value of the global
        # configuration upon exiting.
        with xgb.config_context(verbosity=0):
            # Suppress warning caused by model generated with XGBoost version < 1.0.0
            bst = xgb.Booster(model_file='./old_model.bin')
        assert xgb.get_config()['verbosity'] == 2  # old value restored

    Nested configuration context is also supported:

    Example
    -------

    .. code-block:: python

        with xgb.config_context(verbosity=3):
            assert xgb.get_config()["verbosity"] == 3
            with xgb.config_context(verbosity=2):
                assert xgb.get_config()["verbosity"] == 2

        xgb.set_config(verbosity=2)
        assert xgb.get_config()["verbosity"] == 2
        with xgb.config_context(verbosity=3):
            assert xgb.get_config()["verbosity"] == 3
    Úvaluer   c                 ó   — | €dS | S )NÚ © )r   s    úRC:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\xgboost/config.pyÚnone_to_strzconfig_doc.<locals>.none_to_str\   s   € Ø�]ˆrÐ-¨Ð-ó    Úfuncc                 ó  •‡ — ‰j                   ‰‰«       ‰‰«      ¬«       ‰‰«      z    ‰‰«      z    ‰‰«      z    ‰‰	«      z   ‰ _        t        ‰ «      dt        dt        dt        fˆ fd„«       }t	        t
        |«      S )N)r   r   ÚargsÚkwargsr   c                  ó   •—  ‰| i |¤ŽS ©Nr   )r!   r"   r   s     €r   Úwrapz6config_doc.<locals>.config_doc_decorator.<locals>.wrapj   s   ø€ á˜Ð( Ñ(Ð(r   )ÚformatÚ__doc__r   r   r
   r   )
r   r%   Úcommon_exampleÚdoc_templater   r   r   r   r   r   s
   ` €€€€€€€€r   Úconfig_doc_decoratorz(config_doc.<locals>.config_doc_decorator_   s£   ù€ à×ÑÙ" 6Ó*±{À:Ó7Nð  ó ñ ˜*Ó%ñ&ñ ˜'Ó"ñ	#ñ
 ˜.Ó)ñ*ñ ˜(Ó#ñ$ð 	Œô 
ˆt‹ð	)œð 	)¤sð 	)¬sô 	)ó 
ð	)ô ”B˜‹~Ðr   )r	   Ústrr   )	r   r   r   r   r   r*   r(   r)   r   s	   ````` @@@r   Ú
config_docr,      sI   ÿ€ ð0
€Lð)€NðV.œ8¤C™=ð .¬Só .ð¤2ð ¬"÷ ô ð"  Ðr   z#
    Set global configuration.
    z‘
    Parameters
    ----------
    new_config: Dict[str, Any]
        Keyword arguments representing the parameters and their values
            )r   r   Ú
new_configc                  óÀ   — i }| j                  «       D ]  \  }}|€Œ	|||<   Œ t        j                  |«      }t        t	        j
                  t        |«      «      «       y r$   )ÚitemsÚjsonÚdumpsr   r   ÚXGBSetGlobalConfigr   )r-   Únot_noneÚkÚvÚconfigs        r   Ú
set_configr7   s   sZ   € ð €HØ× Ñ Ó"ò ‰ˆˆ1Ø‰=ØˆH�QŠKðô �Z‰Z˜Ó!€FÜ”×'Ñ'¬¨f«Ó6Õ7r   z9
    Get current values of the global configuration.
    zu
    Returns
    -------
    args: Dict[str, Any]
        The list of global parameters and their values
            )r   r   c                  óì   — t        j                  «       } t        t        j                  t        j
                  | «      «      «       | j                  }|sJ ‚t        j                  t        |«      «      }|S r$   )
ÚctypesÚc_char_pr   r   ÚXGBGetGlobalConfigÚbyrefr   r0   Úloadsr   )Ú
config_strr   r6   s      r   Ú
get_configr?   ‡   sS   € ô —‘Ó"€JÜ”×'Ñ'¬¯©°ZÓ(@ÓAÔBØ×Ñ€EÙ�LÜ�Z‰Zœ˜u›Ó&€FØ€Mr   z;
    Context manager for global XGBoost configuration.
    zÄ
    .. note::

        All settings, not just those presently modified, will be returned to their
        previous values when the context manager is exited. This is not thread-safe.
            z—
    See Also
    --------
    set_config: Set global XGBoost configuration
    get_config: Get current values of the global configuration
            )r   r   r   r   c               +   ó’   K  — t        «       j                  «       }t        di | ¤Ž 	 d –— t        di |¤Ž y # t        di |¤Ž w xY w­w)Nr   )r?   Úcopyr7   )r-   Ú
old_configs     r   Úconfig_contextrC   ›   sA   è ø€ ô2 “×"Ñ"Ó$€JÜÑ�Òð!ÛäÑ �ZÓ øŒ
Ñ �ZÓ üs   ‚$A§7 «A·AÁA)r'   r9   r0   Ú
contextlibr   Ú	functoolsr   Útypingr   r   r   r   r	   r
   Ú_typingr   Úcorer   r   r   r   r+   r,   r7   r?   rC   r   r   r   ú<module>rI      sD  ðá &Û Û Ý %Ý ß @× @å ß 2Ó 2ð
 !Ø $Ø $Ø!Ø"òc à�S‰Mðc ð ˜‘ðc ð ˜‘ð	c ð
 �c‰]ðc ð �s‰mðc ð ˆrˆd�BˆhÑóc ñL ððô	
ð8˜Sð 8 Tò 8ó
ð8ñ ððô	
ð�D˜˜c˜‘Nò ó
ðð Ùððððô!ð.! ð !¨°$©ò !ó/ó ñ0!r   