
    #)f                        d dl mZ d dlZd dlmZmZ d dlmZ d dlZddZ	ddZ
ddZddZdd	Z G d
 de      ZddZes ee      ZddZy)    )annotationsN)AbstractContextManagercontextmanager)TYPE_CHECKINGc                n    t        j                  |       rt        d      t        j                  |       S )zUse as a context manager to create a cancel scope with the given
    absolute deadline.

    Args:
      deadline (float): The deadline.

    Raises:
      ValueError: if deadline is NaN.

    zdeadline must not be NaNdeadline)mathisnan
ValueErrortrioCancelScoper   s    K/var/www/html/flask-app/venv/lib/python3.12/site-packages/trio/_timeouts.py
move_on_atr   
   s-     zz(344X..    c                b    | dk  rt        d      t        t        j                         | z         S )zUse as a context manager to create a cancel scope whose deadline is
    set to now + *seconds*.

    Args:
      seconds (float): The timeout.

    Raises:
      ValueError: if timeout is less than zero or NaN.

    r   timeout must be non-negative)r   r   r   current_timesecondss    r   move_on_afterr      s0     {788d'')G344r   c                 `   K   t         j                  j                  d        d{    y7 w)z}Pause execution of the current task forever (or until cancelled).

    Equivalent to calling ``await sleep(math.inf)``.

    c                J    t         j                  j                  j                  S )N)r   lowlevelAbort	SUCCEEDED)_s    r   <lambda>zsleep_forever.<locals>.<lambda>0   s    8K8K8U8U r   N)r   r   wait_task_rescheduled r   r   sleep_foreverr!   *   s!      --
-
-.U
VVVs   $.,.c                t   K   t        |       5  t                d{    ddd       y7 # 1 sw Y   yxY ww)a  Pause execution of the current task until the given time.

    The difference between :func:`sleep` and :func:`sleep_until` is that the
    former takes a relative time and the latter takes an absolute time
    according to Trio's internal clock (as returned by :func:`current_time`).

    Args:
        deadline (float): The time at which we should wake up again. May be in
            the past, in which case this function executes a checkpoint but
            does not block.

    Raises:
      ValueError: if deadline is NaN.

    N)r   r!   r   s    r   sleep_untilr#   3   s8       
H	 o  s    8,*,	8,58c                   K   | dk  rt        d      | dk(  r't        j                  j                          d{    yt	        t        j
                         | z          d{    y7 .7 w)a  Pause execution of the current task for the given number of seconds.

    Args:
        seconds (float): The number of seconds to sleep. May be zero to
            insert a checkpoint without actually blocking.

    Raises:
        ValueError: if *seconds* is negative or NaN.

    r   zduration must be non-negativeN)r   r   r   
checkpointr#   r   r   s    r   sleepr&   G   s]      {899!|mm&&((($++-7888 	)8s!   7A,A((A,"A*#A,*A,c                      e Zd ZdZy)TooSlowErrorzRRaised by :func:`fail_after` and :func:`fail_at` if the timeout
    expires.

    N)__name__
__module____qualname____doc__r    r   r   r(   r(   Z   s    r   r(   c              #  x   K   t        |       5 }| ddd       j                  rt        y# 1 sw Y   xY ww)a  Creates a cancel scope with the given deadline, and raises an error if it
    is actually cancelled.

    This function and :func:`move_on_at` are similar in that both create a
    cancel scope with a given absolute deadline, and if the deadline expires
    then both will cause :exc:`Cancelled` to be raised within the scope. The
    difference is that when the :exc:`Cancelled` exception reaches
    :func:`move_on_at`, it's caught and discarded. When it reaches
    :func:`fail_at`, then it's caught and :exc:`TooSlowError` is raised in its
    place.

    Args:
      deadline (float): The deadline.

    Raises:
      TooSlowError: if a :exc:`Cancelled` exception is raised in this scope
        and caught by the context manager.
      ValueError: if deadline is NaN.

    N)r   cancelled_caughtr(   )r	   scopes     r   fail_atr0   c   s?     * 
H	   s   :.:7:c                b    | dk  rt        d      t        t        j                         | z         S )a  Creates a cancel scope with the given timeout, and raises an error if
    it is actually cancelled.

    This function and :func:`move_on_after` are similar in that both create a
    cancel scope with a given timeout, and if the timeout expires then both
    will cause :exc:`Cancelled` to be raised within the scope. The difference
    is that when the :exc:`Cancelled` exception reaches :func:`move_on_after`,
    it's caught and discarded. When it reaches :func:`fail_after`, then it's
    caught and :exc:`TooSlowError` is raised in its place.

    Args:
      seconds (float): The timeout.

    Raises:
      TooSlowError: if a :exc:`Cancelled` exception is raised in this scope
        and caught by the context manager.
      ValueError: if *seconds* is less than zero or NaN.

    r   r   )r   r0   r   r   r   s    r   
fail_afterr2      s0    ( {7884$$&011r   )r	   floatreturntrio.CancelScope)r   r3   r4   r5   )r4   None)r	   r3   r4   r6   )r   r3   r4   r6   )r	   r3   r4   (AbstractContextManager[trio.CancelScope])r   r3   r4   r7   )
__future__r   r
   
contextlibr   r   typingr   r   r   r   r!   r#   r&   	Exceptionr(   r0   r2   r    r   r   <module>r<      sS    "  =   / 5 W(9&9 6 W%G2r   