https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/asgiref/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/asgiref/__pycache__/timeout.cpython-310.pyc
o

�6�ap
�@s:ddlZddlmZddlmZmZmZGdd�d�ZdS)�N)�
TracebackType)�Any�Optional�Typec	@s�eZdZdZdd�deedeejddfdd�Zddd	�Z	d
e
edededee
fd
d�Zddd�Zd
e
edededdfdd�Zede
fdd��Zedeefdd��Zddd�Zd
e
eddfdd�Zddd�ZdS)�timeouta�timeout context manager.

    Useful in cases when you want to apply timeout logic around block
    of code or in cases when asyncio.wait_for is not suitable. For example:

    >>> with timeout(0.001):
    ...     async with aiohttp.get('https://github.com') as r:
    ...         await r.text()


    timeout - value in seconds or None to disable timeout logic
    loop - asyncio compatible event loop
    N)�loopr�returncCs8||_|durt��}||_d|_d|_d|_d|_dS)NF)�_timeout�asyncio�get_event_loop�_loop�_task�
_cancelled�_cancel_handler�
_cancel_at)�selfrr�r�1/usr/lib/python3/dist-packages/asgiref/timeout.py�__init__s
ztimeout.__init__cCs|��S�N��	_do_enter�rrrr�	__enter__,sztimeout.__enter__�exc_type�exc_val�exc_tbcCs|�|�dSr��_do_exit�rrrrrrr�__exit__/s
ztimeout.__exit__c�s
�|��Srrrrrr�
__aenter__8s�ztimeout.__aenter__c�s�|�|�dSrrrrrr�	__aexit__;s�ztimeout.__aexit__cCs|jSr)rrrrr�expiredCsztimeout.expiredcCs$|jdurt|j|j��d�SdS)Ng)r�maxr�timerrrr�	remainingGs
ztimeout.remainingcCst|jdur|St�|j�|_|jdurtd��|jdkr%|j�|j�|S|j��|j|_	|j�
|j	|j�|_|S)Nz4Timeout context manager should be used inside a taskr)r	r
�current_taskrr
�RuntimeError�	call_soon�_cancel_taskr%r�call_atrrrrrrNs

�
ztimeout._do_entercCsP|tjur|jrd|_d|_tj�|jdur#|jdur#|j��d|_d|_dSr)r
�CancelledErrorrrr
�TimeoutErrorr	�cancel)rrrrrrbs
ztimeout._do_exitcCs"|jdur|j��d|_dSdS)NT)r
r.rrrrrr*ms


�ztimeout._cancel_task)rr)rN)�__name__�
__module__�__qualname__�__doc__r�floatr
�AbstractEventLooprrr�
BaseExceptionr�boolr r!r"�propertyr#r&rrr*rrrrrsJ���
�
���
�
	���
�
r)r
�typesr�typingrrrrrrrr�<module>s

https://t.me/RX1948 - 2025