U
    ”Ê¹j4  ã                   @   s@  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 ejejej
ejejdœZej
Zedœd	d
„Zejdœdd„Zdd„ Zddœdd„Zddœdd„Zd'ee ejdœdd„Zedœdd„Zeddœdd„Zdd„ Zdd„ Zdd „ Zd!d"„ Zddœd#d$„Z ddœd%d&„Z!eƒ  ej"�r<eƒ  dS )(zLogging utilities.é    N)ÚCRITICALÚDEBUGÚERRORÚFATALÚINFOÚNOTSETÚWARNÚWARNING)ÚOptionalé   )Ú	constants)ÚdebugÚinfoÚwarningÚerrorÚcritical)Úreturnc                   C   s   t  d¡d S )NÚ.r   )Ú__name__Úsplit© r   r   ú\/var/www/html/bwave/python/venv/lib/python3.8/site-packages/huggingface_hub/utils/logging.pyÚ_get_library_name-   s    r   c                   C   s   t  tƒ ¡S ©N)ÚloggingÚ	getLoggerr   r   r   r   r   Ú_get_library_root_logger1   s    r   c               	   C   sH   t  dd¡} | rD| tkr t|  S t ¡  d| › dd t ¡ ¡› �¡ tS )z¥
    If `HF_HUB_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HF_HUB_VERBOSITYNz Unknown option HF_HUB_VERBOSITY=z, has to be one of: z, )	ÚosÚgetenvÚ
log_levelsr   r   r   ÚjoinÚkeysÚ_default_log_level)Zenv_level_strr   r   r   Ú_get_default_logging_level5   s    ÿr#   c                  C   s$   t ƒ } |  t ¡ ¡ |  tƒ ¡ d S r   )r   Ú
addHandlerr   ÚStreamHandlerÚsetLevelr#   ©Zlibrary_root_loggerr   r   r   Ú_configure_library_root_loggerE   s    r(   c                  C   s   t ƒ } |  tj¡ d S r   )r   r&   r   r   r'   r   r   r   Ú_reset_library_root_loggerK   s    r)   )Únamer   c                 C   s   | dkrt ƒ } t | ¡S )a£  
        Returns a logger with the specified name. This function is not supposed
        to be directly accessed by library users.

        Args:
            name (`str`, *optional*):
                The name of the logger to get, usually the filename

        Example:

    ```python
    >>> from huggingface_hub import get_logger

    >>> logger = get_logger(__file__)
    >>> logger.set_verbosity_info()
    ```
    N)r   r   r   )r*   r   r   r   Ú
get_loggerP   s    r+   c                   C   s
   t ƒ  ¡ S )a  Return the current level for the HuggingFace Hub's root logger.

    Returns:
        Logging level, e.g., `huggingface_hub.logging.DEBUG` and
        `huggingface_hub.logging.INFO`.

    > [!TIP]
    > HuggingFace Hub has following logging levels:
    >
    > - `huggingface_hub.logging.CRITICAL`, `huggingface_hub.logging.FATAL`
    > - `huggingface_hub.logging.ERROR`
    > - `huggingface_hub.logging.WARNING`, `huggingface_hub.logging.WARN`
    > - `huggingface_hub.logging.INFO`
    > - `huggingface_hub.logging.DEBUG`
    )r   ÚgetEffectiveLevelr   r   r   r   Úget_verbosityi   s    r-   )Ú	verbosityr   c                 C   s   t ƒ  | ¡ dS )zÖ
    Sets the level for the HuggingFace Hub's root logger.

    Args:
        verbosity (`int`):
            Logging level, e.g., `huggingface_hub.logging.DEBUG` and
            `huggingface_hub.logging.INFO`.
    N)r   r&   )r.   r   r   r   Úset_verbosity|   s    	r/   c                   C   s   t tƒS )z/
    Sets the verbosity to `logging.INFO`.
    )r/   r   r   r   r   r   Úset_verbosity_infoˆ   s    r0   c                   C   s   t tƒS )z2
    Sets the verbosity to `logging.WARNING`.
    )r/   r	   r   r   r   r   Úset_verbosity_warning�   s    r1   c                   C   s   t tƒS )z0
    Sets the verbosity to `logging.DEBUG`.
    )r/   r   r   r   r   r   Úset_verbosity_debug–   s    r2   c                   C   s   t tƒS )z0
    Sets the verbosity to `logging.ERROR`.
    )r/   r   r   r   r   r   Úset_verbosity_error�   s    r3   c                   C   s   dt ƒ _dS )zo
    Disable propagation of the library log outputs. Note that log propagation is
    disabled by default.
    FN©r   Ú	propagater   r   r   r   Údisable_propagation¤   s    r6   c                   C   s   dt ƒ _dS )z·
    Enable propagation of the library log outputs. Please disable the
    HuggingFace Hub's default handler to prevent double logging if the root
    logger has been configured.
    TNr4   r   r   r   r   Úenable_propagation¬   s    r7   )N)#Ú__doc__r   r   r   r   r   r   r   r   r   r	   Útypingr
   Ú r   r   r"   Ústrr   ÚLoggerr   r#   r(   r)   r+   Úintr-   r/   r0   r1   r2   r3   r6   r7   ZHF_DEBUGr   r   r   r   Ú<module>   s:   (
û	