+
    iC  c                   s   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIHt ^ RIHtHtHt ^RIHtHt ]P,                  ! R4      P.                  tR R lt^t]P4                  ! ]4      tRt ! R R	]P<                  4      t ! R
 R]P@                  4      t! ! R R4      t" ! R R]]PF                  4      t# ! R R]4      t$ ! R R4      t%R# )zKBi-directional asyncio.Transport implementations based on file descriptors.N)Thread)AnyClassVarSequence)
JsonObjectget_intc                s(    V ^8  d   QhR\         RR/# )   argsreturnNintformat   "7/usr/lib/python3.14/site-packages/cockpit/transports.py__annotate__r      s     ( ( ( (    c                  s8    \        V !  ^ 8w  d   \        R4      hR# )    zprctl() failedN)	sys_prctlOSError)r   s   *r   prctlr      s     $1&'' r   i   c                   s  a a ] tR t^*t oR2tRtR3V3R lV 3R llltV3R lR ltV3R lR ltV3R lR	 lt	V3R
 lR lt
V3R lR ltV3R lR ltR4V3R lR lltV3R lR ltV3R lR ltV3R lR ltV3R lR ltR5V3R lR lltV3R lR ltV3R lR ltV3R  lR! ltV3R" lR# ltV3R$ lR% ltV3R& lR' ltV3R( lR) ltV3R* lR+ ltV3R, lR- ltV3R. lR/ ltV3R0 ltR1tVtV ;t # )6
_TransportFc          
      s^   < V ^8  d   QhRS[ P                  RS[ P                  RS[RS[RR/# )r   loopprotocolin_fdout_fdextrazdict[str, object] | NoneasyncioAbstractEventLoopProtocolr
   r   __classdict__   "r   r   _Transport.__annotate__9   sG      00"++  +. 3	r   c                sz  < \         SV `  V4       Wn        W n        \        P                  R WW44       RV n        RV n        RV n        RV n	        W0n
        W@n        \        P                  ! VR4       WC8w  d   \        P                  ! VR4       V P                  P                  V 4       V P                  4        R# )z/Created transport %s for protocol %s, fds %d %dNF)super__init___loop	_protocolloggerdebug_queue_is_reading_eof_closing_in_fd_out_fdosset_blockingZconnection_maderesume_reading)selfr   r   r   r   r   	__class__s   &&&&&&r   r$   Z_Transport.__init__9   s    
 	
!FX]f 	
u%?OOFE*&&t,r   c                   < V ^8  d   QhRR/# r   r   N r   r!   r   r   r"   T   s      T r   c                s   \         P                  R W P                  V P                  4        \        P
                  ! V P                  \        P                  4      pTR8w  d=   \         P                  R\        T4      4       T P                  P                  T4       R# \         P                  R4       T P!                  4        T P                  P#                  4       pT'       g   T P%                  4        R# R#   \         d     R# \         dU   pT P                  '       d'   TP                  \        P                  8X  d   Rp Rp?LT P                  T4        Rp?R# Rp?ii ; i)zRead ready on %s %s %dNr   z  read %d bytesz	  got EOF)r'   r(   r&   r-   r/   readr   
BLOCK_SIZEBlockingIOErrorr   _eio_is_eoferrnoZEIOabortlenZdata_received_close_readerZeof_receivedclose)r2   dataexcZ	keep_open   &   r   _read_readyZ_Transport._read_readyT   s    -t^^T[[Q	774;;
(=(=>D 3;LL*CI6NN((.LL% 335I

 %  	 	CII$: 

3	s)   /C: :E&E&E&3E!
E!!E&c                    < V ^8  d   QhRS[ /# r   r   boolr   r!   r   r   r"   m   s        D  r   c                    V P                   # N)r*   r2      &r   
is_readingZ_Transport.is_readingm       r   c                r4   r5   r6   r   r!   r   r   r"   p   s      t r   c                s4    V P                  4        RV n        R#    N)pause_readingr-   rJ   rK   r   r>   Z_Transport._close_readerp   s    r   c                r4   r5   r6   r   r!   r   r   r"   t   s     % %t %r   c                s    V P                   '       d/   V P                  P                  V P                  4       R V n         R# R# )FN)r*   r%   remove_readerr-   rJ   rK   r   rQ   Z_Transport.pause_readingt   s1    JJ$$T[[1$D r   c                r4   r5   r6   r   r!   r   r   r"   y   s     $ $ $r   c                s    V P                   '       gM   V P                  R8w  d:   V P                  P                  V P                  V P                  4       RV n         R# R# R# )rO   TNrP   )r*   r-   r%   
add_readerrC   rJ   rK   r   r1   Z_Transport.resume_readingy   sI     DKK2$5JJ!!$++t/?/?@#D %6r   c                r4   r5   r6   r   r!   r   r   r"      s       r   c                    R # rI   r6   rJ   rK   r   _closeZ_Transport._close   s    r   c                "   < V ^8  d   QhRRRR/# )r   rA   zException | Noner   Nr6   r   r!   r   r   r"      s      + t r   c                s    R V n         V P                  4        V P                  4        V P                  P	                  V P
                  P                  V4       V P                  4        R# )TN)r,   r>   _remove_write_queuer%   Z	call_soonr&   Zconnection_lostrU   )r2   rA      &&r   r<   Z_Transport.abort   sH      "

T^^;;SAr   c                rD   rE   rF   r   r!   r   r   r"      s     " "t "r   c                    \         hrI   ZNotImplementedErrorrJ   rK   r   can_write_eofZ_Transport.can_write_eof       !!r   c                r4   r5   r6   r   r!   r   r   r"      s     O O4 Or   c                s    V P                   '       d   Q hR V n         V P                  f)   \        P                  RV 4       V P	                  4        R# \        P                  RV 4       R# )TNz%s got EOF.  closing backend.z,%s got EOF.  bytes in queue, deferring close)r+   r)   r'   r(   _write_eof_nowrJ   rK   r   	write_eofZ_Transport.write_eof   sK    999}	;;LL8$?!LLGNr   c                rD   rE   r	   r   r!   r   r   r"      s     8 8s 8r   c                sZ    V P                   f   ^ # \        R V P                    4       4      # )Nc              3   s8   "   T F  p\        V4      x  K  	  R # 5irI   )r=   )Z.0block   & r   Z	<genexpr>Z3_Transport.get_write_buffer_size.<locals>.<genexpr>   s     7;%3u::;s   )r)   ZsumrJ   rK   r   get_write_buffer_sizeZ _Transport.get_write_buffer_size   s$    ;;74;;777r   c                r4   )r   r   ztuple[int, int]r6   r   r!   r   r   r"      s      ): r   c                s    R# )r   )r   r   r6   rJ   rK   r   get_write_buffer_limitsZ"_Transport.get_write_buffer_limits   s    r   c                s&   < V ^8  d   QhRRRRRR/# )r   high
int | Nonelowr   Nr6   r   r!   r   r   r"      s#     ' 'L 'l '^b 'r   c                s>    Ve
   V^ 8X  g   Q hVe   V^ 8X  g   Q hR # R # rI   r6   )r2   rc   re      &&&r   set_write_buffer_limitsZ"_Transport.set_write_buffer_limits   s(    |tqy(({cQh&&h{r   c                r4   r5   r6   r   r!   r   r   r"      s     " " "r   c                rY   rI   rZ   rJ   rK   r   r]   Z_Transport._write_eof_now   r\   r   c                r4   r5   r6   r   r!   r   r   r"      s      d r   c                s   \         P                  R V 4       V P                  f   Q h \        P                  ! V P
                  V P                  4      p\         P                  RT4       T'       d   T P                  P                  4       p\        T4      T8  d4   \         P                  R4       T P                  P                  Y1R 4       M*T\        T4      ,          p\         P                  RT4       K  T P                  '       g   \         P                  R4       T P                  4        T P                  '       d&   \         P                  R4       T P                  4        T P                  '       d   T P                  4        R# R# R#   \         d    ^ p ELK\         d   pT P                  T4        Rp?R# Rp?ii ; i)z%s _write_readyNz,  successfully wrote %d bytes from the queuez  incomplete block.  Stop.z&  removed complete block.  %d remains.z%s queue drained.z'%s queue drained.  closing backend now.)r'   r(   r)   r/   Zwritevr.   r9   r   r<   Zpopleftr=   Z
appendleftrW   r+   r]   r,   )r2   n_bytesrA   r_   rB   r   _write_readyZ_Transport._write_ready   s@   &-{{&&&	iidkk:G 	CWMKK'')E5zG#9:&&uX7s5z!GLLA7K{{{LL,-$$&yyyFG##%}}}

  %  	G 	JJsO	s#   +F GG'G(F??Gc                r4   r5   r6   r   r!   r   r   r"      s      T r   c                s    V P                   eI   V P                  P                  4        V P                  P	                  V P
                  4       R V n         R # R # rI   )r)   r&   Zresume_writingr%   Zremove_writerr.   rJ   rK   r   rW   Z_Transport._remove_write_queue   s>    ;;"NN))+JJ$$T\\2DK #r   c                $   < V ^8  d   QhRS[ RR/# r   r@   r   Nbytesr   r!   r   r   r"      s     ' ' '$ 'r   c                s2   \         P                  R W P                  4       V P                  e   Q hV P                  P                  V P                  V P                  4       \        P                  ! V34      V n        V P                  P                  4        R# )z!%s creating write queue for fd %sN)r'   r(   r.   r)   r%   Z
add_writerri   collectionsZdequer&   Zpause_writingr2   r@   rX   r   _create_write_queueZ_Transport._create_write_queue   sg    8$M{{"""

dllD,=,=>!''0$$&r   c                rj   rk   rl   r   r!   r   r   r"      s     5 5% 5D 5r   c                s   V P                   '       d#   \        P                  R V P                  4       R# V P                  '       d   Q hV P
                  e   V P
                  P                  V4       \        V P
                  4      \        8  dQ   RP                  V P
                  4      pV P
                  P                  4        V P
                  P                  V4       R#  \        P                  ! V P                  V4      pT\        T4      8w  d   T P!                  YR 4       R# R#   \         d    ^ p L6\         d   pT P                  T4        Rp?R# Rp?ii ; i)z+ignoring write() to closing transport fd %iNr   )r,   r'   r(   r.   r+   r)   appendr=   IOV_MAXjoinZclearr/   writer9   r   r<   rp   )r2   r@   Zall_datarh   rA   s   &&   r   rt   Z_Transport.write   s    ===LLFU999};;"KKt$ 4;;')88DKK0!!#""8,	hht||T2G c$i$$T(^4    	G 	JJsO	s$   #!D+ +E :E E EE c                r4   r5   r6   r   r!   r   r   r"      s      t r   c                s    V P                   '       d   R # RV n         V P                  4        V P                  e   R # V P                  4        R # )NT)r,   r>   r)   r<   rJ   rK   r   r?   Z_Transport.close   s7    ===;;"

r   c                s4   < V ^8  d   QhRS[ P                  /# rE   r   ZBaseProtocolr   r!   r   r   r"     s      g22 r   c                rH   rI   )r&   rJ   rK   r   get_protocolZ_Transport.get_protocol  s    ~~r   c                rD   rE   rF   r   r!   r   r   r"     s      D r   c                rH   rI   )r,   rJ   rK   r   
is_closingZ_Transport.is_closing  s    }}r   c                8   < V ^8  d   QhRS[ P                  RR/# )r   r   r   Nru   r   r!   r   r   r"     s!     " "W%9%9 "d "r   c                rY   rI   rZ   )r2   r   rX   r   set_protocolZ_Transport.set_protocol  r\   r   c                r4   r5   r6   r   r!   r   r   r"   
  s       r   c                &    V P                  4        R # rI   )rU   rJ   rK   r   __del__Z_Transport.__del__
  s    r   c                s   < V ^8  d   Qh/ S[ S[,          ;R&   S[P                  ;R&   S[P                  ;R&   R;R&   S[;R&   S[;R&   S[;R&   S[;R	&   S[;R
&   S[;R&   # )r   r8   r%   r&   zcollections.deque[bytes] | Noner)   r-   r.   r,   r*   r+   r:   )r   r
   r   r   r   rG   r   r!   r   r   r"   *   s     +  $$$	 
   .-  K  L  N    J   r   )r,   r+   r-   r*   r%   r.   r&   r)   i   )rP   rP   NrI   )NN)!__name__
__module____qualname____firstlineno__r8   r:   r$   rC   rL   r>   rQ   r1   rU   r<   r[   r^   ra   rb   rg   r]   ri   rW   rp   rt   r?   rv   rw   ry   r{   __annotate_func____static_attributes____classdictcell____classcell__r3   r       @@r   r   r   *   s     +J K 6 2    % %
$ $  " "O O8 8
 ' '" " B ' '5 5@   " " A  r   r   c                   s6   a  ] tR tRt o RtV 3R lR ltRtV tR# )SubprocessProtocoli  zBAn extension to asyncio.Protocol for use with SubprocessTransport.c                r4   r5   r6   r   r!   r   r   ZSubprocessProtocol.__annotate__  s     " " "r   c                rY   )z"Called when subprocess has exited.rZ   rJ   rK   r   process_exitedZ!SubprocessProtocol.process_exited  s    !!r   r6   N)r|   r}   r~   r   __doc__r   r   r   r       @r   r   r     s     L" "r   r   c                   s2   a  ] tR tRt o V 3R lR ltRtV tR# )
WindowSizei  c                rD   )r   value)r   r   r!   r   r   ZWindowSize.__annotate__  s     + +j +r   c                sJ    \        VR 4      V n        \        VR4      V n        R# )rowscolsN)r   r   r   )r2   r   rX   r   r$   ZWindowSize.__init__  s    E6*	E6*	r   )r   r   N)r|   r}   r~   r   r$   r   r   r   r   r   r   r     s     + +r   r   c                   sF  a a ] tR tRt oRtRtRtRtRR/V3R lR lltV3R lR	 lt	R
RRR/V3R lV 3R lllt
V3R lR ltV3R lR ltV3R lR ltV3R lR ltV3R lR ltV3R lR ltV3R lR ltV3R lR ltV3R lR ltV3R  lR! ltV3R" ltR#tVtV ;t# )$SubprocessTransporti  a  A bi-directional transport speaking with stdin/out of a subprocess.

Note: this is not really a normal SubprocessTransport.  Although it
implements the entire API of asyncio.SubprocessTransport, it is not
designed to be used with asyncio.SubprocessProtocol objects.  Instead, it
pair with normal Protocol objects which also implement the
SubprocessProtocol defined in this module (which only has a
process_exited() method).  Whatever the protocol writes is sent to stdin,
and whatever comes from stdout is given to the Protocol via the
.data_received() function.

If stderr is configured as a pipe, the transport will separately collect
data from it, making it available via the .get_stderr() method.
NresetFc                &   < V ^8  d   QhRS[ RS[/# r   r   r   )rG   strr   r!   r   r    SubprocessTransport.__annotate__0  s      4 C r   c               sz    V P                   e-   V P                   P                  VR7      P                  RR7      # R# )N)r   Zreplace)ZerrorsZ )_stderrgetZdecode)r2   r   s   &$r   
get_stderrZSubprocessTransport.get_stderr0  s5    <<#<<##%#077y7IIr   c                rV   )r   processzsubprocess.Popen[bytes]r   Nr6   r   r!   r   r   r   6  s      f f"; f fr   c                sL  a aaa R  VV 3R lloR VVVV 3R llpR VVV 3R llp \         P                  ! SP                  4      oS P                  P	                  SV4       R	#   \
        \        3 d.    \        RSP                   2TRR7      P                  4         R	# i ; i)
c                s4    V ^8  d   QhR\         R\         RR/# )r   pidstatusr   Nr	   r   r   r   r   4SubprocessTransport.watch_exit.<locals>.__annotate__7  s!     	0 	0c 	03 	04 	0r   c                 sv  < V SP                   8X  g   Q h\        SP                  \        4      '       g   Q h \        P
                  ! V4      Sn        \        P                  R SP                  4       SP                  '       g   SP                  P                  4        R# R#   \         d    TSn         Ldi ; i)zProcess exited with status %dN)r   Z
isinstancer&   r   r/   Zwaitstatus_to_exitcode_returncodeZ
ValueErrorr'   r(   r,   r   )r   r   r   r2   s   &&r   child_exitedZ4SubprocessTransport.watch_exit.<locals>.child_exited7  s    '++%%%dnn.@AAAA*#%#<#<V#D  LL8$:J:JK===--/ !	  *#) *s   B# #B87B8c                    V ^8  d   QhRR/# r5   r6   r   r   r   r   r   D  s     	& 	&T 	&r   c                  s   < \         P                  ! SP                  ^ 4      w  rSP                  P	                  S4       \         P
                  ! S4       S! W4       R# r   N)r/   waitpidr   r%   rR   r?   )r   r   r   pidfdr   r2   s     r   pidfd_readyZ3SubprocessTransport.watch_exit.<locals>.pidfd_readyD  s>    **W[[!4KCJJ$$U+HHUO%r   c                r   r5   r6   r   r   r   r   r   J  s     	G 	G 	Gr   c                  s   < \         P                  ! SP                  ^ 4      w  rSP                  P	                  SW4       R# r   )r/   r   r   r%   Zcall_soon_threadsafe)r   r   r   r   r2   s     r   waitpid_threadZ6SubprocessTransport.watch_exit.<locals>.waitpid_threadJ  s-    **W[[!4KCJJ++L#Fr   zcockpit-waitpid-T)ZnameZtargetZdaemonN)	r/   Z
pidfd_openr   r%   rS   ZAttributeErrorr   r    Zstart)r2   r   r   r   r   r   s   ff  @@r   
watch_exitZSubprocessTransport.watch_exit6  s    	0 	0	& 	&	G 	G	fMM'++.EJJ!!%5( 	f*7;;-8X\]cce	fs   <A% %:B#"B#ptywindowc                s`   < V ^8  d   QhRS[ P                  RS[RS[S[,          RS[RRRS[/# )r   r   r   r   r   r   zWindowSize | Nonekwargs)r   r   r   r   r   rG   r   r   r!   r   r   r   V  sO     ,' ,'00,'-,'  },'
 ,' -,' ,'r   c               s  <a R  V3R llpS'       d   \         P                  ! 4       w  V n        pVe   V P                  V4       WR&   \        P
                  ! V3RVRVRVRR/VB V n        \         P                  ! V4       V P                  V P                  rRV n        M\        P
                  ! V3R\        P                  R\        P                  RV/VB V n        V P                  P                  '       g   Q hV P                  P                  '       g   Q hV P                  P                  P                  4       p	V P                  P                  P                  4       p
V P                  P                  e4   \        WP                  P                  P                  4       4      V n        MRV n        \         SV `E  WW4       V P%                  V P                  4       R# )	c                r   r5   r6   r   r   r   r   Z2SubprocessTransport.__init__.<locals>.__annotate__`  s     	5 	5D 	5r   c                  s   < \        \        \        P                  4       S '       d)   \        P
                  ! ^ \        P                  ^ 4       R# R# r   )r   SET_PDEATHSIGsignalSIGTERMfcntlioctltermiosZ	TIOCSCTTY)r   s   r   
preexec_fnZ0SubprocessTransport.__init__.<locals>.preexec_fn`  s/    -0Aw00!4 r   Nstderrstdinstdoutr   Zstart_new_sessionT)r/   Zopenpty_pty_fdset_window_size
subprocessZPopen_processr?   r:   ZPIPEr   r   Zfilenor   Spoolerr   r#   r$   r   )r2   r   r   r   r   r   r   r   Z
session_fdr   r   r3   s   &&&&d$,    r   r$   ZSubprocessTransport.__init__V  s   	5 	5
 ')zz|$DL*!$$V,)8&,,T f3=fFPf8BfVZf^dfDM HHZ  LL$,,6#D ',,T N NQ[Q`Q` N8BNFLNDM==&&&&&=='''''MM((//1E]]((//1F==+"4)=)=)D)D)FGDLDL7&r   c                rj   )r   sizer   N)r   r   r!   r   r   r     s     W WJ W4 Wr   c           	     s0   V P                   f   Q h\        ^ \        VP                  R4      4      p\        ^ \        VP                  R4      4      p\
        P                  ! V P                   \        P                  \        P                  ! RW#4      4       R # )NZ2H4xi  )r   ZmaxZminr   r   r   r   r   Z
TIOCSWINSZstructZpack)r2   r   r   r   s   &&  r   r   Z#SubprocessTransport.set_window_size  se    ||'''1c$))Y/01c$))Y/0DLL'"4"4fkk&$6UVr   c                rD   rE   rF   r   r!   r   r   r     s     / /t /r   c                sR    V P                   f   Q hV P                   P                  R J# rI   )r   r   rJ   rK   r   r[   Z!SubprocessTransport.can_write_eof  s'    }}(((}}""$..r   c                r4   r5   r6   r   r!   r   r   r     s       r   c                s    V P                   f   Q hV P                   P                  f   Q hV P                   P                  P                  4        RV n        R # )NrP   )r   r   r?   r.   rJ   rK   r   r]   Z"SubprocessTransport._write_eof_now  sE    }}(((}}""...!!#r   c                rD   rE   r	   r   r!   r   r   r     s     ! ! !r   c                sN    V P                   f   Q hV P                   P                  # rI   )r   r   rJ   rK   r   get_pidZSubprocessTransport.get_pid  s"    }}(((}}   r   c                r4   )r   r   rd   r6   r   r!   r   r   r     s          r   c                rH   rI   )r   rJ   rK   r   get_returncodeZ"SubprocessTransport.get_returncode  rM   r   c                s:   < V ^8  d   QhRS[ RS[P                  /# )r   fdr   )r
   r   	Transportr   r!   r   r   r     s!     " "S "W->-> "r   c                rY   rI   rZ   )r2   r   rX   r   get_pipe_transportZ&SubprocessTransport.get_pipe_transport  r\   r   c                rx   )r   sigr   N)r   ZSignalsr   r!   r   r   r     s#     h hv~~ h$ hr   c                s   V P                   f   Q hV P                  e-   \        P                  RWP                   P                  4       R #  \
        P                  ! V P                   P                  V4       \        P                  RWP                   P                  4       R #   \         d/    \        P                  RYP                   P                  4        R # i ; i)Nz3won't attempt %s to process %i.  It exited already.zsent %s to process %iz3can't send %s to process %i.  It's exited just now.)r   r   r'   r(   r   r/   killZProcessLookupError)r2   r   rX   r   send_signalZSubprocessTransport.send_signal  s    }}((( 'LLNPSUbUbUfUfg	hGGDMM%%s+LL0#}}7H7HI! 	hLLNPSUbUbUfUfg	hs   AB# #5CCc                r4   r5   r6   r   r!   r   r   r     s     ) )4 )r   c                D    V P                  \        P                  4       R # rI   )r   r   r   rJ   rK   r   	terminateZSubprocessTransport.terminate      (r   c                r4   r5   r6   r   r!   r   r   r     s     ) )d )r   c                r   rI   )r   r   ZSIGKILLrJ   rK   r   r   ZSubprocessTransport.kill  r   r   c                r4   r5   r6   r   r!   r   r   r     s     N N Nr   c                s   V P                   e(   \        P                  ! V P                   4       R V n         V P                  ea   V P                  P                  e6   V P                  P                  P                  4        R V P                  n         V P                  4        R # R #   \         d/    \        P                  RT P                  P                  4        R # i ; i)Nzcan't kill %i due to EPERM)
r   r/   r?   r   r   r   ZPermissionErrorr'   r(   r   rJ   rK   r   rU   ZSubprocessTransport._close  s    <<#HHT\\"DL==$}}"".##))+&*#N  % # N94==;L;LMNs   B& &5CCc                sB   < V ^8  d   Qh/ R;R&   R;R&   R;R&   R;R&   # )r   rd   r   zsubprocess.Popen[bytes] | Noner   r   zSpooler | Noner   r6   r   r!   r   r   r     s9        ! " /5# $ $% & ' r   )r:   r.   r   r   r   r   )r|   r}   r~   r   r   r   r   r   r   r   r$   r   r[   r]   r   r   r   r   r   r   rU   r   r   r   r   r   r   r   r   r     s      !G15H $K%  f f@,'
 #,' 04,' ,'\W W/ / ! !   " "h h0) )) )N NC  r   r   c                   sj   a a ] tR tRt oRtR
V3R lV 3R llltV3R lR ltV3R lR ltR	tVt	V ;t
# )StdioTransporti  zA bi-directional transport that corresponds to stdin/out.

Can talk to just about anything:
    - files
    - pipes
    - character devices (including terminals)
    - sockets
c                sZ   < V ^8  d   QhRS[ P                  RS[ P                  RS[RS[/# )r   r   r   r   r   r   r   r!   r   r   StdioTransport.__annotate__  s7     8 8W66 8'BRBR 8[^ 8lo 8r   c                s(   < \         SV `  WW44       R # rI   )r#   r$   )r2   r   r   r   r   r3   s   &&&&&r   r$   ZStdioTransport.__init__  s    7r   c                rD   rE   rF   r   r!   r   r   r     s      t r   c                rT   )Fr6   rJ   rK   r   r[   ZStdioTransport.can_write_eof  s    r   c                r4   r5   r6   r   r!   r   r   r     s     8 8 8r   c                s    \        R 4      h)zCan't write EOF to stdout)ZRuntimeErrorrJ   rK   r   r]   ZStdioTransport._write_eof_now  s    677r   r6   )r   rO   )r|   r}   r~   r   r   r$   r[   r]   r   r   r   r   r   r   r   r     s-     8 8 8 8 8r   r   c                   s   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltR	R
/V 3R lR lltV 3R lR lt	V 3R lR lt
V 3R ltRtV tR# )r   i  zConsumes data from an fd, storing it in a buffer.

This makes a copy of the fd, so you don't have to worry about holding it
open.
c                s:   < V ^8  d   QhRS[ P                  RS[/# )r   r   r   r   r   r
   r   r!   r   r   Spooler.__annotate__  s!     4 4W66 4C 4r   c                s    Wn         RV n        . V n        \        P                  ! V4      V n        \        P
                  ! V P                  R4       VP                  V P                  V P                  4       R# )rO   FNrP   )r%   _fd	_contentsr/   Zdupr0   rS   rC   )r2   r   r   rf   r   r$   ZSpooler.__init__  sN    
66":
%($"2"23r   c                r4   r5   r6   r   r!   r   r   r     s      T r   c                s     \         P                  ! V P                  R 4      pTR8w  d   T P
                  P                  T4       R# T P                  4        R#   \         d     R# \         d    Rp LRi ; i)i    Nr   )r/   r7   r   r9   r   r   rq   r?   ro   r`   r   rC   ZSpooler._read_ready  s`    	77488T*D 3;NN!!$'JJL  	 	D	s   !A A6'A60A65A6c                rD   rE   rF   r   r!   r   r   r     s     D D4 Dr   c                s|    V P                   R8X  d   R# \        P                  ! V P                   .. . ^ 4      . . . 38g  # )rO   FrP   )r   selectrJ   rK   r   	_is_readyZSpooler._is_ready  s6    88r>}}dhhZR3B|CCr   r   Fc                r   r   )rG   rm   r   r!   r   r   r     s      D U r   c               s    V P                  4       '       d   V P                  4        K(  R P                  V P                  4      pV'       d   . V n        V# )r   )r   rC   rs   r   )r2   r   Zresults   &$ r   r   ZSpooler.get  s<    nn$..)DNr   c                r4   r5   r6   r   r!   r   r   r     s      t r   c                s    V P                   R8w  dO   V P                  P                  V P                   4       \        P                  ! V P                   4       RV n         R# R# rN   )r   r%   rR   r/   r?   rJ   rK   r   r?   ZSpooler.close  s?    88r>JJ$$TXX.HHTXXDH r   c                r4   r5   r6   r   r!   r   r   r     s       r   c                rz   rI   )r?   rJ   rK   r   r{   ZSpooler.__del__  s    

r   c                sP   < V ^8  d   Qh/ S[ P                  ;R&   S[;R&   R;R&   # )r   r%   r   zlist[bytes]r   r   r   r!   r   r   r     s1      $$$  
H   r   )r   r   r%   N)r|   r}   r~   r   r   r$   rC   r   r   r?   r{   r   r   r   r   r   r   r   r     sW     4 4 D D
5    o  r   r   )&r   r   rn   Zctypesr;   r   Zloggingr/   r   r   r   r   r   Z	threadingr    Ztypingr   r   r   Zjsonutilr   r   ZCDLLr   r   r   Z	getLoggerr|   r'   rr   r   r   r   r   r   r   r   r   r6   r   r   <module>r      s    R       	       * * )KK##	(
  
		8	$ a"" aH")) "+ +mN*g&A&A mN`8Z 8(8 8r   