a
    dN	                     @   s   d dl Z d dlZd dlmZmZ d dlmZmZ d dlm	Z
 eedddZeedee jd	d e_eedd
ddZeedd
ddZeedd
ddZeeZeeZeeZeejedZeeddddZeeddddZdS )    N)partialwraps)AnyCallable)_logger)fnreturnc                    s"   t  tttd fdd}|S )zdCall a function only on rank 0 in distributed settings.

    Meant to be used as an decorator.

    argskwargsr   c                     s   t jdkr | i |S d S )Nr   )rank_zero_onlyrankr
   r   r    f/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/torchmetrics/utilities/prints.py
wrapped_fn   s    
z"rank_zero_only.<locals>.wrapped_fn)r   r   )r   r   r   r   r   r      s    r   r   Z
LOCAL_RANKr	   c                  O   s   t j| i | d S N)warningswarnr   r   r   r   _warn*   s    r   c                  O   s   t j| i | d S r   )loginfor   r   r   r   _info.   s    r   c                  O   s   t j| i | d S r   )r   debugr   r   r   r   _debug2   s    r   )category)namedomainr   c                 C   s    t d|  d|  d| d dS )zJWarn user that he is importing class from location it has been deprecated.Importing `zI` from `torchmetrics` was deprecated and will be removed in 2.0. Import `` from `torchmetrics.
` instead.N_future_warningr   r   r   r   r   _deprecated_root_import_class<   s    r%   c                 C   s    t d|  d|  d| d dS )zMWarn user that he is importing function from location it has been deprecated.r   zT` from `torchmetrics.functional` was deprecated and will be removed in 2.0. Import `r    r!   Nr"   r$   r   r   r   _deprecated_root_import_funcD   s    r&   )osr   	functoolsr   r   typingr   r   Ztorchmetricsr   r   r   getattrintenvirongetr   r   r   r   Zrank_zero_debugZrank_zero_infoZrank_zero_warnr   FutureWarningr#   strr%   r&   r   r   r   r   <module>   s   