+
     Bi                     R   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 ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^R	IHt ^R
IHt ^RIHt ^RIHt R t]
P6                  R8X  d	   ]! R4      hR tR t ! R R]P>                  4      t  ! R R]PB                  4      t" ! R R]PF                  ]PH                  4      t% ! R R]PL                  4      t' ! R R4      t( ! R R4      t)R t* ! R R]PV                  4      t,] t-],t.]-t/R# )!z2Selector event loop for Unix with signal handling.N)base_events)base_subprocess)	constants)
coroutines)events)
exceptions)futures)selector_events)tasks)
transports)loggerwin32z+Signals are not really supported on Windowsc                    R# )zDummy signal handler.N )signumframes   &&*/usr/lib/python3.14/asyncio/unix_events.py_sighandler_noopr   '   s        c                 V     \         P                  ! V 4      #   \         d    T u # i ; iN)oswaitstatus_to_exitcode
ValueError)statuss   &r   r   r   ,   s.    ((00  	s    ((c                      a a ] tR t^6t oRtRV 3R lltV 3R ltR tR tR t	R t
R	 tR R
 ltR R ltRR ltR tRRRRRRRRRRR/R lltRRRR^dRRRRRRRRRR/R lltR tR tR tR tV 3R ltRtVtV ;t# )!_UnixSelectorEventLoopz\Unix event loop.

Adds signal handling and UNIX Domain Socket support to SelectorEventLoop.
Nc                   < \         SV `  V4       / V n        / V n        \	        4       '       d   \        4       V n        R # \        4       V n        R # r   )super__init___signal_handlers_unix_server_socketscan_use_pidfd_PidfdChildWatcher_watcher_ThreadedChildWatcher)selfselector	__class__s   &&r   r   _UnixSelectorEventLoop.__init__<   s;    " "$&!??.0DM13DMr   c                X  < \         SV `  4        \        P                  ! 4       '       g0   \	        V P
                  4       F  pV P                  V4       K  	  R# V P
                  '       d?   \        P                  ! R V : R2\        V R7       V P
                  P                  4        R# R# )zClosing the loop z@ on interpreter shutdown stage, skipping signal handlers removalsourceN)r   closesysis_finalizinglistr    remove_signal_handlerwarningswarnResourceWarningclear)r&   sigr(   s   & r   r-   _UnixSelectorEventLoop.closeE   s      ""D112**3/ 3 $$$ 1$ :H I .%)	+
 %%++- %r   c                N    V F  pV'       g   K  V P                  V4       K   	  R # r   )_handle_signal)r&   datar   s   && r   _process_self_data)_UnixSelectorEventLoop._process_self_dataS   s     F'	 r   c                   \         P                  ! V4      '       g   \         P                  ! V4      '       d   \        R4      hV P	                  V4       V P                  4         \        P                  ! V P                  P                  4       4       \        P                  ! Y#T R4      pYPP                   T&    \        P                  ! T\"        4       \        P$                  ! TR4       R#   \        \        3 d   p\        \        T4      4      hRp?ii ; i  \         d   pT P                   T T P                   '       gN    \        P                  ! R4       M5  \        \        3 d"   p\&        P(                  ! RT4        Rp?MRp?ii ; iTP*                  \*        P,                  8X  d   \        RT R24      hh Rp?ii ; i)zAdd a handler for a signal.  UNIX only.

Raise ValueError if the signal number is invalid or uncatchable.
Raise RuntimeError if there is a problem setting up the handler.
z3coroutines cannot be used with add_signal_handler()NFset_wakeup_fd(-1) failed: %ssig  cannot be caught)r   iscoroutine_iscoroutinefunction	TypeError_check_signal_check_closedsignalset_wakeup_fd_csockfilenor   OSErrorRuntimeErrorstrr   Handler    r   siginterruptr   infoerrnoEINVAL)r&   r6   callbackargsexchandlenexcs   &&&*   r   add_signal_handler)_UnixSelectorEventLoop.add_signal_handlerZ   sv    ""8,,//99 8 9 93	)
   !3!3!56 xtT:%+c"	 MM#/0 U+ G$ 	)s3x((	)  	%%c*(((F((,"G, FKK >EEF yyELL("T#.?#@AA	sZ   &.C/ ;2D /D DDG'GEGF/FGF2GGc                    V P                   P                  V4      pVf   R# VP                  '       d   V P                  V4       R# V P	                  V4       R# )z2Internal helper that is the actual signal handler.N)r    get
_cancelledr1   _add_callback_signalsafe)r&   r6   rV   s   && r   r9   %_UnixSelectorEventLoop._handle_signal   sH    &&**3/>&&s+))&1r   c                H   V P                  V4        V P                  V T\        P                  8X  d   \        P
                  pM\        P                  p \        P                  ! Y4       T P                  '       g    \        P                  ! R4       R# R#   \         d     R# i ; i  \         d5   pTP                  \        P                  8X  d   \        RT R24      hh Rp?ii ; i  \        \        3 d#   p\        P                  ! RT4        Rp?R# Rp?ii ; i)zgRemove a handler for a signal.  UNIX only.

Return True if a signal handler was removed, False if not.
Fr?   r@   Nr>   TrA   )rE   r    KeyErrorrG   SIGINTdefault_int_handlerSIG_DFLrK   rQ   rR   rL   rH   r   r   rP   )r&   r6   handlerrU   s   &&  r   r1   ,_UnixSelectorEventLoop.remove_signal_handler   s    
 	3	%%c* &--00GnnG	MM#' $$$A$$R( -  		  	yyELL("T#.?#@AA		 ( A:C@@AsA   B B,  C. B)(B),C+7/C&&C+.D!?DD!c                    \        V\        4      '       g   \        RV: 24      hV\        P                  ! 4       9  d   \        RV 24      hR# )zInternal helper to validate a signal.

Raise ValueError if the signal number is invalid or uncatchable.
Raise RuntimeError if there is a problem setting up the handler.
zsig must be an int, not zinvalid signal number N)
isinstanceintrD   rG   valid_signalsr   )r&   r6   s   &&r   rE   $_UnixSelectorEventLoop._check_signal   sM     #s##6sg>??f**,,5cU;<< -r   c                    \        WW#V4      # r   )_UnixReadPipeTransportr&   pipeprotocolwaiterextras   &&&&&r   _make_read_pipe_transport0_UnixSelectorEventLoop._make_read_pipe_transport   s    %d(EJJr   c                    \        WW#V4      # r   )_UnixWritePipeTransportrm   s   &&&&&r   _make_write_pipe_transport1_UnixSelectorEventLoop._make_write_pipe_transport   s    &t8UKKr   c	           
     p  "   V P                   p
V P                  4       p\        WW#WEWg3R VRV/V	B pV
P                  VP	                  4       V P
                  V4        VG Rj  xL
  V#  L  \        \        3 d    h \         d,    TP                  4        TP                  4       G Rj  xL 
  h i ; i5i)rp   rq   N)r$   create_future_UnixSubprocessTransportadd_child_handlerget_pid_child_watcher_callback
SystemExitKeyboardInterruptBaseExceptionr-   _wait)r&   ro   rT   shellstdinstdoutstderrbufsizerq   kwargswatcherrp   transps   &&&&&&&&&,   r   _make_subprocess_transport1_UnixSelectorEventLoop._make_subprocess_transport   s      --##%)$$(-v2/52=B2 +12 	!!&.."2 $ < <f	F	LL  -. 	 	LLN,,.  	sB   AB6A, #A*$A, (B6*A, ,B3$B3+B.,B33B6c                >    V P                  VP                  V4       R # r   )call_soon_threadsafe_process_exited)r&   pid
returncoder   s   &&&&r   r}   ._UnixSelectorEventLoop._child_watcher_callback   s    !!&"8"8*Er   sslsockserver_hostnamessl_handshake_timeoutssl_shutdown_timeoutc          	     0  "   Ve   \        V\        4      '       g   Q hV'       d   Vf   \        R4      hM-Ve   \        R4      hVe   \        R4      hVe   \        R4      hVe   Ve   \        R4      h\        P                  ! V4      p\
        P
                  ! \
        P                  \
        P                  ^ 4      p VP                  R4       V P                  WB4      G R j  xL
  MmVf   \        R4      hVP                  \
        P                  8w  g    VP                  \
        P                  8w  d   \        RV: 24      hVP                  R4       V P                  WAW5VVR	7      G R j  xL
 w  rW3#  L   TP                  4        h ; i L!5i)
Nz/you have to pass server_hostname when using sslz+server_hostname is only meaningful with ssl1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with ssl3path and sock can not be specified at the same timeFzno path and sock were specified.A UNIX Domain Stream Socket was expected, got )r   r   )rg   rM   r   r   fspathsocketAF_UNIXSOCK_STREAMsetblockingsock_connectr-   familytype_create_connection_transport)
r&   protocol_factorypathr   r   r   r   r   	transportro   s
   &&&$$$$$  r   create_unix_connection-_UnixSelectorEventLoop.create_unix_connection   s     &*_c*J*JJJ& EG G ' * !NOO$0 GI I#/ FH H  IK K 99T?D==1C1CQGD  '''333 | !BCCv~~-II!3!33 DTHMO OU#$($E$EC"7!5 %F %7 7	 ""% 4

7sB   $FBF%E> 'E<(E> ,BF2F3	F<E> >FFbacklogstart_servingTcleanup_socketc          	       "   \        V\        4      '       d   \        R 4      hVe   V'       g   \        R4      hVe   V'       g   \        R4      hVe   Ve   \        R4      h\        P
                  ! V4      p\        P                  ! \        P                  \        P                  4      pV^ ,          R9  dR    \        P                  ! \        P                  ! V4      P                  4      '       d   \        P                  ! V4        VP#                  V4       M\Vf   \        R4      hVP*                  \        P                  8w  g    VP,                  \        P                  8w  d   \        R	V: 24      hV	'       dM   VP/                  4       pV^ ,          R9  d/    \        P                  ! V4      P0                  V P2                  V&   VP5                  R
4       \6        P8                  ! W.VWTVV4      pV'       d/   VP;                  4        \<        P>                  ! ^ 4      G Rj  xL
  V#   \         d     EL5\         d#   p
\        P                   ! RY*4        Rp
?
EL\Rp
?
ii ; i  \         dX   pTP%                  4        TP&                  \&        P(                  8X  d#   RT: R2p\        \&        P(                  T4      Rhh Rp?i TP%                  4        h ; i  \         d     EL%i ; i L5i)z*ssl argument must be an SSLContext or NoneNr   r   r   z2Unable to check or remove stale UNIX socket %r: %rzAddress z is already in usez-path was not specified, and no sock specifiedr   F)     ) rg   boolrD   r   r   r   r   r   r   statS_ISSOCKst_moderemoveFileNotFoundErrorrK   r   errorbindr-   rQ   
EADDRINUSEr   r   getsocknamest_inor!   r   r   Server_start_servingr
   sleep)r&   r   r   r   r   r   r   r   r   r   errrU   msgservers   &&&$$$$$$$    r   create_unix_server)_UnixSelectorEventLoop.create_unix_server  s     c4  HII ,SCE E  +CBD D  IK K 99T?D==1C1CDD Awk)6}}RWWT]%:%:;;		$		$ | CE E v~~-II!3!33 DTHMO O ##%DAwk)68ggdm6J6JD--d3 	##D&2B$'2G$8: !!# ++a.  e )  6LL "*+/6 66  

99 0 00 %TH,>?C!%"2"2C8dB

" )  !s   -K;K;A5K;=9H4 7H4 I1 A$K;K;#-K' AK;-K9.K;4I.?K;I.I.I)#K;)I..K;1K$<AKK$$K;'K62K;5K66K;c           
     &  "    \         P                    TP                  4       p \         P                  ! T4      P                  pT'       d   TMTpT'       g   ^ # T P                  4       p	T P                  T	RYY4T^ 4       T	G Rj  xL
 #   \         d    \        P                  ! R 4      hi ; i  \        \        P                  3 d   p\        P                  ! R4      hRp?ii ; i  \         d    \        P                  ! R4      hi ; i L5i)zos.sendfile() is not availableznot a regular fileN)r   sendfileAttributeErrorr   SendfileNotAvailableErrorrJ   ioUnsupportedOperationfstatst_sizerK   ry   _sock_sendfile_native_impl)
r&   r   fileoffsetcountrJ   r   fsize	blocksizefuts
   &&&&&     r   _sock_sendfile_native,_UnixSelectorEventLoop._sock_sendfile_nativeb  s     	2KK	M[[]F	MHHV$,,E #E	  "''T4(.y!	Ey%  	26602 2	2
  7 78 	M667KLL	M  	M667KLL	M sb   DB B1  C* DD-DDD"B..D1C'C""C''D*"DDc	                R   VP                  4       p	Ve   V P                  V4       VP                  4       '       d   V P                  WEV4       R # V'       d5   Wh,
          pV^ 8:  d&   V P                  WEV4       VP	                  V4       R # \        V\        P                  ^,          ^,           4      p \        P                  ! WWW4      p
V
^ 8X  d&   V P                  WEV4       VP	                  V4       R # WZ,          pW,          pVf   V P                  W4       V P                  WP                  VWVWVWx4
       R #   \        \        3 d:    Tf   T P                  Y4       T P                  YP                  TYTYVYx4
        R # \         d   pTeU   TP                   \         P"                  8X  d6   \%        T4      \&        Jd#   \'        R\         P"                  4      pYn        TpT^ 8X  d@   \*        P,                  ! R4      pT P                  YET4       TP/                  T4        R p?R # T P                  YET4       TP/                  T4        R p?R # R p?i\0        \2        3 d    h \4         d/   pT P                  YET4       TP/                  T4        R p?R # R p?ii ; i)Nzsocket is not connectedzos.sendfile call failed)rJ   remove_writer	cancelled_sock_sendfile_update_filepos
set_resultminr.   maxsizer   r   _sock_add_cancellation_callback
add_writerr   BlockingIOErrorInterruptedErrorrK   rQ   ENOTCONNr   ConnectionError	__cause__r   r   set_exceptionr~   r   r   )r&   r   registered_fdr   rJ   r   r   r   
total_sentfdsentrU   new_excr   s   &&&&&&&&&     r   r   1_UnixSelectorEventLoop._sock_sendfile_native_imply  sA   [[]$
 }-==??..vzJ*IA~226:Nz* 	3;;>A#56	1	F;;r6=DJ qy226:Nz*"
 (88C$C$CS "& &yF[  !12 	B$44S?OOB ? ?f"9B  	')II/I_4
 *-u~~?$'!Q
 !::-/226:N!!#&&226:N!!#&&-. 	 	#..vzJc""	#sD   5D? ?AJ&J&J&BI0#IJ&,
J&7J&8#J!!J&c                b    V^ 8  d(   \         P                  ! W\         P                  4       R# R# r   N)r   lseekSEEK_SET)r&   rJ   r   r   s   &&&&r   r   4_UnixSelectorEventLoop._sock_sendfile_update_filepos  s     >HHVR[[1 r   c                :   a a V V3R  lpVP                  V4       R# )c                    < V P                  4       '       d-   SP                  4       pVR8w  d   SP                  V4       R# R# R# )   NrA   )r   rJ   r   )r   r   r&   r   s   & r   cbB_UnixSelectorEventLoop._sock_add_cancellation_callback.<locals>.cb  s8    }}[[]8&&r*  r   N)add_done_callback)r&   r   r   r   s   f&f r   r   6_UnixSelectorEventLoop._sock_add_cancellation_callback  s    	+
 	b!r   c                  < WP                   9   d   VP                  4       pMR p\        SV `  V4       Vea   V P                   V,          pV P                   V  \        P
                  ! V4      P                  V8X  d   \        P                  ! V4       R # R # R #   \         d     R # \         d#   p\        P                  ! RY$4        R p?R # R p?ii ; i)Nz/Unable to clean up listening UNIX socket %r: %r)r!   r   r   _stop_servingr   r   r   unlinkr   rK   r   r   )r&   r   r   prev_inor   r(   s   &&   r   r   $_UnixSelectorEventLoop._stop_serving  s    ,,,##%DDd#006H))$/2774=''83IIdO 4	  %  2 &'+2 22s$   ;B C(C1C2CC)r    r!   r$   r   NN)__name__
__module____qualname____firstlineno____doc__r   r-   r;   rX   r9   r1   rE   rr   rv   r   r}   r   r   r   r   r   r   r   __static_attributes____classdictcell____classcell__r(   __classdict__s   @@r   r   r   6   s     
4.(+Z2@
=KL,F0#0#0# !0# #'	0#
 "&0#dPP"P(,P #'P "&	P
 P
 04Pd.GFR2"2 2r   r   c                      a a ] tR tRt oRtRV 3R lltR tR tR tR t	R t
R tR	 tR
 tR tR t]P"                  3R ltRR ltR tR tRtVtV ;t# )rl   i  c                b  < \         SV `  V4       W P                  R &   Wn        W n        VP                  4       V n        W0n        RV n        RV n	        \        P                  ! V P                  4      P                  p\        P                  ! V4      '       gY   \        P                  ! V4      '       g=   \        P                   ! V4      '       g!   RV n        RV n        RV n        \#        R4      h\        P$                  ! V P                  R4       V P                  P'                  V P                  P(                  V 4       V P                  P'                  V P*                  V P                  V P,                  4       Ve.   V P                  P'                  \.        P0                  VR4       R# R# )rn   FNz)Pipe transport is for pipes/sockets only.)r   r   _extra_loop_piperJ   _fileno	_protocol_closing_pausedr   r   r   r   S_ISFIFOr   S_ISCHRr   set_blocking	call_soonconnection_made_add_reader_read_readyr   _set_result_unless_cancelled)r&   looprn   ro   rp   rq   moder(   s   &&&&&& r   r   _UnixReadPipeTransport.__init__  s/   "F

{{}!xx%--d##d##T""DJDL!DNHII
e,

T^^;;TB

T--!\\4+;+;	=JJ  !E!E!'/ r   c                l    V P                  4       '       g   R # V P                  P                  W4       R # r   )
is_readingr  r  )r&   r   rS   s   &&&r   r  "_UnixReadPipeTransport._add_reader  s$      

r,r   c                V    V P                   '       * ;'       d    V P                  '       * # r   )r  r  r&   s   &r   r  !_UnixReadPipeTransport.is_reading  s    <<55$55r   c                   V P                   P                  .pV P                  f   VP                  R4       M#V P                  '       d   VP                  R4       VP                  RV P
                   24       \        V P                  RR 4      pV P                  e`   Ve\   \        P                  ! W P
                  \        P                  4      pV'       d   VP                  R4       MCVP                  R4       M1V P                  e   VP                  R4       MVP                  R4       RP                  R	P                  V4      4      # )
Nclosedclosingfd=	_selectorpollingidleopen<{}> )r(   r   r	  appendr  r
  getattrr  r	   _test_selector_event	selectors
EVENT_READformatjoin)r&   rP   r'   r$  s   &   r   __repr___UnixReadPipeTransport.__repr__  s    ''(::KK!]]]KK	"c$,,()4::{D9::!h&:%::,,	(<(<>GI&F#ZZ#KKKK!}}SXXd^,,r   c                    \         P                  ! V P                  V P                  4      pV'       d   V P                  P                  V4       R# V P                  P                  4       '       d   \        P                  ! R V 4       RV n
        V P                  P                  V P                  4       V P                  P                  V P                  P                  4       V P                  P                  V P                  R4       R#   \        \         3 d     R# \"         d   pT P%                  TR4        Rp?R# Rp?ii ; i)%r was closed by peerTNz"Fatal read error on pipe transport)r   readr
  max_sizer  data_receivedr  	get_debugr   rP   r  _remove_readerr  eof_received_call_connection_lostr   r   rK   _fatal_error)r&   r:   rU   s   &  r   r  "_UnixReadPipeTransport._read_ready#  s    	G774<<7D ,,T2::''))KK 7> $

))$,,7

$$T^^%@%@A

$$T%?%?F  !12 	 	Ic#GHH	Is#   +D E E)E*EEc                    V P                  4       '       g   R # RV n        V P                  P                  V P                  4       V P                  P                  4       '       d   \        P                  ! RV 4       R # R # )NTz%r pauses reading)r  r  r  r8  r
  r7  r   debugr  s   &r   pause_reading$_UnixReadPipeTransport.pause_reading5  sV      

!!$,,/::!!LL,d3 "r   c                2   V P                   '       g   V P                  '       g   R # RV n        V P                  P                  V P                  V P
                  4       V P                  P                  4       '       d   \        P                  ! RV 4       R # R # )NFz%r resumes reading)	r  r  r  r  r
  r  r7  r   r>  r  s   &r   resume_reading%_UnixReadPipeTransport.resume_reading=  sb    ===

t||T-=-=>::!!LL-t4 "r   c                    Wn         R # r   r  r&   ro   s   &&r   set_protocol#_UnixReadPipeTransport.set_protocolE      !r   c                    V P                   # r   rE  r  s   &r   get_protocol#_UnixReadPipeTransport.get_protocolH      ~~r   c                    V P                   # r   r  r  s   &r   
is_closing!_UnixReadPipeTransport.is_closingK      }}r   c                P    V P                   '       g   V P                  R 4       R # R # r   )r  _closer  s   &r   r-   _UnixReadPipeTransport.closeN  s    }}}KK r   c                    V P                   e0   V! RV : 2\        V R7       V P                   P                  4        R # R # Nzunclosed transport r+   r	  r4   r-   r&   _warns   &&r   __del___UnixReadPipeTransport.__del__R  5    ::!'x0/$OJJ "r   c           
     `   \        V\        4      '       dZ   VP                  \        P                  8X  d;   V P                  P                  4       '       d   \        P                  ! R WRR7       M-V P                  P                  RVRVRV RV P                  /4       V P                  V4       R# z%r: %sT)exc_infomessage	exceptionr   ro   N)rg   rK   rQ   EIOr  r7  r   r>  call_exception_handlerr  rT  r&   rU   ra  s   &&&r   r;  #_UnixReadPipeTransport._fatal_errorW  s    sG$$eii)?zz##%%XttDJJ--7STDNN	/  	Cr   c                    R V n         V P                  P                  V P                  4       V P                  P	                  V P
                  V4       R# TN)r  r  r8  r
  r  r:  r&   rU   s   &&r   rT  _UnixReadPipeTransport._closee  s9    

!!$,,/

T77=r   c                    V P                   P                  V4       V P                  P                  4        R V n        R V n         R V n        R #   T P                  P                  4        R T n        R T n         R T n        i ; ir   r  connection_lostr	  r-   r  ri  s   &&r   r:  ,_UnixReadPipeTransport._call_connection_lostj  g    	NN**3/JJDJ!DNDJ JJDJ!DNDJ   A 1A?)r  r
  r  r  r	  r  i   r   zFatal error on pipe transport)r   r   r   r   r5  r   r  r  r0  r  r?  rB  rG  rK  rP  r-   r2   r3   r[  r;  rT  r:  r   r  r  r  s   @@r   rl   rl     sd     H/<-
6-*G$45" %MM 
>
 r   rl   c                      a a ] tR tRt oRV 3R lltR tR tR tR tR t	R t
R	 tR
 tR tR tR t]P"                  3R ltR tRR ltRR ltR tRtVtV ;t# )ru   it  c                  < \         S
V `  WQ4       W P                  R &   W n        VP	                  4       V n        W0n        \        4       V n        ^ V n	        RV n
        \        P                  ! V P
                  4      P                  p\        P                  ! V4      p\        P                   ! V4      p\        P"                  ! V4      p	V'       g1   V'       g)   V	'       g!   RV n        RV n        RV n        \%        R4      h\        P&                  ! V P
                  R4       V P(                  P+                  V P                  P,                  V 4       V	'       g.   V'       dk   \.        P0                  P3                  R4      '       gF   V P(                  P+                  V P(                  P4                  V P
                  V P6                  4       Ve.   V P(                  P+                  \8        P:                  VR4       R# R# )rn   FNz?Pipe transport is only for pipes, sockets and character devicesaix)r   r   r  r	  rJ   r
  r  	bytearray_buffer
_conn_lostr  r   r   r   r   r  r  r   r   r  r  r  r  r.   platform
startswithr  r  r   r  )r&   r  rn   ro   rp   rq   r  is_charis_fifo	is_socketr(   s   &&&&&&    r   r    _UnixWritePipeTransport.__init__w  sd   %"F
{{}! {xx%--,,t$--%MM$'	7iDJDL!DN D E E 	e,

T^^;;TB
 )@)@)G)GJJ  !7!7!%t/?/?A JJ  !E!E!'/ r   c                   V P                   P                  .pV P                  f   VP                  R4       M#V P                  '       d   VP                  R4       VP                  RV P
                   24       \        V P                  RR 4      pV P                  e   Ve   \        P                  ! W P
                  \        P                  4      pV'       d   VP                  R4       MVP                  R4       V P                  4       pVP                  RV 24       M1V P                  e   VP                  R4       MVP                  R4       R	P                  R
P                  V4      4      # )Nr   r!  r"  r#  r$  r%  zbufsize=r&  r'  r(  )r(   r   r	  r)  r  r
  r*  r  r	   r+  r,  EVENT_WRITEget_write_buffer_sizer.  r/  )r&   rP   r'   r$  r   s   &    r   r0   _UnixWritePipeTransport.__repr__  s   ''(::KK!]]]KK	"c$,,()4::{D9::!h&:%::,,	(=(=?GI&F#002GKK(7),-ZZ#KKKK!}}SXXd^,,r   c                ,    \        V P                  4      # r   )lenrv  r  s   &r   r  -_UnixWritePipeTransport.get_write_buffer_size  s    4<<  r   c                    V P                   P                  4       '       d   \        P                  ! R V 4       V P                  '       d   V P                  \        4       4       R# V P                  4        R# )r3  N)r  r7  r   rP   rv  rT  BrokenPipeErrorr  s   &r   r  #_UnixWritePipeTransport._read_ready  sE    ::!!KK/6<<<KK)*KKMr   c                   \        V\        \        \        34      '       g   Q \	        V4      4       h\        V\        4      '       d   \        V4      pV'       g   R # V P
                  '       g   V P                  '       dQ   V P
                  \        P                  8  d   \        P                  ! R4       V ;P
                  ^,          un        R # V P                  '       gz    \        P                  ! V P                  V4      pT\+        T4      8X  d   R # T^ 8  d   \        T4      TR  pT P,                  P/                  T P                  T P0                  4       V ;P                  V,          un        V P3                  4        R #   \        \         3 d    ^ p L\"        \$        3 d    h \&         d7   pT ;P
                  ^,          un        T P)                  TR4        R p?R # R p?ii ; i)Nz=pipe closed by peer or os.write(pipe, data) raised exception.#Fatal write error on pipe transport)rg   bytesru  
memoryviewreprrw  r  r   !LOG_THRESHOLD_FOR_CONNLOST_WRITESr   warningrv  r   writer
  r   r   r~   r   r   r;  r  r  _add_writer_write_ready_maybe_pause_protocol)r&   r:   nrU   s   &&  r   r  _UnixWritePipeTransport.write  sc   $	: >??KdK?dI&&d#D???dmmm)"M"MM  H IOOq O|||	HHT\\40 CI~Q!$'+JJ""4<<1B1BC""$ $%56  12   1$!!#'LMs*   $!F G-G-+
G-6G-7+G((G-c                t   V P                   '       g   Q R 4       h \        P                  ! V P                  V P                   4      pV\	        V P                   4      8X  d   V P                   P                  4        V P                  P                  V P                  4       V P                  4        V P                  '       d7   V P                  P                  V P                  4       V P                  R4       R# V^ 8  d   V P                   RV1 R# R#   \        \        3 d     R# \        \        3 d    h \          dv   pT P                   P                  4        T ;P"                  ^,          un        T P                  P                  T P                  4       T P%                  TR4        Rp?R# Rp?ii ; i)zData should not be emptyNr  )rv  r   r  r
  r  r5   r  _remove_writer_maybe_resume_protocolr  r8  r:  r   r   r~   r   r   rw  r;  )r&   r  rU   s   &  r   r  $_UnixWritePipeTransport._write_ready  sD   |||777|	%t||4A C%%""$

))$,,7++-===JJ--dll;..t4QLL!$ )  !12 	-. 	 	JLL OOq O JJ%%dll3c#HII	Js*   +D F7'F76
F7F7A*F22F7c                    R # )Tr   r  s   &r   can_write_eof%_UnixWritePipeTransport.can_write_eof  s    r   c                "   V P                   '       d   R # V P                  '       g   Q hRV n         V P                  '       gN   V P                  P	                  V P
                  4       V P                  P                  V P                  R 4       R # R # )NT)r  r	  rv  r  r8  r
  r  r:  r  s   &r   	write_eof!_UnixWritePipeTransport.write_eof  sa    ===zzzz|||JJ%%dll3JJ  !;!;TB r   c                    Wn         R # r   rE  rF  s   &&r   rG  $_UnixWritePipeTransport.set_protocol  rI  r   c                    V P                   # r   rE  r  s   &r   rK  $_UnixWritePipeTransport.get_protocol  rM  r   c                    V P                   # r   rO  r  s   &r   rP  "_UnixWritePipeTransport.is_closing  rR  r   c                n    V P                   e'   V P                  '       g   V P                  4        R # R # R # r   )r	  r  r  r  s   &r   r-   _UnixWritePipeTransport.close  s&    ::!$---NN +8!r   c                    V P                   e0   V! RV : 2\        V R7       V P                   P                  4        R # R # rW  rX  rY  s   &&r   r[  _UnixWritePipeTransport.__del__  r]  r   c                (    V P                  R 4       R # r   )rT  r  s   &r   abort_UnixWritePipeTransport.abort  s    Dr   c           
     "   \        V\        4      '       d;   V P                  P                  4       '       d   \        P
                  ! R WRR7       M-V P                  P                  RVRVRV RV P                  /4       V P                  V4       R# r_  )	rg   rK   r  r7  r   r>  rd  r  rT  re  s   &&&r   r;  $_UnixWritePipeTransport._fatal_error!  sp    c7##zz##%%XttDJJ--7STDNN	/  	Cr   c                L   R V n         V P                  '       d&   V P                  P                  V P                  4       V P                  P                  4        V P                  P                  V P                  4       V P                  P                  V P                  V4       R# rh  )	r  rv  r  r  r
  r5   r8  r  r:  ri  s   &&r   rT  _UnixWritePipeTransport._close/  sh    <<<JJ%%dll3

!!$,,/

T77=r   c                    V P                   P                  V4       V P                  P                  4        R V n        R V n         R V n        R #   T P                  P                  4        R T n        R T n         R T n        i ; ir   rl  ri  s   &&r   r:  -_UnixWritePipeTransport._call_connection_lost7  ro  rp  )rv  r  rw  r
  r  r	  r  r   rq  r   )r   r   r   r   r   r0  r  r  r  r  r  r  rG  rK  rP  r-   r2   r3   r[  r  r;  rT  r:  r   r  r  r  s   @@r   ru   ru   t  sk     #/J-0!!%F%8C"
 %MM 
> r   ru   c                   &   a  ] tR tRt o R tRtV tR# )rz   iA  c                    R pV\         P                  8X  d=   \        P                  P	                  R4      '       d   \
        P                  ! 4       w  r8 \         P                  ! V3RVRVRVRVRRRV/VB V n        Ve>   VP                  4        \        VP                  4       R	VR
7      V P                  n        R pVe#   VP                  4        VP                  4        R # R #   Te"   TP                  4        TP                  4        i i ; i)Nrt  r   r   r   r   universal_newlinesFr   wb)	buffering)
subprocessPIPEr.   rx  ry  r   
socketpairPopen_procr-   r&  detachr   )	r&   rT   r   r   r   r   r   r   stdin_ws	   &&&&&&&, r   _start_UnixSubprocessTransport._startC  s    JOO#(?(?(F(F
 $..0NE	 #))E!E).E7=EFLE#(E29E=CEDJ "#'(8$'#R

 " #w" #s   A)C& &'D)r  N)r   r   r   r   r  r   r  r  s   @r   rz   rz   A  s        r   rz   c                   0   a  ] tR tRt o RtR tR tRtV tR# )r#   iY  a  Child watcher implementation using Linux's pid file descriptors.

This child watcher polls process file descriptors (pidfds) to await child
process termination. In some respects, PidfdChildWatcher is a "Goldilocks"
child watcher implementation. It doesn't require signals or threads, doesn't
interfere with any processes launched outside the event loop, and scales
linearly with the number of subprocesses launched by the event loop. The
main disadvantage is that pidfds are specific to Linux, and only work on
recent (5.3+) kernels.
c                    \         P                  ! 4       p\        P                  ! V4      pVP	                  WPP
                  WW#4       R # r   )r   get_running_loopr   
pidfd_openr  _do_wait)r&   r   rS   rT   r  pidfds   &&&*  r   r{   $_PidfdChildWatcher.add_child_handlere  s4    &&(c"s8Jr   c                0   \         P                  ! 4       pVP                  V4        \        P                  ! V^ 4      w  rg\        V4      p\        P                  ! V4       V! W.VO5!   R#   \         d    ^p\        P                  ! RT4        LHi ; i)r   zJchild process pid %d exit status already read:  will report returncode 255N)
r   r  r8  r   waitpidr   ChildProcessErrorr   r  r-   )	r&   r   r  rS   rT   r  _r   r   s	   &&&&&    r   r  _PidfdChildWatcher._do_waitj  s    &&(E"	8

3*IA 07J
(4( ! 	 JNN.		s   A. .$BBr   N)	r   r   r   r   r   r{   r  r   r  r  s   @r   r#   r#   Y  s     	K
) )r   r#   c                   V   a  ] tR tRt o RtR t]P                  3R ltR t	R t
RtV tR# )	r%   i}  a%  Threaded child watcher implementation.

The watcher uses a thread per process
for waiting for the process finish.

It doesn't require subscription on POSIX signal
but a thread creation is not free.

The watcher has O(1) complexity, its performance doesn't depend
on amount of spawn processes.
c                J    \         P                  ! ^ 4      V n        / V n        R# r   )	itertoolsr   _pid_counter_threadsr  s   &r   r   _ThreadedChildWatcher.__init__  s    %OOA.r   c                    \        V P                  P                  4       4       Uu. uF  pVP                  4       '       g   K  VNK  	  ppV'       d   V! V P                   R 2\
        V R7       R# R# u upi )z0 has registered but not finished child processesr+   N)r0   r  valuesis_aliver(   r4   )r&   rZ  threadthreadss   &&  r   r[  _ThreadedChildWatcher.__del__  sg    (,T]]-A-A-C(D )(Dfoo' 6(D )T^^$$TU! )s   A3A3c                    \         P                  ! 4       p\        P                  ! V P                  R \        V P                  4       2WAW#3RR7      pWPP                  V&   VP                  4        R# )zasyncio-waitpid-T)targetnamerT   daemonN)	r   r  	threadingThread_do_waitpidnextr  r  start)r&   r   rS   rT   r  r  s   &&&*  r   r{   '_ThreadedChildWatcher.add_child_handler  s`    &&(!!)9)9)9$t?P?P:Q9R'S(,8'B)-/ $cr   c                   V^ 8  g   Q h \         P                  ! V^ 4      w  rV\        V4      pVP                  4       '       d   \        P
                  ! RW'4       TP                  4       '       d   \        P                  ! RY4       MTP                  ! Y5T.TO5!   T P                  P                  T4       R#   \         d    Tp^p\        P                  ! RT4        Li ; i)r   z$process %s exited with returncode %sz8Unknown child process pid %d, will report returncode 255z%Loop %r that handles pid %r is closedN)r   r  r   r7  r   r>  r  r  	is_closedr   r  pop)r&   r  expected_pidrS   rT   r   r   r   s   &&&&&   r   r  !_ThreadedChildWatcher._do_waitpid  s    a	7**\15KC 07J~~C)7 >>NNBDN%%hZG$G,'' ! 	 CJNNJ	s   B< <&C%$C%)r  r  N)r   r   r   r   r   r   r2   r3   r[  r{   r  r   r  r  s   @r   r%   r%   }  s,     
 %MM ( (r   r%   c                      \        \        R 4      '       g   R#  \        P                  ! 4       p \        P                  ! \        P                  ! V ^ 4      4       R#   \
         d     R# i ; i)r  FT)hasattrr   getpidr-   r  rK   )r   s    r   r"   r"     sR    2|$$iik
sA&'   s   A A A+*A+c                       ] tR tRtRt]tRtR# )_UnixDefaultEventLoopPolicyi  zUNIX event loop policyr   N)r   r   r   r   r   r   _loop_factoryr   r   r   r   r  r    s
     *Mr   r  )SelectorEventLoop	EventLoop)0r   rQ   r   r  r   r,  rG   r   r   r  r.   r  r2    r   r   r   r   r   r   r   r	   r
   r   logr   __all__rx  ImportErrorr   r   BaseSelectorEventLoopr   ReadTransportrl   _FlowControlMixinWriteTransportru   BaseSubprocessTransportrz   r#   r%   r"   _BaseDefaultEventLoopPolicyr  r  _DefaultEventLoopPolicyr  r   r   r   <module>r     s   8  	  	      
              <<7
C
DD	
k2_BB k2\MZ55 M`Jj::(77JZ FF  0") ")H:( :(x	+&"D"D +
 + 5 	r   