o
    LDiS                     @  s,   d dl mZ d dlZdgZG dd dZdS )    )annotationsNDeadlinec                   @  s*   e Zd ZdZdddZdd	dddZdS )r   z
    Manage timeouts across multiple steps.

    Args:
        timeout: Time available in seconds or :obj:`None` if there is no limit.

    timeoutfloat | NonereturnNonec                 C  s(   |  |d u rd | _ d S t | | _ d S )N)deadlinetime	monotonic)selfr    r   a/var/www/www-root/data/www/77.83.87.30/venv/lib/python3.10/site-packages/websockets/sync/utils.py__init__   s   
zDeadline.__init__T)raise_if_elapsedr   boolc                C  s4   | j du rdS | j t  }|r|dkrtd|S )aL  
        Calculate a timeout from a deadline.

        Args:
            raise_if_elapsed: Whether to raise :exc:`TimeoutError`
                if the deadline lapsed.

        Raises:
            TimeoutError: If the deadline lapsed.

        Returns:
            Time left in seconds or :obj:`None` if there is no limit.

        Nr   z	timed out)r   r	   r
   TimeoutError)r   r   r   r   r   r   r      s   
zDeadline.timeoutN)r   r   r   r   )r   r   r   r   )__name__
__module____qualname____doc__r   r   r   r   r   r   r   	   s    
)
__future__r   r	   __all__r   r   r   r   r   <module>   s    