o
    ²ôj@	  ã                   @   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   © úp/var/www/html/academy/tools/voices/clone/cosy-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    