o
    ¤ôjä  ã                   @   sÂ   d Z ddlZddlmZ ddlmZmZmZ ddlm	Z	 ej
de	d� ejZdd	ed
dfdd„Z	ddeeef dee dededee d
efdd„Zee_G dd„ deƒZded
efdd„ZdS )zWarning-related utilities.é    N)ÚPath)ÚOptionalÚTypeÚUnion)ÚLightningDeprecationWarningÚdefault)ÚcategoryÚ ÚmoduleÚreturnc                 C   s   t jd| td� dS )au  Ignore warnings of the category ``PossibleUserWarning`` from Lightning.

    For more granular control over which warnings to ignore, use :func:`warnings.filterwarnings` directly.

    Args:
        module: Name of the module for which the warnings should be ignored (e.g., ``'lightning.pytorch.strategies'``).
            Default: Disables warnings from all modules.

    Úignore)r
   r   N)ÚwarningsÚfilterwarningsÚPossibleUserWarning)r
   © r   úv/var/www/html/academy/tools/voices/clone/cosy-venv/lib/python3.10/site-packages/lightning/fabric/utilities/warnings.pyÚdisable_possible_user_warnings   s   
r   Úmessager   ÚfilenameÚlinenoÚlinec                 C   s2   t t|ƒƒr|› d|› d| › d�S t| ||||ƒS )zhCustom formatting that avoids an extra line in case warnings are emitted from the `rank_zero`-functions.ú:z: Ú
)Ú_is_path_in_lightningr   Ú_default_format_warning)r   r   r   r   r   r   r   r   Ú_custom_format_warning(   s   r   c                   @   s   e Zd ZdZdS )r   z'Warnings that could be false positives.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   5   s    r   Úpathc                 C   s   dt |  ¡ ƒv S )zJNaive check whether the path looks like a path from the lightning package.Ú	lightning)ÚstrÚabsolute)r    r   r   r   r   9   s   r   )r	   )N)r   r   Úpathlibr   Útypingr   r   r   Ú$lightning.fabric.utilities.rank_zeror   ÚsimplefilterÚformatwarningr   r"   r   ÚWarningÚintr   ÚUserWarningr   Úboolr   r   r   r   r   Ú<module>   s2   ÿ
ÿÿÿÿÿ
þ
