
     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dS )    )annotationsN)AbstractContextManagercontextmanager)TYPE_CHECKINGdeadlinefloatreturntrio.CancelScopec                r    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r   )mathisnan
ValueErrortrioCancelScoper   s    Q/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/trio/_timeouts.py
move_on_atr   
   s9     z( 53444X....    secondsc                r    | 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r   s    r   move_on_afterr      s8     {{7888d'))G3444r   Nonec                 V   K   t           j                            d            d{V  dS )z}Pause execution of the current task forever (or until cancelled).

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

    c                .    t           j        j        j        S )N)r   lowlevelAbort	SUCCEEDED)_s    r   <lambda>zsleep_forever.<locals>.<lambda>0   s    8K8U r   N)r   r   wait_task_rescheduled r   r   sleep_foreverr%   *   s:       -
-
-.U.U
V
VVVVVVVVVVr   c                   K   t          |           5  t                       d{V  ddd           dS # 1 swxY w Y   dS )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   s        
H		  oo                 s   488c                   K   | dk     rt          d          | dk    r&t          j                                         d{V  dS t	          t          j                    | z              d{V  dS )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9!||m&&((((((((((($+--788888888888r   c                      e Zd ZdZdS )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,   (AbstractContextManager[trio.CancelScope]c              #  |   K   t          |           5 }|V  ddd           n# 1 swxY w Y   |j        rt          dS )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_atr5   c   s      * 
H		                 s   #''c                r    | 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   r5   r   r   r   s    r   
fail_afterr7      s8    ( {{78884$&&0111r   )r   r   r	   r
   )r   r   r	   r
   )r	   r   )r   r   r	   r   )r   r   r	   r   )r   r   r	   r1   )r   r   r	   r1   )
__future__r   r   
contextlibr   r   typingr   r   r   r   r%   r'   r*   	Exceptionr,   r5   r7   r$   r   r   <module>r<      s0   " " " " " "  = = = = = = = =             / / / / 5 5 5 5 W W W W   (9 9 9 9&    9      6  &nW%%G2 2 2 2 2 2r   