+
    iy+                        ^ RI Ht ^ RIt^ RIt^ RIt^ RIHtHt ^ RIH	t	H
t
HtHtHtHt ^RIHt ^RIHtHtHtHt ^RIHt R.t]P0                  ! R	4      t]! R
4      t ! R R]],          4      t ! R R4      tR# )    )annotationsN)AsyncIteratorIterable)AnyCallableGenericLiteralTypeVaroverload)ConcurrencyError)	OP_BINARYOP_CONTOP_TEXTFrame)Data	Assemblerzutf-8Tc                  f    ] tR t^tRtR R ltR R ltR R ltRR R	 lltR
 R lt	R R lt
RtR# )SimpleQueuezy
Simplified version of :class:`asyncio.Queue`.

Provides only the subset of functionality needed by :class:`Assembler`.

c                   V ^8  d   QhRR/#    returnNone )formats   "b/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/websockets/asyncio/messages.py__annotate__SimpleQueue.__annotate__   s     ? ?$ ?    c                	|    \         P                  ! 4       V n        R V n        \        P
                  ! 4       V n        R # N)asyncioget_running_looploop
get_waitercollectionsdequequeueselfs   &r   __init__SimpleQueue.__init__   s)    ,,.	7;+6+<+<+>
r    c                   V ^8  d   QhRR/# )r   r   intr   )r   s   "r   r   r   "   s       r    c                	,    \        V P                  4      # r"   )lenr)   r*   s   &r   __len__SimpleQueue.__len__"   s    4::r    c                    V ^8  d   QhRRRR/# )r   itemr   r   r   r   )r   s   "r   r   r   %   s     - - -d -r    c                    V P                   P                  V4       V P                  e@   V P                  P                  4       '       g   V P                  P	                  R4       R# R# R# )zPut an item into the queue.N)r)   appendr&   done
set_result)r+   r5   s   &&r   putSimpleQueue.put%   sK    

$??&t/C/C/E/EOO&&t, 0F&r    c                    V ^8  d   QhRRRR/# )r   blockboolr   r   r   )r   s   "r   r   r   +   s     $ $t $q $r    c                  "   V P                   '       g~   V'       g   \        R4      hV P                  e   Q R4       hV P                  P	                  4       V n         V P                  G Rj  xL
  V P                  P                  4        RV n        V P                   P                  4       #  L?  T P                  P                  4        RT n        i ; i5i)z?Remove and return an item from the queue, waiting if necessary.stream of frames endedNzcannot call get() concurrently)r)   EOFErrorr&   r%   create_futurecancelpopleft)r+   r=   s   &&r   getSimpleQueue.get+   s     zzz788??*L,LL*"ii557DO'oo%%&&("&zz!!##	 &&&("&s4   C?CB. ,B,-B. 1;C,B. .#CCc                    V ^8  d   QhRRRR/# )r   itemszIterable[T]r   r   r   )r   s   "r   r   r   9   s     ! !; !4 !r    c                    V P                   e   Q R4       hV P                  '       d   Q R4       hV P                  P                  V4       R# )z)Put back items into an empty, idle queue.Nz%cannot reset() while get() is runningz&cannot reset() while queue isn't empty)r&   r)   extend)r+   rH   s   &&r   resetSimpleQueue.reset9   s>    &O(OO&:::GGG~

% r    c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   ?   s     N Nt Nr    c                    V P                   eI   V P                   P                  4       '       g'   V P                   P                  \        R4      4       R# R# R# )z8Close the queue, raising EOFError in get() if necessary.Nr@   )r&   r8   set_exceptionrA   r*   s   &r   abortSimpleQueue.abort?   s?    ??&t/C/C/E/EOO))(3K*LM 0F&r    )r&   r%   r)   N)T)__name__
__module____qualname____firstlineno____doc__r,   r2   r:   rE   rK   rP   __static_attributes__r   r    r   r   r      s,    ?
-$!N Nr    r   c                     ] tR t^EtRtRRR R 3R R llt]R R l4       t]R	 R
 l4       t]R R R ll4       tR R R llt]R R l4       t]R R l4       t]R R R ll4       tR R R lltR R lt	R R lt
R R ltR R ltRtR# )!r   a  
Assemble messages from frames.

:class:`Assembler` expects only data frames. The stream of frames must
respect the protocol; if it doesn't, the behavior is undefined.

Args:
    pause: Called when the buffer of frames goes above the high water mark;
        should pause reading from the network.
    resume: Called when the buffer of frames goes below the low water mark;
        should resume reading from the network.

Nc                 	    R # r"   r   r   r    r   <lambda>Assembler.<lambda>X   s    4r    c                 	    R # r"   r   r   r    r   rZ   r[   Y   s    Dr    c          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r   highz
int | NonelowpausezCallable[[], Any]resumer   r   r   )r   s   "r   r   Assembler.__annotate__T   s<            !	 
 "  
 r    c                	   \        4       V n        Ve   Vf
   V^,          pVf   Ve
   V^,          pVe(   Ve$   V^ 8  d   \        R4      hW8  d   \        R4      hWuV n        V n        W0n        W@n        RV n        RV n        RV n	        R # )Nz%low must be positive or equal to zeroz)high must be greater than or equal to lowF)
r   frames
ValueErrorr^   r_   r`   ra   pausedget_in_progressclosed)r+   r^   r_   r`   ra   s   &&&&&r   r,   Assembler.__init__T   s     +6- !)C<CO7DQw !HIIz !LMM"	48
  % r    c                    V ^8  d   QhRRRR/# )r   decodeLiteral[True]r   strr   )r   s   "r   r   rb   w   s    :::#:r    c                	   "   R # 5ir"   r   r+   rk   s   &&r   rE   Assembler.getv   s     7:   c                    V ^8  d   QhRRRR/# )r   rk   Literal[False]r   bytesr   )r   s   "r   r   rb   z   s    ===5=r    c                	   "   R # 5ir"   r   ro   s   &&r   rE   rp   y   s     :=rq   c                    V ^8  d   QhRRRR/# r   rk   bool | Noner   r   r   )r   s   "r   r   rb   }   s    @@@t@r    c                	   "   R # 5ir"   r   ro   s   &&r   rE   rp   |   s     =@rq   c                    V ^8  d   QhRRRR/# rw   r   )r   s   "r   r   rb      s     ; ; ;t ;r    c                Z  "   V P                   '       d   \        R4      hRV n          V P                  P                  V P                  '       * 4      G Rj  xL
 pV P                  4        VP                  \        J g   VP                  \        J g   Q hVf   VP                  \        J pV.pVP                  '       gm    V P                  P                  V P                  '       * 4      G Rj  xL
 pT P                  4        TP                  \        J g   Q hTP                  T4       K~   RV n         RP                  R V 4       4      pV'       d   VP!                  4       # V#  EL Lz  \        P                   d    T P                  P                  T4       h i ; i  RT n         i ; i5i)a  
Read the next message.

:meth:`get` returns a single :class:`str` or :class:`bytes`.

If the message is fragmented, :meth:`get` waits until the last frame is
received, then it reassembles the message and returns it. To receive
messages frame by frame, use :meth:`get_iter` instead.

Args:
    decode: :obj:`False` disables UTF-8 decoding of text frames and
        returns :class:`bytes`. :obj:`True` forces UTF-8 decoding of
        binary frames and returns :class:`str`.

Raises:
    EOFError: If the stream of frames has ended.
    UnicodeDecodeError: If a text frame contains invalid UTF-8.
    ConcurrencyError: If two coroutines run :meth:`get` or
        :meth:`get_iter` concurrently.

&get() or get_iter() is already runningTNFr    c              3  8   "   T F  qP                   x  K  	  R # 5ir"   )data).0frames   & r   	<genexpr> Assembler.get.<locals>.<genexpr>   s     7u

s   )rg   r   rd   rE   rh   maybe_resumeopcoder   r   finr#   CancelledErrorrK   r   r7   joinrk   )r+   rk   r   rd   r~   s   &&   r   rE   rp      s[    , "#KLL#
	)++//dkk/::E<<7*elli.GGG~0WF iii"&++//dkk/"BBE !!#||w...e$   $)D  xx777;;= K9 ; C--  KK%%f-	 $)D s_   %F+-F E%A(F  -E* -E(.E* 29F ,&F+F+%F (E* *2FF 	F((F+c                    V ^8  d   QhRRRR/# )r   rk   rl   r   zAsyncIterator[str]r   )r   s   "r   r   rb      s    HH}H1CHr    c                	    R # r"   r   ro   s   &&r   get_iterAssembler.get_iter   s    EHr    c                    V ^8  d   QhRRRR/# )r   rk   rs   r   zAsyncIterator[bytes]r   )r   s   "r   r   rb      s    KK~K2FKr    c                	    R # r"   r   ro   s   &&r   r   r      s    HKr    c                    V ^8  d   QhRRRR/# r   rk   rx   r   zAsyncIterator[Data]r   )r   s   "r   r   rb      s    NN{N6INr    c                	    R # r"   r   ro   s   &&r   r   r      s    KNr    c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   rb      s     C% C%[ C%<O C%r    c                 "   V P                   '       d   \        R4      hRV n          V P                  P                  V P                  '       * 4      G Rj  xL
 pT P                  4        TP                  \        J g   TP                  \        J g   Q hTf   TP                  \        J pT'       d5   \        4       pTP                  TP                  TP                  4      5x  M\        TP                  4      5x  TP                  '       g   T P                  P                  T P                  '       * 4      G Rj  xL
 pT P                  4        TP                  \         J g   Q hT'       d,   XP                  TP                  TP                  4      5x  K  \        TP                  4      5x  K  RT n         R#  ELi  \
        P                   d
    RT n         h i ; i L5i)a0  
Stream the next message.

Iterating the return value of :meth:`get_iter` asynchronously yields a
:class:`str` or :class:`bytes` for each frame in the message.

The iterator must be fully consumed before calling :meth:`get_iter` or
:meth:`get` again. Else, :exc:`ConcurrencyError` is raised.

This method only makes sense for fragmented messages. If messages aren't
fragmented, use :meth:`get` instead.

Args:
    decode: :obj:`False` disables UTF-8 decoding of text frames and
        returns :class:`bytes`. :obj:`True` forces UTF-8 decoding of
        binary frames and returns :class:`str`.

Raises:
    EOFError: If the stream of frames has ended.
    UnicodeDecodeError: If a text frame contains invalid UTF-8.
    ConcurrencyError: If two coroutines run :meth:`get` or
        :meth:`get_iter` concurrently.

r|   TNF)rg   r   rd   rE   rh   r#   r   r   r   r   r   UTF8Decoderrk   r~   r   rt   r   )r+   rk   r   decoders   &&  r   r   r      s^    2 "#KLL#	++//dkk/::E 	||w&%,,)*CCC>\\W,F!mG..UYY77 

## )))
 ++//dkk/::E<<7***nnUZZ;; EJJ''$= ;%% 	#(D 	( ;sO   %G$-G F>G AG$2AG$-G$=G">1G$0AG$>G GG$c                    V ^8  d   QhRRRR/# )r   r   r   r   r   r   )r   s   "r   r   rb   
  s       4 r    c                    V P                   '       d   \        R4      hV P                  P                  V4       V P	                  4        R# )z_
Add ``frame`` to the next message.

Raises:
    EOFError: If the stream of frames has ended.

r@   N)rh   rA   rd   r:   maybe_pause)r+   r   s   &&r   r:   Assembler.put
  s5     ;;;344r    c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rb     s     	 	T 	r    c                    V P                   f   R# \        V P                  4      V P                   8  d.   V P                  '       g   RV n        V P	                  4        R# R# R# )z7Pause the writer if queue is above the high water mark.NT)r^   r1   rd   rf   r`   r*   s   &r   r   Assembler.maybe_pause  sH     99 t{{dii'DKJJL 1<'r    c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rb   #  s     	 	d 	r    c                    V P                   f   R# \        V P                  4      V P                   8:  d.   V P                  '       d   RV n        V P	                  4        R# R# R# )z7Resume the writer if queue is below the low water mark.NF)r_   r1   rd   rf   ra   r*   s   &r   r   Assembler.maybe_resume#  sH     88 t{{txx'DKKKDKKKM -8'r    c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rb   .  s      t r    c                p    V P                   '       d   R# RV n         V P                  P                  4        R# )z
End the stream of frames.

Calling :meth:`close` concurrently with :meth:`get`, :meth:`get_iter`,
or :meth:`put` is safe. They will raise :exc:`EOFError`.

NT)rh   rd   rP   r*   s   &r   closeAssembler.close.  s)     ;;; 	r    )rh   rd   rg   r^   r_   r`   rf   ra   r"   )rR   rS   rT   rU   rV   r,   r   rE   r   r:   r   r   r   rW   r   r    r   r   r   E   s       #/$0 D : := =@ @;z H HK KN NC%J		 r    )
__future__r   r#   codecsr'   collections.abcr   r   typingr   r   r   r	   r
   r   
exceptionsr   rd   r   r   r   r   r   __all__getincrementaldecoderr   r   r   r   r   r    r   <module>r      sg    "    3 E E ) 7 7  -**73CL-N'!* -N`w wr    