
      i                         d Z ddlZddlmZ ddlmZmZ ddlmZ  ej                  de       ej                  Zdded	dfd
Z	 ddeeef   dee   dededee   d	efdZee_
         G d de      Zded	efdZy)zWarning-related utilities.    N)Path)OptionalUnion)LightningDeprecationWarningdefault)categorymodulereturnc                 <    t        j                  d| t               y)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., ``'pytorch_lightning.strategies'``).
            Default: Disables warnings from all modules.

    ignore)r	   r   N)warningsfilterwarningsPossibleUserWarning)r	   s    x/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/lightning_fabric/utilities/warnings.pydisable_possible_user_warningsr      s     HV>QR    messager   filenamelinenolinec                 ^    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   s        r   _custom_format_warningr   (   s<     T(^,1VHBwir22"7HhMMr   c                       e Zd ZdZy)r   z'Warnings that could be false positives.N)__name__
__module____qualname____doc__ r   r   r   r   5   s    1r   r   pathc                 8    dt        | j                               v S )zJNaive check whether the path looks like a path from the lightning package.	lightning)strabsolute)r#   s    r   r   r   9   s    #dmmo...r   ) )N)r!   r   pathlibr   typingr   r   $lightning_fabric.utilities.rank_zeror   simplefilterformatwarningr   r&   r   Warningtypeintr   UserWarningr   boolr   r"   r   r   <module>r3      s    !   " L   i*E F"00 
S3 
S 
S nrN7C< N,0MNEHNRUN]efi]jNN 0 2+ 2/ / /r   