+
    öÙ†jS-  ã                   óf   € R t ^ RIHt ^ RIHt  ! R R]P
                  4      t ! R R4      tR tR# )	a¥  A class supporting chat-style (command/response) protocols.

This class adds support for 'chat' style protocols - where one side
sends a 'command', and the other sends a response (examples would be
the common internet protocols - smtp, nntp, ftp, etc..).

The handle_read() method looks at the input stream for the current
'terminator' (usually '\r\n' for single-line responses, '\r\n.\r\n'
for multi-line output), calling self.found_terminator() on its
receipt.

for example:
Say you build an async nntp client using this class.  At the start
of the connection, you'll have self.terminator set to '\r\n', in
order to process the single-line greeting.  Just before issuing a
'LIST' command you'll set it to '\r\n.\r\n'.  The output of the LIST
command will be accumulated (using your own 'collect_incoming_data'
method) up to the terminator, and then control will be returned to
you - by calling your self.found_terminator() method.
)Údeque)Úasyncorec                   óž   a € ] tR t^;t o RtRtRt^ tRtRR lt	R t
R tR tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )Ú
async_chatzƒThis is an abstract class.  You must derive from this class, and add
the two methods collect_incoming_data() and found_terminator()i   zlatin-1Nc                ó€   € R V n         . V n        \        4       V n        \        P
                  P                  WV4       R# )ó    N)Úac_in_bufferÚincomingr   Úproducer_fifor   Ú
dispatcherÚ__init__)ÚselfÚsockÚmaps   &&&Ú,/usr/lib/python3.14/test/support/asynchat.pyr   Úasync_chat.__init__J   s5   € àˆÔð
 ˆŒô #›WˆÔÜ×Ñ×$Ñ$ T°Ö5r   c                ó   € \        R 4      h©zmust be implemented in subclass©ÚNotImplementedError©r   Údatas   &&r   Úcollect_incoming_dataÚ async_chat.collect_incoming_dataX   ó   € Ü!Ð"CÓDÐDr   c                ó<   € V P                   P                  V4       R # ©N)r	   Úappendr   s   &&r   Ú_collect_incoming_dataÚ!async_chat._collect_incoming_data[   s   € Ø�‰×Ñ˜TÖ"r   c                óV   € R P                  V P                  4      pV P                  R V# )r   ºNNN)Újoinr	   )r   Úds   & r   Ú	_get_dataÚasync_chat._get_data^   s%   € Ø�H‰H�T—]‘]Ó#ˆØ�M‰M˜!ÐØˆr   c                ó   € \        R 4      hr   r   ©r   s   &r   Úfound_terminatorÚasync_chat.found_terminatorc   r   r   c                óÞ   € \        V\        4      '       d)   V P                  '       d   \        WP                  4      pM(\        V\
        4      '       d   V^ 8  d   \        R4      hWn        R# )zTSet the input delimiter.

Can be a fixed string of any length, an integer, or None.
z-the number of received bytes must be positiveN)Ú
isinstanceÚstrÚuse_encodingÚbytesÚencodingÚintÚ
ValueErrorÚ
terminator)r   Úterms   &&r   Úset_terminatorÚasync_chat.set_terminatorf   sN   € ô
 �dœC× Ò  T×%6×%6Ð%6Ü˜Ÿ}™}Ó-‰DÜ˜œc×"Ò" t¨a¤xÜÐLÓMÐMØŽr   c                ó   € V P                   # r   )r2   r'   s   &r   Úget_terminatorÚasync_chat.get_terminatorq   s   € Ø�‰Ðr   c                ó`  €  V P                  V P                  4      p\        T\        4      '       d-   T P                  '       d   \        \        T P                  4      pT P                  T,           T n
        T P                  '       Edö   \        T P                  4      pT P                  4       pT'       g%   T P                  T P                  4       RT n
        Kd  \        T\        4      '       d‘   TpY$8  d=   T P                  T P                  4       RT n
        T P                  T,
          T n        K¾  T P                  T P                  R T 4       T P                  TR  T n
        ^ T n        T P!                  4        EK
  \        T4      pT P                  P#                  T4      pTR8w  dS   T^ 8”  d   T P                  T P                  R T 4       T P                  Ye,           R  T n
        T P!                  4        EK‰  \%        T P                  T4      pT'       d=   Yb8w  d5   T P                  T P                  R T)  4       T P                  T) R  T n
        R # T P                  T P                  4       RT n
        EK  R #   \         d     R # \         d    T P	                  4         R # i ; i)Nr   éÿÿÿÿ)ÚrecvÚac_in_buffer_sizeÚBlockingIOErrorÚOSErrorÚhandle_errorr+   r,   r-   r.   r/   r   Úlenr7   r   r0   r2   r(   ÚfindÚfind_prefix_at_end)r   r   Úlbr2   ÚnÚterminator_lenÚindexs   &      r   Úhandle_readÚasync_chat.handle_ready   s>  € ð	Ø—9‘9˜T×3Ñ3Ó4ˆDô �dœC× Ò  T×%6×%6Ð%6Üœ˜dŸm™mÓ,ˆDØ ×-Ñ-°Õ4ˆÔð ××ÑÜ�T×&Ñ&Ó'ˆBØ×,Ñ,Ó.ˆJßà×*Ñ*¨4×+<Ñ+<Ô=Ø$'�Ö!Ü˜J¬×,Ò,à�Ø”6Ø×.Ñ.¨t×/@Ñ/@ÔAØ(+�DÔ%Ø&*§o¡o¸Õ&:�D–Oà×.Ñ.¨t×/@Ñ/@ÀÀ!Ð/DÔEØ(,×(9Ñ(9¸!¸"Ð(=�DÔ%Ø&'�D”OØ×)Ñ)×+ô "% Z£�Ø×)Ñ)×.Ñ.¨zÓ:�Ø˜B”;à˜q”yð ×2Ñ2°4×3DÑ3DÀVÀeÐ3LÔMØ(,×(9Ñ(9¸%Õ:NÐ:OÐ(P�DÔ%ð ×)Ñ)×+ô /¨t×/@Ñ/@À*ÓM�EßØ œ;à ×6Ñ6°t×7HÑ7HÈÈ5È&Ð7QÔRØ04×0AÑ0AÀ5À&À'Ð0J˜DÔ-Ùð ×2Ñ2°4×3DÑ3DÔEØ,/˜×)ñg  øô ô 	ÚÜô 	Ø×ÑÔÚð	ús   ‚J ÊJ-ÊJ-ÊJ-Ê,J-c                ó&   € V P                  4        R # r   )Úinitiate_sendr'   s   &r   Úhandle_writeÚasync_chat.handle_writeÁ   s   € Ø×ÑÖr   c                ó&   € V P                  4        R # r   )Úcloser'   s   &r   Úhandle_closeÚasync_chat.handle_closeÄ   s   € Ø�
‰
Žr   c                ó‚  € \        V\        \        \        34      '       g   \	        R \        V4      4      hV P                  p\        V4      V8”  dB   \        ^ \        V4      V4       F&  pV P                  P                  WW2,            4       K(  	  MV P                  P                  V4       V P                  4        R# )z#data argument must be byte-ish (%r)N)r+   r.   Ú	bytearrayÚ
memoryviewÚ	TypeErrorÚtypeÚac_out_buffer_sizer@   Úranger
   r   rJ   )r   r   ÚsabsÚis   &&  r   ÚpushÚasync_chat.pushÇ   s—   € Ü˜$¤¬	´:Ð >×?Ò?ÜÐAÜ  ›Jó(ð (à×&Ñ&ˆÜˆt‹9�tÔÜ˜1œc $›i¨Ö.�Ø×"Ñ"×)Ñ)¨$°µ¨.Ö9ò /ð ×Ñ×%Ñ% dÔ+Ø×ÑÖr   c                ó\   € V P                   P                  V4       V P                  4        R # r   )r
   r   rJ   )r   Úproducers   &&r   Úpush_with_producerÚasync_chat.push_with_producerÓ   s"   € Ø×Ñ×!Ñ! (Ô+Ø×ÑÖr   c                ó   € ^# )z4predicate for inclusion in the readable for select()© r'   s   &r   ÚreadableÚasync_chat.readable×   s   € ñ r   c                óL   € V P                   ;'       g    V P                  '       * # )z4predicate for inclusion in the writable for select())r
   Ú	connectedr'   s   &r   ÚwritableÚasync_chat.writableß   s   € à×!Ñ!×9Ð9¨$¯.©.Ô&8Ð9r   c                ó<   € V P                   P                  R4       R# )zAautomatically close this channel once the outgoing queue is emptyN)r
   r   r'   s   &r   Úclose_when_doneÚasync_chat.close_when_doneã   s   € à×Ñ×!Ñ! $Ö'r   c                ó  € V P                   '       dþ   V P                  '       dê   V P                   ^ ,          pV'       g$   V P                   ^  Vf   V P                  4        R# V P                  p VRV p\        T\        4      '       d(   T P                  '       d   \        Y0P                  4      p T P                  T4      pT'       dA   T\        T4      8  g   T\        T4      8  d   YR T P                   ^ &   R# T P                   ^  R# R# R#   \         dG    TP                  4       pT'       d   T P                   P                  T4       MT P                   ^   EKa  i ; i  \         d    T P                  4         R# i ; i)é    N)r
   re   rO   rV   rT   ÚmoreÚ
appendleftr+   r,   r-   r.   r/   Úsendr>   r?   r@   )r   ÚfirstÚobsr   Únum_sents   &    r   rJ   Úasync_chat.initiate_sendç   sW  € Ø× × Ð  T§^§^ ^Ø×&Ñ& qÕ)ˆEçØ×&Ñ& qÐ)Ø’=Ø×%Ñ%Ô'Ùð ×)Ñ)ˆCðØ˜T˜c�{�ô ˜$¤×$Ò$¨×):×):Ð):Ü˜T§=¡=Ó1�ðØŸ9™9 T›?�÷
 Øœc $›iÔ'¨3´°U³Ô+;Ø,1°)Ð,<�D×&Ñ& qÑ)ñ ð ×*Ñ*¨1Ð-áñK &4Ñ øô ô Ø—z‘z“|�ßØ×&Ñ&×1Ñ1°$Õ7à×*Ñ*¨1Ð-Ûðûô ô Ø×!Ñ!Ô#Úðús*   Á0D Â3E& Ä"E#Ä5)E#Å"E#Å&FÆFc                ób   € R V n         V P                  R V P                  P                  4        R# )r   r!   N)r   r	   r
   Úclearr'   s   &r   Údiscard_buffersÚasync_chat.discard_buffers  s(   € àˆÔØ�M‰M˜!ÐØ×Ñ× Ñ Ö"r   )r   r	   r
   r2   )NN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r<   rV   r-   r/   r   r   r   r$   r(   r4   r7   rG   rK   rO   rZ   r^   rb   rf   ri   rJ   rv   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r   ;   s„   ø‡ € ñFð
 ÐØÐð
 €LØ€Hô6òEò#òò
Eò	òòF0òPòò
òòò:ò(ò&÷P#ð #r   r   c                   ó0   a € ] tR tRt o RR ltR tRtV tR# )Úsimple_produceri  c                ó   € Wn         W n        R # r   )r   Úbuffer_size)r   r   r„   s   &&&r   r   Úsimple_producer.__init__  s   € ØŒ	Ø&Ör   c                óæ   € \        V P                  4      V P                  8”  d:   V P                  R V P                   pV P                  V P                  R  V n        V# V P                  pRV n        V# )Nr   )r@   r   r„   )r   Úresults   & r   rm   Úsimple_producer.more  sb   € Üˆt�y‰y‹>˜D×,Ñ,Ô,Ø—Y‘YÐ0 × 0Ñ 0Ð1ˆFØŸ	™	 $×"2Ñ"2Ð"3Ð4ˆDŒIØˆMà—Y‘YˆFØˆDŒIØˆMr   )r„   r   N)i   )rx   ry   rz   r{   r   rm   r}   r~   r   s   @r   r‚   r‚     s   ø‡ € ô'÷ð r   r‚   c                 ó„   € \        V4      ^,
          pV'       d&   V P                  VRV 4      '       g   V^,          pK-  V# )é   N)r@   Úendswith)ÚhaystackÚneedleÚls   && r   rB   rB   6  s6   € ÜˆF‹�a�€Aß
�H×%Ñ% f¨R¨a j×1Ò1Ø	ˆQ�ŠØ€Hr   N)	r|   Úcollectionsr   Útest.supportr   r   r   r‚   rB   ra   r   r   Ú<module>r‘      s8   ðñBõ* å !ôX#�×$Ñ$ô X#÷vñ ô@r   