o
    .wi@	                     @   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
 dedefddZeed	ee jd
d e_dededdfddZdededdfddZdededdfddZeeZeeZeeZeejedZdededdfddZdededdfddZdS )    N)partialwraps)AnyCallable)_loggerfnreturnc                    s&   t  dtdtdtf 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    Z/home/ubuntu/sommelier/.venv/lib/python3.10/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   
LOCAL_RANKr	   r
   c                  O      t j| i | d S N)warningswarnr   r   r   r   _warn*      r   c                  O   r   r   )loginfor   r   r   r   _info.   r   r   c                  O   r   r   )r   debugr   r   r   r   _debug2   r   r   )categorynamedomainc                 C       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<      r(   c                 C   r!   )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   r)   r*   )osr   	functoolsr   r   typingr   r   torchmetricsr   r   r   getattrintenvirongetr   r   r   r   rank_zero_debugrank_zero_inforank_zero_warnr   FutureWarningr&   strr(   r*   r   r   r   r   <module>   s    