CoolFace
Apppublic

declare-lab/tango2

sourceHugging Faceupdated 2y agoView on Hugging Face
92likes
logging.cpython-39.pyc72 linesDownload Raw Back to __pycache__
1a

2��'de$�@sUdZddlZddlZddlZddlZddlmZmZmZmZm	Z	m3Z4mZmZddl
mZddlmZe��Zdaeejed<ejej	ejejejd�ZejZdad	d5�Zed�dd
�Zejd�dd�Zdd�dd�Zdd�dd�Z dd�Z!dCeeejd�dd�Z"e#d�dd�Z$e#dd�dd�Z%dd�Z&d d!�Z'd"d#�Z(d$d%�Z)dd�d&d'�Z*dd�d(d)�Z+ejdd*�d+d,�Z,ejdd*�d-d.�Z-dd�d/d0�Z.dd�d1d2�Z/dd�d3d4�Z0dd�d5d6�Z1d7d8�Z2e2ej_2Gd9d:�d:�Z3Gd;d<�d<�Z4e4�Ze5d�d=d>�Z6d?d@�Z7dAdB�Z8dS)Dz Logging utilities.�N)�CRITICAL�DEBUG�ERROR�FATAL�INFO�NOTSET�WARN�WARNING)�Optional)�auto�_default_handler)�debug�info�warning�error�criticalTc	CsHt�dd�}|rD|tvr t|St���d|�dd�t������tS)z�6    If DIFFUSERS_VERBOSITY env var is set to one of the valid choices return that as the new default level. If it is7    not - fall back to `_default_log_level`8    ZDIFFUSERS_VERBOSITYNz#Unknown option DIFFUSERS_VERBOSITY=z, has to be one of: z, )	�os�getenv�9log_levels�logging�	getLoggerr�join�keys�_default_log_level)�
env_level_str�r�L/home/deep/Projects/audio_diffusion/diffusers/src/diffusers/utils/logging.py�_get_default_logging_level4s��r)�returncCst�d�dS)N�.r)�__name__�splitrrrr�_get_library_nameEsr"cCst�t��S�N)rrr"rrrr�_get_library_root_loggerIsr$cCspt�XtrWd�dSt��atjjt_t�}|�t�|�	t10��d|_Wd�n1sb0YdS)NF)�_lockrr�
StreamHandler�sys�stderr�flushr$�11addHandler�setLevelr�	propagate��library_root_loggerrrr�_configure_library_root_loggerMs1213r/cCs\t�DtsWd�dSt�}|�t�|�tj�daWd�n1sN0YdSr#)r%rr$�
removeHandlerr+rrr-rrr�_reset_library_root_logger^s14r1cCstSr#)rrrrr�get_log_levels_dictksr2)�namercCs|durt�}t�t�|�S)z�15    Return a logger with the specified name.16 17    This function is not supposed to be directly accessed unless you are writing a custom diffusers module.18    N)r"r/rr)r3rrr�19get_loggerosr4cCst�t���S)u�20    Return the current level for the 🤗 Diffusers' root logger as an int.21 22    Returns:23        `int`: The logging level.24 25    <Tip>26 27    🤗 Diffusers has following logging levels:28 29    - 50: `diffusers.logging.CRITICAL` or `diffusers.logging.FATAL`30    - 40: `diffusers.logging.ERROR`31    - 30: `diffusers.logging.WARNING` or `diffusers.logging.WARN`32    - 20: `diffusers.logging.INFO`33    - 10: `diffusers.logging.DEBUG`34 35    </Tip>)r/r$�getEffectiveLevelrrrr�
get_verbosity}sr6)�	verbosityrcCst�t��|�dS)u�36    Set the verbosity level for the 🤗 Diffusers' root logger.37 38    Args:39        verbosity (`int`):40            Logging level, e.g., one of:41 42            - `diffusers.logging.CRITICAL` or `diffusers.logging.FATAL`43            - `diffusers.logging.ERROR`44            - `diffusers.logging.WARNING` or `diffusers.logging.WARN`45            - `diffusers.logging.INFO`46            - `diffusers.logging.DEBUG`47    N)r/r$r+)r7rrr�
set_verbosity�sr8cCstt�S)z&Set the verbosity to the `INFO` level.)r8rrrrr�set_verbosity_info�sr9cCstt�S)z)Set the verbosity to the `WARNING` level.)r8r	rrrr�set_verbosity_warning�sr:cCstt�S)z'Set the verbosity to the `DEBUG` level.)r8rrrrr�set_verbosity_debug�sr;cCstt�S)z'Set the verbosity to the `ERROR` level.)r8rrrrr�set_verbosity_error�sr<cCs"t�tdusJ�t��t�dS)zFDisable the default handler of the HuggingFace Diffusers' root logger.N)r/rr$r0rrrr�disable_default_handler�sr=cCs"t�tdusJ�t��t�dS)zEEnable the default handler of the HuggingFace Diffusers' root logger.N)r/rr$r*rrrr�enable_default_handler�sr>)�handlerrcCs"t�|dusJ�t��|�dS)z9adds a handler to the HuggingFace Diffusers' root logger.N)r/r$r*�r?rrr�add_handler�srAcCs.t�|dur|t�jvsJ�t��|�dS)zBremoves given handler from the HuggingFace Diffusers' root logger.N)r/r$�handlersr0r@rrr�remove_handler�srCcCst�dt�_dS)zk48    Disable propagation of the library log outputs. Note that log propagation is disabled by default.49    FN�r/r$r,rrrr�disable_propagation�srEcCst�dt�_dS)z�50    Enable propagation of the library log outputs. Please disable the HuggingFace Diffusers' default handler to prevent51    double logging if the root logger has been configured.52    TNrDrrrr�enable_propagation�srFcCs*t�j}|D]}t�d�}|�|�qdS)a
53    Enable explicit formatting for every HuggingFace Diffusers' logger. The explicit formatter is as follows:54    ```55        [LEVELNAME|FILENAME|LINE NUMBER] TIME >> MESSAGE56    ```57    All handlers currently bound to the root logger are affected by this method.58    zB[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)sN)r$rBr�	Formatter�setFormatter)rBr?�	formatterrrr�enable_explicit_format�s59rJcCs t�j}|D]}|�d�qdS)z�60    Resets the formatting for HuggingFace Diffusers' loggers.61 62    All handlers currently bound to the root logger are affected by this method.63    N)r$rBrH)rBr?rrr�reset_formatsrKcOs(t�dd�}|rdS|j|i|��dS)z�64    This method is identical to `logger.warning()`, but if env var DIFFUSERS_NO_ADVISORY_WARNINGS=1 is set, this65    warning will not be printed66    ZDIFFUSERS_NO_ADVISORY_WARNINGSFN)rrr)�self�args�kwargsZno_advisory_warningsrrr�warning_advice
srOc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd67d�ZdS)
�	EmptyTqdmz%Dummy tqdm which doesn't do anything.cOs|r|dnd|_dS)Nr)�	_iterator�rLrMrNrrr�__init__szEmptyTqdm.__init__cCs68t|j�Sr#)�iterrQ�rLrrr�__iter__!szEmptyTqdm.__iter__cCsdd�}|S)zReturn empty function.c_sdSr#r)rMrNrrr�empty_fn'sz'EmptyTqdm.__getattr__.<locals>.empty_fnr)rL�_rWrrr�__getattr__$szEmptyTqdm.__getattr__cCs|Sr#rrUrrr�	__enter__,szEmptyTqdm.__enter__cCsdSr#r)rL�type_�value�	tracebackrrr�__exit__/szEmptyTqdm.__exit__N)	r �69__module__�__qualname__�__doc__rSrVrYrZr^rrrrrPsrPc@s$eZdZdd�Zdd�Zdd�ZdS)�	_tqdm_clscOs&trtj|i|��St|i|��SdSr#)�_tqdm_active�tqdm_lib�tqdmrPrRrrr�__call__4sz_tqdm_cls.__call__cOs d|_trtjj|i|��SdSr#)r%rcrdre�set_lockrRrrrrg:sz_tqdm_cls.set_lockcCstrtj��SdSr#)rcrdre�get_lockrUrrrrh?sz_tqdm_cls.get_lockN)r r_r`rfrgrhrrrrrb3srbcCstt�S)zCReturn a boolean indicating whether tqdm progress bars are enabled.)�boolrcrrrr�is_progress_bar_enabledGsrjcCsdadS)zEnable tqdm progress bar.TN�rcrrrr�enable_progress_barMsrlcCsdadS)zDisable tqdm progress bar.FNrkrrrr�disable_progress_barSsrm)N)9rarrr'�	threadingrrrrrrrr	�typingr70rerrd�Lockr%r�Handler�__annotations__rrrcr�strr"�Loggerr$r/r1r2r4�intr6r8r9r:r;r<r=r>rArCrErFrJrKrOrPrbrirjrlrmrrrr�<module>s\(71�
					72