o
    zi                     @   sR   d dl Z d dlmZ G dd deZG dd deZdeded	ed
dfddZ	dS )    N)MisconfigurationExceptionc                   @      e Zd ZdZdS )SIGTERMExceptiona  Exception used when a :class:`signal.SIGTERM` is sent to a process.

    This exception is raised by the loops at specific points. It can be used to write custom logic in the
    :meth:`pytorch_lightning.callbacks.callback.Callback.on_exception` method.

    For example, you could use the :class:`pytorch_lightning.callbacks.fault_tolerance.OnExceptionCheckpoint` callback
    that saves a checkpoint for you when this exception is raised.

    N__name__
__module____qualname____doc__ r
   r
   Z/home/ubuntu/.local/lib/python3.10/site-packages/pytorch_lightning/utilities/exceptions.pyr          r   c                   @   r   )_TunerExitExceptionz*Exception used to exit early while tuning.Nr   r
   r
   r
   r   r      r   r   	exceptionpatternnew_messagereturnc                    s    t  fdd| jD | _d S )Nc                 3   s2    | ]}t |trt|tjr n|V  qd S )N)
isinstancestrrematchDOTALL).0argr   r   r
   r   	<genexpr>$   s    "
z#_augment_message.<locals>.<genexpr>)tupleargs)r   r   r   r
   r   r   _augment_message#   s   r   )
r   %lightning_fabric.utilities.exceptionsr   
SystemExitr   	Exceptionr   BaseExceptionr   r   r
   r
   r
   r   <module>   s
   