+
    SjE                     J    ^ RI t ^ RIt^ RIt^RIHt ^RIHt  ! R R4      tR# )    N)guarantee_single_callable)timeoutc                      a  ] tR t^	t o RtR t]R 4       t]R 4       t]R 4       t	RR lt
RR ltR tR	 tRR
 ltRR ltRtV tR# )ApplicationCommunicatorzq
Runs an ASGI application in a test mode, allowing sending of
messages to it and retrieval of messages it sends.
c                \    R V n         \        V4      V n        W n        R V n        R V n        R # N)_futurer   applicationscope_input_queue_output_queue)selfr
   r   s   &&&D/var/www/idalgo/venv/lib/python3.14/site-packages/asgiref/testing.py__init__ ApplicationCommunicator.__init__   s+    4[A
 !    c                j    V P                   f   \        P                  ! 4       V n         V P                   # r   )r   asyncioQueuer   s   &r   input_queue#ApplicationCommunicator.input_queue   s(    $ 'D   r   c                j    V P                   f   \        P                  ! 4       V n         V P                   # r   )r   r   r   r   s   &r   output_queue$ApplicationCommunicator.output_queue   s(    %!(D!!!r   c                ,   V P                   f|   \        P                  ! 4       P                  \        P
                  V P                  V P                  V P                  P                  V P                  P                  4      4      V n         V P                   # r   )r	   contextvarsContextrunr   create_taskr
   r   r   getr   putr   s   &r   futureApplicationCommunicator.future$   so    <<
 '..044##  JJ 0 0 4 4d6G6G6K6KDL ||r   c                   "    \        V4      ;_uu_4       GRj  xL
   V P                  G Rj  xL
  V P                  P                  4        RRR4      GRj  xL
  V P                  P                  4       '       g2   V P                  P                  4         V P                  G Rj  xL
  R# R#  L L  \        P                   d     L~i ; i Lv  + GRj  xL 
 '       g   i     L; i LE  \        P                   d     R# i ; i  T P                  P                  4       '       gM   T P                  P                  4         T P                  G Rj  xL 
  i   \        P                   d     i i ; ii ; i5i)zF
Waits for the application to stop itself and returns any exceptions.
N)async_timeoutr#   resultr   CancelledErrordonecancel)r   r   s   &&r   waitApplicationCommunicator.wait3   s    	$W---++%%KK&&( .- ;;##%%""$++%% & .%-- 	 .--- &-- 	 ;;##%%""$++%%-- 	 &s   E>D B2D CB6B4B6D CD :E>C1 )C/*C1 .E>2D 4B66CCCCD C,	C
C,	%C,	'D /C1 1D
E>	D

E>;E;	EEEE;E74E;6E77E;;E>c                    V P                   pVf   R # VP                  4       '       g   VP                  4        R # V'       d   VP                  4        R # R # r   )r	   r)   r*   r'   )r   
exceptionsr#   s   && r   stopApplicationCommunicator.stopF   s8    >{{}}MMOMMO r   c                P     V P                  R R7       R#   \         d     R# i ; i)F)r.   N)r/   RuntimeErrorr   s   &r   __del__ApplicationCommunicator.__del__Q   s'    	III' 		s    %%c                   "   V P                   P                  4       '       d   V P                   P                  4        V P                  P	                  V4      G Rj  xL
  R#  L5i)z+
Sends a single message to the application
N)r#   r)   r'   r   r"   )r   messages   &&r   
send_input"ApplicationCommunicator.send_inputY   sF     
 ;;KK  ""7+++s   AA$A"A$c                  "   V P                   P                  4       '       d   V P                   P                  4         \        V4      ;_uu_4       GRj  xL
  V P                  P                  4       G Rj  xL
 uuRRR4      GRj  xL
  #  L8 L L	  + GRj  xL 
 '       g   i     R# ; i  \        P                   d   pT P                   P                  4       '       d   T P                   P                  4        ThT P                   P                  4         T P                   G Rj  xL 
  Th  \        P                   d     Thi ; iRp?ii ; i5i)zH
Receives a single message from the application, with optional timeout.
N)
r#   r)   r'   r&   r   r!   r   TimeoutErrorr*   r(   )r   r   es   && r   receive_output&ApplicationCommunicator.receive_outputd   s     
 ;;KK 	$W---!..2244 .--4 .---## 
	{{!!""$ G ""$++%% G -- G
	s   ;EB1 BB1 B7B8B;B1 B	B1 EB1 BB1 B.	B
B.	&B.	(B1 ,E.B1 1EAED4,D/-D42E4E	EEEEEc                  "   V P                   P                  4       '       d   V P                   P                  4        \        P                  ! 4       p\        P                  ! 4       V,
          V8  dC   V P
                  P                  4       '       g   R# \        P                  ! V4      G Rj  xL
  Kc  V P
                  P                  4       #  L 5i)z?
Checks that there is no message to receive in the given time.
FN)	r#   r)   r'   time	monotonicr   emptyr   sleep)r   r   intervalstarts   &&& r   receive_nothing'ApplicationCommunicator.receive_nothing{   s     
 ;;KK   nn&0$$**,,--)))  &&(( *s   BCC.C/!C)r	   r   r   r
   r   N)   )T)g?g{Gz?)__name__
__module____qualname____firstlineno____doc__r   propertyr   r   r#   r+   r/   r3   r7   r<   rE   __static_attributes____classdictcell__)__classdict__s   @r   r   r   	   sn     
" ! !
 " "
  &		,.) )r   r   )r   r   r?   compatibilityr   r   r&   r    r   r   <module>rS      s        4 -@) @)r   