�
!A?h� � �� � d dl Z d dlmZ d dlmZmZmZ ddlmZ ddlm Z ddlm
Z
dZ G d � d
e j � � Z
e G d� d� � � � Zd
ee defd�Zdee defd�ZdS )� N)�
TracebackType)�final�Optional�Type� )�events)�
exceptions)�tasks)�Timeout�timeout�
timeout_atc �" � e Zd ZdZdZdZdZdZdS )�_State�created�active�expiring�expired�finishedN)�__name__�
__module__�__qualname__�CREATED�ENTERED�EXPIRING�EXPIRED�EXITED� � �=/opt/alt/python-internal/lib64/python3.11/asyncio/timeouts.pyr r s' � � � � � ��G��G��H��G�
�F�F�Fr r c �� � e Zd ZdZdee ddfd�Zdee fd�Zdee ddfd�Zde fd�Z
defd �Zdd
�Z
deee dee d
ee dee fd�Zdd�ZdS )r z�Asynchronous context manager for cancelling overdue coroutines.
Use `timeout()` or `timeout_at()` rather than instantiating this class directly.
�when�returnNc �R � t j | _ d| _ d| _ || _ dS )z�Schedule a timeout that will trigger at a given loop time.
- If `when` is `None`, the timeout will never trigger.
- If `when < loop.time()`, the timeout will trigger on the next
iteration of the event loop.
N)r r �_state�_timeout_handler�_task�_when)�selfr! s r �__init__zTimeout.__init__! s' � � �n���>B���+/��
���
�
�
r c � � | j S )zReturn the current deadline.)r' �r( s r r! zTimeout.when. s
� ��z�r c �� � | j t j ur?| j t j u rt d� � �t d| j j � d�� � �|| _ | j �| j � � � |� d| _ dS t j
� � }||� � � k r!|� | j
� � | _ dS |� || j
� � | _ dS )zReschedule the timeout.zTimeout has not been enteredzCannot change state of z TimeoutN)r$ r r r �RuntimeError�valuer' r% �cancelr �get_running_loop�time� call_soon�_on_timeout�call_at)r( r! �loops r �
reschedulezTimeout.reschedule2 s� � ��;�f�n�,�,��{�f�n�,�,�"�#A�B�B�B��E�$�+�*;�E�E�E�� �
� ��
�� �,��!�(�(�*�*�*��<�$(�D�!�!�!��*�,�,�D��t�y�y�{�{�"�"�(,���t�7G�(H�(H��%�%�%�(,���T�4�;K�(L�(L��%�%�%r c �@ � | j t j t j fv S )z$Is timeout expired during execution?)r$ r r r r+ s r r zTimeout.expiredI s � ��{�v����?�?�?r c �� � dg}| j t j u r6| j �t | j d� � nd }|� d|� �� � d� |� � }d| j j � d|� d�S )N� � zwhen=� z