o
    h-                     @   s6  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defd	d
ZdejfddZ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  ej"re  dS 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   q/var/www/html/construction_image-detection-poc/venv/lib/python3.10/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} | r"| tv 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`
    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)env_level_strr   r   r   _get_default_logging_level5   s   r%   c                  C   s$   t  } | t  | t  d S r   )r   
addHandlerr   StreamHandlersetLevelr%   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,   namec                 C   s   | du 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`

    </Tip>
    )r   getEffectiveLevelr   r   r   r   get_verbosityi   s   
r0   	verbosityc                 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(   )r1   r   r   r   set_verbosity   s   	r2   c                   C      t tS )z/
    Sets the verbosity to `logging.INFO`.
    )r2   r   r   r   r   r   set_verbosity_info      r4   c                   C   r3   )z2
    Sets the verbosity to `logging.WARNING`.
    )r2   r	   r   r   r   r   set_verbosity_warning   r5   r6   c                   C   r3   )z0
    Sets the verbosity to `logging.DEBUG`.
    )r2   r   r   r   r   r   set_verbosity_debug   r5   r7   c                   C   r3   )z0
    Sets the verbosity to `logging.ERROR`.
    )r2   r   r   r   r   r   set_verbosity_error   r5   r8   c                   C      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   r<   c                   C   r9   )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.
    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#   strr   Loggerr   r%   r+   r,   r.   intr0   r2   r4   r6   r7   r8   r<   r=   HF_DEBUGr   r   r   r   <module>   s>   (




	
