o
    TZh                     @   s2  d Z ddlZddlZddlmZmZ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 ejejej
ejejdZej
Zdd	 Zd
efddZd
ejfddZd'ddZd'ddZd(dee d
ejfddZd
efddZded
dfddZdd Zdd Zdd  Z d!d" Z!d'd#d$Z"d'd%d&Z#e  dS ))zLogging utilities.    N)CRITICALDEBUGERRORFATALINFONOTSETWARNWARNING)Optional   )disable_progress_barenable_progress_baris_progress_bar_enabledtqdm)debuginfowarningerrorcriticalc               	   C   sH   t dd} | r"| tv rt|  S t d|  ddt   tS )z
    If DATASETS_VERBOSITY env var is set to one of the valid choices return that as the new default level.
    If it is not - fall back to ``_default_log_level``
    ZDATASETS_VERBOSITYNz"Unknown option DATASETS_VERBOSITY=z, has to be one of: z, )	osgetenv
log_levelslogging	getLoggerr   joinkeys_default_log_level)Zenv_level_str r   M/var/www/html/lang_env/lib/python3.10/site-packages/datasets/utils/logging.py_get_default_logging_level1   s   r   returnc                   C   s   t dd S )N.r   )__name__splitr   r   r   r   _get_library_nameB   s   r$   c                   C   s   t t S N)r   r   r$   r   r   r   r   _get_library_root_loggerF   s   r&   c                  C   s$   t  } | t  | t  d S r%   )r&   
addHandlerr   StreamHandlersetLevelr   Zlibrary_root_loggerr   r   r   _configure_library_root_loggerJ   s   r+   c                  C   s   t  } | tj d S r%   )r&   r)   r   r   r*   r   r   r   _reset_library_root_loggerQ   s   r,   namec                 C   s   | du rt  } t| S )z_Return a logger with the specified name.
    This function can be used in dataset scripts.
    N)r$   r   r   )r-   r   r   r   
get_loggerV   s   
r.   c                   C   s
   t   S )a  Return the current level for the HuggingFace datasets library's root logger.
    Returns:
        Logging level, e.g., `datasets.logging.DEBUG` and `datasets.logging.INFO`.

    <Tip>

        HuggingFace datasets library has following logging levels:
        - `datasets.logging.CRITICAL`, `datasets.logging.FATAL`
        - `datasets.logging.ERROR`
        - `datasets.logging.WARNING`, `datasets.logging.WARN`
        - `datasets.logging.INFO`
        - `datasets.logging.DEBUG`

    </Tip>
    )r&   getEffectiveLevelr   r   r   r   get_verbosity_   s   
r0   	verbosityc                 C   s   t  |  dS )zSet the level for the Hugging Face Datasets library's root logger.
    Args:
        verbosity:
            Logging level, e.g., `datasets.logging.DEBUG` and `datasets.logging.INFO`.
    N)r&   r)   )r1   r   r   r   set_verbosityr   s   r2   c                   C      t tS )zSet the level for the Hugging Face datasets library's root logger to `INFO`.

    This will display most of the logging information and tqdm bars.

    Shortcut to `datasets.logging.set_verbosity(datasets.logging.INFO)`.
    )r2   r   r   r   r   r   set_verbosity_info{      r4   c                   C   r3   )zSet the level for the Hugging Face datasets library's root logger to `WARNING`.

    This will display only the warning and errors logging information and tqdm bars.

    Shortcut to `datasets.logging.set_verbosity(datasets.logging.WARNING)`.
    )r2   r	   r   r   r   r   set_verbosity_warning   r5   r6   c                   C   r3   )zSet the level for the Hugging Face datasets library's root logger to `DEBUG`.

    This will display all the logging information and tqdm bars.

    Shortcut to `datasets.logging.set_verbosity(datasets.logging.DEBUG)`.
    )r2   r   r   r   r   r   set_verbosity_debug   r5   r7   c                   C   r3   )zSet the level for the Hugging Face datasets library's root logger to `ERROR`.

    This will display only the errors logging information and tqdm bars.

    Shortcut to `datasets.logging.set_verbosity(datasets.logging.ERROR)`.
    )r2   r   r   r   r   r   set_verbosity_error   r5   r8   c                   C      dt  _dS )zjDisable propagation of the library log outputs.
    Note that log propagation is disabled by default.
    FNr&   	propagater   r   r   r   disable_propagation   s   r<   c                   C   r9   )zEnable propagation of the library log outputs.
    Please disable the Hugging Face datasets library's default handler to prevent double logging if the root logger has
    been configured.
    TNr:   r   r   r   r   enable_propagation   s   r=   )r    Nr%   )$__doc__r   r   r   r   r   r   r   r   r   r	   typingr
   r   r   r   r   r   r   r   strr$   Loggerr&   r+   r,   r.   intr0   r2   r4   r6   r7   r8   r<   r=   r   r   r   r   <module>   s8   (
	

		






	