+
    i]  c                   s   . R=O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 ^RIHt ]P                   t ^ RIt^ RIt^ RIHtHtHtHt R>tRt]P8                  ! 4       tR	tR	.t] ! ]R
4      '       d   R
t]R
.,          t]P2                  R8X  d   Rt]R.,          t]3R lt!R t"R t#R t$R t% ! R R4      t&]'       d    ! R R]&4      t' ! R R]&4      t( ! R R])4      t*R?R lt+]P2                  R8w  d   R@R lt,MR@R lt, ! R R])4      t-R t.]P2                  R8X  d    ! R R])4      t/R  t0^(t1R!t2R"t3R#t4]5! 0 RAm4      t6]7! R$ ]6 4       4      t8^t9^t:]9]:3t;R% t<R& t=R' t>RBR( R) llt?R* R+ lt@ ! R, R-])4      tAR. tBR/ tC ! R0 R1]*4      tDR2 tE]P2                  R8X  d"   R3 tF]P                  ]P                  0tIRCR4 ltJM1^ RIKtK] ! ]KR54      '       d   ]KP                  tMM]KP                  tMRCR6 ltJ]P2                  R8X  d5   R7 tOR8 tP]P                  ! ](]O4       R9 tRR: tS]P                  ! ]']R4       R# R; tOR< tP]P                  ! ](]O4       R#   ] d    ]P2                  R8X  d   h Rt EL%i ; i)DClientListenerN)util)AuthenticationErrorBufferTooShort)	reduction)WAIT_OBJECT_0WAIT_ABANDONED_0WAIT_TIMEOUTINFINITEwin32g      4@AF_INETAF_UNIXAF_PIPEc                 s:    \         P                  ! 4       V ,           # Ntime	monotonic)timeout   &3/usr/lib64/python3.14/multiprocessing/connection.py_init_timeoutr   >   s    >>g%%    c                 s2    \         P                  ! 4       V 8  # r   r   )tr   r   _check_timeoutr   A   s    >>ar   c                s   V R8X  d   R	# V R8X  d,   \         P                  ! R\        P                  ! 4       R7      # V R8X  dB   \         P                  ! R\        P
                  ! 4       \        \        4      3,          RR7      # \        R4      h)
z7
Return an arbitrary free address for the given family
r   r   zsock-)ZprefixZdirr   z\\.\pipe\pyc-%d-%d- zunrecognized family)Z	localhost    )	tempfileZmktempr   Zget_temp_dirosZgetpidZnext_mmap_counter
ValueErrorfamilyr   r   arbitrary_addressr!   H   s|     	9	g43D3D3FGG	9	&< "		T--@A'BGIK 	K .//r   c                s    \         P                  R8w  d   V R8X  d   \        RV ,          4      h\         P                  R8X  d4   V R8X  d+   \        \        V 4      '       g   \        RV ,          4      hR# R# R# )z<
Checks if the family is valid for the current environment.
r
   r   zFamily %s is not recognized.r   N)sysplatformr   hasattrsocketr   r   r   _validate_familyr&   V   sf     ||w6Y#67&@AA
||w6Y#6vv&&;fDEE ' $7r   c                s   \        V 4      \        8X  d   R# \        V 4      \        J d   V P                  R4      '       d   R# \        V 4      \        J g   \        P
                  ! V 4      '       d   R# \        RV ,          4      h)zQ
Return the types of the address

This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE'
r   z\\r   r   zaddress type of %r unrecognized)typeZtupleZstr
startswithr   is_abstract_socket_namespacer   )addressr   r   address_typer+   b   sb     G}	g#	'"4"4V"<"<	g#	!B!B7!K!K:WDEEr   c                   s   a  ] tR t^ut o RtRR ltR tR tR tR t	R t
]R 4       t]R	 4       t]R
 4       tR tR tR tRR ltR tRR ltRR ltR tRR ltR tR tRtV tR# )_ConnectionBaseNc                s    VP                  4       pV^ 8  d   \        R4      hV'       g   V'       g   \        R4      hWn        W n        W0n        R# )r   zinvalid handlez6at least one of `readable` and `writable` must be TrueN)	__index__r   _handle	_readable	_writable)selfhandlereadablewritable   &&&&r   __init__Z_ConnectionBase.__init__x   sI    !!#A:-..HJ J!!r   c                sF    V P                   e   V P                  4        R # R # r   r.   _closer1   r   r   __del__Z_ConnectionBase.__del__   s    <<#KKM $r   c                s8    V P                   f   \        R4      hR # )Nhandle is closed)r.   OSErrorr9   r   r   _check_closedZ_ConnectionBase._check_closed   s    <<,--  r   c                @    V P                   '       g   \        R 4      hR# )zconnection is write-onlyN)r/   r<   r9   r   r   _check_readableZ_ConnectionBase._check_readable   s    ~~~455 r   c                r>   )zconnection is read-onlyN)r0   r<   r9   r   r   _check_writableZ_ConnectionBase._check_writable   s    ~~~344 r   c                sl    V P                   '       d	   R V n        MV P                  4        \        R4      h)Fzbad message length)r0   r/   closer<   r9   r   r   _bad_message_lengthZ#_ConnectionBase._bad_message_length   s'    >>>"DNJJL*++r   c                s    V P                   RJ # )z True if the connection is closedNr.   r9   r   r   closedZ_ConnectionBase.closed   s     ||t##r   c                    V P                   # )z"True if the connection is readable)r/   r9   r   r   r3   Z_ConnectionBase.readable        ~~r   c                rE   )z"True if the connection is writable)r0   r9   r   r   r4   Z_ConnectionBase.writable   rF   r   c                s:    V P                  4        V P                  # )z+File descriptor or handle of the connection)r=   r.   r9   r   r   filenoZ_ConnectionBase.fileno   s    ||r   c                sn    V P                   e    V P                  4        RV n         R# R#   RT n         i ; i)zClose the connectionNr7   r9   r   r   rA   Z_ConnectionBase.close   s1    <<#$#	 $  $s   + 	4c                s    RV n         R# )z7Stop managing the underlying file descriptor or handle.NrC   r9   r   r   _detachZ_ConnectionBase._detach   s	    r   c                s   V P                  4        V P                  4        \        V4      pVP                  ^8  d   VP	                  R4      pVP
                  pV^ 8  d   \        R4      hWR8  d   \        R4      hVf
   WR,
          pM*V^ 8  d   \        R4      hW#,           V8  d   \        R4      hV P                  WBW#,            4       R# )z,Send the bytes data from a bytes-like objectZBzoffset is negativezbuffer length < offsetNzsize is negativezbuffer length < offset + size)r=   r@   
memoryviewitemsizeZcastZnbytesr   _send_bytes)r1   bufoffsetsizemn   &&&&  r   
send_bytesZ_ConnectionBase.send_bytes   s    sO::>sAHHA:122:566<:DAX/00]Q<==&-01r   c                s    V P                  4        V P                  4        V P                  \        P	                  V4      4       R# )zSend a (picklable) objectN)r=   r@   rK   _ForkingPicklerdumpsr1   obj   &&r   sendZ_ConnectionBase.send   s3    ..s34r   c                s    V P                  4        V P                  4        Ve   V^ 8  d   \        R4      hV P                  V4      pVf   V P	                  4        VP                  4       # )z'
Receive bytes data as a bytes object.
znegative maxlength)r=   r?   r   _recv_bytesrB   getvalue)r1   Z	maxlengthrL      && r   
recv_bytesZ_ConnectionBase.recv_bytes   sa     	 Y]122y);$$&||~r   c                s(   V P                  4        V P                  4        \        V4      ;_uu_ 4       pVP                  pV\	        V4      ,          pV^ 8  d   \        R4      hW%8  d   \        R4      hV P                  4       pVP                  4       pWRV,           8  d   \        VP                  4       4      hVP                  ^ 4       VP                  W2V,          W',           V,           4       VuuRRR4       #   + '       g   i     R# ; i)zY
Receive bytes data into a writeable bytes-like object.
Return the number of bytes read.
znegative offsetzoffset too largeN)r=   r?   rI   rJ   lenr   rY   Ztellr   rZ   ZseekZreadinto)r1   rL   rM   rO   rJ   ZbytesizeZresultrN      &&&     r   recv_bytes_intoZ_ConnectionBase.recv_bytes_into   s    
 	__zzH#a&(Hz !233" !344%%'F;;=D4-'$V__%677KKNOOA0%}9; <! ___s   CD  D	c                s    V P                  4        V P                  4        V P                  4       p\        P	                  VP                  4       4      # )zReceive a (picklable) object)r=   r?   rY   rS   loads	getbuffer)r1   rL      & r   recvZ_ConnectionBase.recv   s?     $$S]]_55r   c                sd    V P                  4        V P                  4        V P                  V4      # )z/Whether there is any input available to be read)r=   r?   _pollr1   r   rW   r   pollZ_ConnectionBase.poll  s)    zz'""r   c                    V # r    r9   r   r   	__enter__Z_ConnectionBase.__enter__	      r   c                &    V P                  4        R # r   rA   r1   Zexc_typeZ	exc_valueZexc_tbr5   r   __exit__Z_ConnectionBase.__exit__      

r   )r.   r/   r0   )TTr   Nr   r   )g        )__name__
__module____qualname____firstlineno__r.   r6   r:   r=   r?   r@   rB   propertyrD   r3   r4   rG   rA   rH   rR   rX   r\   r_   rc   rf   ri   rn   __static_attributes____classdictcell__Z__classdict__   @r   r,   r,   u   s     G	".65, $ $    
$2(526# r   r,   c                   sh   a  ] tR tRt o RtRtRt]P                  3R lt	R t
RR ltR tR	 tR
tV tR# )PipeConnectioni  z
Connection class based on a Windows named pipe.
Overlapped I/O is used, so the handles must have been created
with FILE_FLAG_OVERLAPPED.
FNc                sj    V P                   pVe   VP                  4        V! V P                  4       R # r   )_send_ovcancelr.   )r1   Z_CloseHandleovr[   r   r8   ZPipeConnection._close  s%    B~		&r   c                s   V P                   e   \        R4      h\        P                  ! V P                  VRR7      w  r#W n          V\        P
                  8X  d(   \        P                  ! VP                  .R\        4      pR T n         TP                  R4      w  rST\        P                  8X  d   \        \        P                  R4      hR #    TP                  4        h ; i  R T n         TP                  R4      w  rSi ; i)Nz/concurrent send_bytes() calls are not supportedT
overlappedFr;   )r|   r   _winapiZ	WriteFiler.   ERROR_IO_PENDINGWaitForMultipleObjectseventr	   r}   GetOverlappedResultERROR_OPERATION_ABORTEDr<   errnoZEPIPE)r1   rL   r~   errwaitresZnwrittens   &&    r   rK   ZPipeConnection._send_bytes"  s    }}(  "5 6 6''cdKGBM
='222%<<
E85G !% " 6 6t <g555 ekk+=>>	 6		 $ " 6 6t <#s   <C C  C# #C?c                s(   V P                   '       d   R V n         \        P                  ! 4       # Vf   ^M\        V^4      p \        P
                  ! V P                  VRR7      w  r4\        4       pTp  V\        P                  8X  d(   \        P                  ! VP                  .R \        4      pTP                  R4      w  rT^ 8X  d8   \        P                  ! 4       p	T	P                  TP                  4       4       T	pM&T\        P                   8X  d   T P#                  Y14      pYeJd   T#  \-        R4      h   TP                  4        h ; i  TP                  R4      w  rT^ 8X  d8   \        P                  ! 4       p	T	P                  TP                  4       4       T	pi T\        P                   8X  d   T P#                  Y14      pi i ; i   YeJ d   h  L; i  \$         d,   p
T
P&                  \        P(                  8X  d   \*        hh Rp
?
ii ; i)FNTr   z.shouldn't get here; expected KeyboardInterrupt)_got_empty_messageioBytesIOminr   ReadFiler.   objectr   r   r   r	   r}   r   writera   ZERROR_MORE_DATA_get_more_datar<   winerrorERROR_BROKEN_PIPEEOFErrorRuntimeError)r1   maxsizeZbsizer~   r   ZsentinelZreturn_valuer   Znreadfes   &&         r   rY   ZPipeConnection._recv_bytes<  s   &&&*/'zz|#&C4E!%..t||U;?AGB  &xH#+L"P"g&>&>>*1*H*H%'XXJx+A *,)?)?)EJE"ax$&JJL ! 7/0!$(?(?!?/3/B/B2/O
 $3++ 4 OPP-"IIK!)+)?)?)EJE"ax$&JJL ! 7/0!$(?(?!?/3/B/B2/O "@"'3! 4
  zzW%>%>>&	s\   1G 5<D; 1AG G &G (G ;EE A:GG GG H&&HHc                s    V P                   '       g-   \        P                  ! V P                  4      ^ ,          ^ 8w  d   R# \	        \        V .V4      4      # )r   T)r   r   PeekNamedPiper.   boolwaitre   rW   r   rd   ZPipeConnection._pollf  sA    '''--dll;A>!CdVW-..r   c                s   VP                  4       p\        P                  ! 4       pVP                  V4       \        P
                  ! V P                  4      ^,          pVe(   \        V4      V,           V8  d   V P                  4        \        P                  ! V P                  VRR7      w  rVP                  R4      w  rvVP                  VP                  4       4       V# )   Tr   )ra   r   r   r   r   r   r.   r]   rB   r   r   )r1   r~   r   rL   r   Zleftr   Zrbytesr^   r   r   ZPipeConnection._get_more_datal  s    ,,.C

AGGCL((6q9D"s3x$'@((*&&t||TdKGB006KF GGBLLN#Hr   )r   r|   r   )rr   rs   rt   ru   __doc__r   r|   r   CloseHandler8   rK   rY   rd   r   rw   rx   ry   rz   r   r{   r{     s@     	
 #&-&9&9 	'	(4(	QT	/	 	r   r{   c                   s  a  ] tR tRt o Rt]'       d*   ]P                  3R lt]P                  t
]P                  tM(]P                  3R lt]P                  t
]P                   t]
3R lt]3R ltR tRR	 ltR
 tRtV tR# )
Connectioni|  zc
Connection class based on an arbitrary file descriptor (Unix only), or
a socket handle (Windows).
c                *    V! V P                   4       R # r   rC   r1   r8   rW   r   r8   Connection._close      4<< r   c                r   r   rC   r   rW   r   r8   r     r   r   c                sn    \        V4      p V! V P                  V4      pW4,          pV^ 8X  d   R# WR pK+  )TN)r]   r.   )r1   rL   r   	remainingrP      &&&  r   _sendZConnection._send  s8    H	dllC(ANIA~b'Cr   c                s   \         P                  ! 4       pV P                  pTpV^ 8  d]   \        \        V4      pV! WF4      p\        V4      pV^ 8X  d   WQ8X  d   \        h\        R4      hVP                  V4       WX,          pKc  V# )r   zgot end of file during message)	r   r   r.   r   BUFSIZEr]   r   r<   r   )	r1   rN   readrL   r2   r   Zto_readZchunkrP   s	   &&&      r   _recvZConnection._recv  sw    jjl	!m'9-G)EE
AAv$"N!"BCCIIeNI
r   c                s   \        V4      pVR 8  dd   \        P                  ! RR4      p\        P                  ! RV4      pV P                  V4       V P                  V4       V P                  V4       R# \        P                  ! RV4      pVR8  d%   V P                  V4       V P                  V4       R# V P                  WA,           4       R# )i!i!Qi @  N)r]   structZpackr   )r1   rL   rP   Z
pre_headerZheader   &&   r   rK   ZConnection._send_bytes  s    Hz>T2.J[[q)FJJz"JJvJJsO [[q)F5y 

6"

3 

6<(r   Nc                s*   V P                  ^4      p\        P                  ! RVP                  4       4      w  pVR8X  d9   V P                  ^4      p\        P                  ! RVP                  4       4      w  pVe	   W18  d   R# V P                  V4      # )i   r   r   Nr   )r   r   ZunpackrZ   )r1   r   rL   rN   s   &&  r   rY   ZConnection._recv_bytes  so    jjmdCLLN32:**Q-CMM$7ED4>zz$r   c                s2    \        V .V4      p\        V4      # r   )r   r   )r1   r   Zrr[   r   rd   ZConnection._poll  s    $!Awr   rh   r   )rr   rs   rt   ru   r   r   _multiprocessingZclosesocketr8   rX   Z_writerc   Z_readr   rA   r   r   r   r   rK   rY   rd   rw   rx   ry   rz   r   r   r   |  sw     
  0 < < 	!!&& %% " 	!%   % ").  r   r   c                   sf   a  ] tR tRt o RtRR ltR tR t]R 4       t	]R 4       t
R	 tR
 tRtV tR# )r   i  z
Returns a listener object.

This is a wrapper for a bound socket which is 'listening' for
connections, or for a Windows named pipe.
Nc                sH   T;'       g$    T;'       d    \        V4      ;'       g    \        pT;'       g    \        V4      p\        V4       VR 8X  d   \	        W4      V n        M\        WV4      V n        Ve"   \        V\        4      '       g   \        R4      hW@n
        R# )r   Nauthkey should be a byte string)r+   default_familyr!   r&   PipeListener	_listenerSocketListener
isinstancebytes	TypeError_authkey)r1   r*   r    backlogauthkeys   &&&&&r   r6   ZListener.__init__  s     # #G==W(= # #" 	66.v6 Y)';DN+GWEDNz'5'A'A=>>r   c                s    V P                   f   \        R4      hV P                   P                  4       pV P                  e+   \	        WP                  4       \        WP                  4       V# )zb
Accept a connection on the bound socket or named pipe of `self`.

Returns a `Connection` object.
zlistener is closed)r   r<   acceptr   deliver_challengeanswer_challenge)r1   crb   r   r   ZListener.accept  sS     >>!.//NN!!#==$a/Q.r   c                sX    V P                   pVe   RV n         VP                  4        R# R# )z1
Close the bound socket or named pipe of `self`.
N)r   rA   )r1   Zlistenerrb   r   rA   ZListener.close  s)     >>!DNNN  r   c                .    V P                   P                  # r   )r   _addressr9   r   r   r*   ZListener.address   s    ~~&&&r   c                r   r   )r   _last_acceptedr9   r   r   last_acceptedZListener.last_accepted  s    ~~,,,r   c                rg   r   rh   r9   r   r   ri   ZListener.__enter__  rj   r   c                rk   r   rl   rm   r5   r   rn   ZListener.__exit__  ro   r   )r   r   )NNr   N)rr   rs   rt   ru   r   r6   r   rA   rv   r*   r   ri   rn   rw   rx   ry   rz   r   r   r     sP        ' ' - - r   c                s    T;'       g    \        V 4      p\        V4       VR8X  d   \        V 4      pM\        V 4      pVe"   \	        V\
        4      '       g   \        R4      hVe   \        W24       \        W24       V# )z5
Returns a connection to the address of a `Listener`
r   r   )	r+   r&   
PipeClientSocketClientr   r   r   r   r   )r*   r    r   r      &&& r   r    r      ss     ,,|G,FVw!:gu#=#=9::$!%Hr   c                sV   V '       do   \         P                  ! 4       w  rVP                  R4       VP                  R4       \        VP	                  4       4      p\        VP	                  4       4      pW43# \
        P                  ! 4       w  rV\        VRR7      p\        VRR7      pW43# )<
Returns pair of connection objects at either end of a pipe
TFr4   r3   )r%   Z
socketpairsetblockingr   detachr   Zpipe)duplexZs1Zs2c1c2Zfd1Zfd2   &      r   Piper   &  s     &&(FBNN4 NN4 BIIK(BBIIK(B v	 wwyHCC%0BC%0Bvr   c           
     s   \        R4      pV '       dB   \        P                  p\        P                  \        P                  ,          p\
        \
        rTM'\        P                  p\        P                  p^ \
        rT\        P                  ! W\        P                  ,          \        P                  ,          \        P                  \        P                  ,          \        P                  ,          ^WE\        P                  \        P                  4      p\        P                  ! W^ \        P                  \        P                   \        P                  \        P                  4      p\        P"                  ! V\        P                  RR4       \        P$                  ! VRR7      pVP'                  R4      w  r\)        W`R7      p\)        WpR7      pW3# )r   r   NTr   r   r   )r!   r   PIPE_ACCESS_DUPLEXGENERIC_READGENERIC_WRITEr   ZPIPE_ACCESS_INBOUNDCreateNamedPipeFILE_FLAG_OVERLAPPEDFILE_FLAG_FIRST_PIPE_INSTANCEPIPE_TYPE_MESSAGEPIPE_READMODE_MESSAGE	PIPE_WAITNMPWAIT_WAIT_FOREVERNULL
CreateFileOPEN_EXISTINGSetNamedPipeHandleStateConnectNamedPiper   r{   )r   r*   ZopenmodeaccessZobsizeZibsizeZh1Zh2r   _r   r   r   s   &            r   r   r   9  sN    $I.11H))G,A,AAF$gF22H**FF$$ < <<112%%(E(EEvw;;LL Qg.C.C((',, 	''--tT	 --bTB
//5 B0B0vr   c                   s:   a  ] tR tRt o RtRR ltR tR tRtV t	R# )	r   ie  zG
Representation of a socket which is bound to an address and listening
c                s   \         P                   ! \        \         V4      4      V n         \        P                  R 8X  d:   V P                  P                  \         P                  \         P                  ^4       V P                  P                  R4       V P                  P                  V4       V P                  P                  V4       V P                  P                  4       V n        Y n        RT n        TR8X  dM   \"        P$                  ! T4      '       g1   \"        P&                  ! T \        P(                  T3^ R7      T n        R# RT n        R#   \         d    T P                  P                  4        h i ; i)ZposixTNr   argsZexitpriority)r%   getattr_socketr   ZnameZ
setsockoptZ
SOL_SOCKETZSO_REUSEADDRr   ZbindZlistenZgetsocknamer   r<   rA   _familyr   r   r)   Finalizeunlink_unlink)r1   r*   r    r   r5   r   r6   ZSocketListener.__init__i  s   }}WVV%<=	ww'!''(9(9(.(;(;Q@LL$$T*LLg&LL( LL446DM "Yt'H'H'Q'Q==biiwjqDL  DL  	LL 	s   B>E 'E9c                s    V P                   P                  4       w  qn        VP                  R 4       \	        VP                  4       4      # T)r   r   r   r   r   r   r1   srb   r   r   ZSocketListener.accept  s7    !%!4!4!6	d!((*%%r   c                s     V P                   P                  4        V P                  pVe   R V n        V! 4        R # R #   T P                  pTe   R T n        T! 4        i i ; ir   )r   rA   r   )r1   r   rb   r   rA   ZSocketListener.close  s[    	LL \\F!# " \\F!# "s	   > !A)r   r   r   r   r   N)r   )
rr   rs   rt   ru   r   r6   r   rA   rw   rx   ry   rz   r   r   r   e  s      2&
 r   r   c                s$   \        V 4      p\        P                  ! \        \        V4      4      ;_uu_ 4       pVP                  R4       VP	                  V 4       \        VP                  4       4      uuRRR4       #   + '       g   i     R# ; i)zG
Return a connection object connected to the socket given by `address`
TN)r+   r%   r   r   Zconnectr   r   )r*   r    r      &  r   r   r     s[     '"F	/	1	1Q	d			'!((*% 
2	1	1	1s   ;A>>B	c                   sN   a  ] tR tRt o RtR	R ltR
R ltR t]R 4       t	Rt
V tR# )r   i  z 
Representation of a named pipe
Nc                s   Wn         V P                  R R7      .V n        RV n        \        P
                  ! RV P                   4       \        P                  ! V \        P                  V P                  V P                   3^ R7      V n	        R# )T)firstNz listener created with address=%rr   )
r   _new_handle_handle_queuer   r   	sub_debugr   r   _finalize_pipe_listenerrA   )r1   r*   r   s   &&&r   r6   ZPipeListener.__init__  sj    #M"&"2"2"2">!?D"&DNN=t}}Ml::(($--8qDJr   c           
     s   \         P                  \         P                  ,          pV'       d   V\         P                  ,          p\         P                  ! V P
                  V\         P                  \         P                  ,          \         P                  ,          \         P                  \        \        \         P                  \         P                  4      # r   )r   r   r   r   r   r   r   r   r   ZPIPE_UNLIMITED_INSTANCESr   r   r   )r1   r   Zflagsr[   r   r   ZPipeListener._new_handle  s    ..1M1MME>>>**u))G,I,II!!"00'7,,gll r   c                sB   V P                   P                  V P                  4       4       V P                   P                  ^ 4      p \        P
                  ! VRR7      p \        P                  ! VP                  .R\        4      p TP                  R4      w  rE\        T4      #    TP                  4        \        P                  ! T4       h ; i  TP                  R4      w  rEi ; i  \         d+   pTP                  \        P                  8w  d   h  Rp?LRp?ii ; i)r   Tr   FN)r   appendr   Zpopr   r   r   r   r	   r}   r   r   r<   r   ZERROR_NO_DATAr{   )r1   r2   r~   resr   r   r   r   r   r   ZPipeListener.accept  s    %%d&6&6&89''++A.F$--fF	$!88
E85C  33D9FA!&))IIK''/33D9FAs  ::!6!66 7s0   C) 'B% %)CC C&)D4 DDc                sr    \         P                  ! R V4       V  F  p\        P                  ! V4       K  	  R# )z closing listener with address=%rN)r   r   r   r   )Zqueuer*   r2   r[   r   r   Z$PipeListener._finalize_pipe_listener  s)    NN=wG##F+  r   )r   r   r   rA   r   )F)rr   rs   rt   ru   r   r6   r   r   Zstaticmethodr   rw   rx   ry   rz   r   r   r     s-     			
		*. 
	, 
	,r   r   c           	     sR   \        4       p  \        P                  ! V R4       \        P                  ! V \        P                  \        P
                  ,          ^ \        P                  \        P                  \        P                  \        P                  4      p \        P                  ! T\        P                  RR4       \!        T4      #   \         dN   pTP                  \        P                  \        P                  39  g   \        T4      '       d   h  Rp?EK  Rp?ii ; i)zE
Return a connection object connected to the pipe given by `address`
  N)r   r   ZWaitNamedPiper   r   r   r   r   r   r<   r   ZERROR_SEM_TIMEOUTZERROR_PIPE_BUSYr   r   r   r{   )r*   r   hr      &   r   r   r     s     O%%gt4&&W11G4I4IIw||W%:%:00',,  	''w,,dD	 a    ::g&?&?&-&=&=&? ?BPQRBSBS CTs   BC D&AD!!D&s   #CHALLENGE#s	   #WELCOME#s	   #FAILURE#c              #   s8   "   T F  p\        V4      x  K  	  R # 5ir   )r]   ).0r   rb   r   	<genexpr>r   W  s     7&6c!ff&6s   c                s$   \        V 4      \        9   d   RV 3# V P                  R4      '       dT   V P                  R^\        ^,           4      ;p^ 8  d/   V ^V pV\
        9   d   W^,           R pVP                  R4      V3# \        RV : 24      h)zReturns a digest name and the payload for a response hash.

If a legacy protocol is detected based on the message length
or contents the digest name returned will be empty to indicate
legacy mode where MD5 and no digest prefix should be sent.
r   s   {s   }NasciizRunsupported message length, missing digest prefix, or unsupported digest: message=)r]   _LEGACY_LENGTHSr(   Zfind_MAX_DIGEST_LEN_ALLOWED_DIGESTSdecoder   )messageZcurlydigestZpayloadr   r   _get_digest_name_and_payloadr   b  s     7|&
 7{4  ,,tQ(9:	:a?5!%%Agh'G==)722
/&-Z12 2r   c                s   ^ RI p\        V4      ^ ,          pV'       g"    VP                  WR4      P                  4       # VP                  WV4      P                  4       pRVP                  R4      V3,          #   \         d    Rp LIi ; i)ao  Create a MAC based on authkey and message

The MAC algorithm defaults to HMAC-MD5, unless MD5 is not available or
the message has a '{digest_name}' prefix. For legacy HMAC-MD5, the response
is the raw MAC, otherwise the response is prefixed with '{digest_name}',
e.g. b'{sha256}abcdefg...'

Note: The MAC protects the entire message including the digest_name prefix.
Nmd5sha256   {%s}%sr   )hmacr   newr   r   encode)r   r   r  digest_nameresponser   r   _create_responser	  |  s     .w7:K	#88Ge4;;== xx+6==?H**73X>>>  	# #K		#s   A: :B
	B
c           
     s   ^ RI p\        V4      w  rET;'       g    Rp VP                  WV4      P                  4       p\        T4      \        T4      8w  d(   \        RT: R\        T4       R\        T4       24      hTP                  Ye4      '       g   \        R4      hR#   \         d    \        RT: R24      hi ; i)	aH  Verify MAC challenge

If our message did not include a digest_name prefix, the client is allowed
to select a stronger digest_name from _ALLOWED_DIGESTS.

In case our message is prefixed, a client cannot downgrade to a weaker
algorithm, because the MAC is calculated over the entire message
including the '{digest_name}' prefix.
Nr  zresponse_digest=z unsupportedz	expected z of length z got zdigest received was wrong)r  r   r  r   r   r   r]   Zcompare_digest)r   r   r  r  Zresponse_digestZresponse_macZexpecteds   &&&    r   _verify_challenger
    s     $@$J!O%..OE88Go>EEG 8}L))!O.k#h- I<()+, 	, x66!"=>> 7  E!%5_$6l"CDDEs    B# #B?c                $    V ^8  d   QhR\         /#    r   r   format   "r   __annotate__r    s     ( (5 (r   c                 s   \        V\        4      '       g$   \        R P                  \	        V4      4      4      h\
        P                  ! \        4      pRVP                  R4      V3,          pV P                  \        V,           4       V P                  R4      p \        WV4       V P                  \        4       R#   \         d    T P                  \        4       h i ; i) Authkey must be bytes, not {0!s}r  r      N)r   r   r   r  r'   r   ZurandomMESSAGE_LENGTHr  rR   
_CHALLENGEr\   r
  _WELCOMEr   _FAILURE)
connectionr   r  r   r  r   r   r   r     s    gu%%.55d7mDF 	F jj(G;--g6@@G *w./$$S)H('H5
 	h'	  h's   B? ?"C!c                r  r  r  r  r  r   r  r    s     > >% >r   c                 s   \        V\        4      '       g$   \        R P                  \	        V4      4      4      hV P                  R4      pVP                  \        4      '       g   \        RV: 24      hV\        \        4      R p\        V4      \        8  d   \        R\        V4       R24      h\        W4      pV P                  V4       V P                  R4      pV\        8w  d   \        R4      hR# )r  r  z,Protocol error, expected challenge: message=Nzchallenge too short: z byteszdigest sent was rejected)r   r   r   r  r'   r\   r(   r  r   r]   _MD5ONLY_MESSAGE_LENGTHr	  rR   r  )r  r   r   r   r  r   r   r   r     s    gu%%.55d7mDF 	F##C(Gj))!?wjAC 	Cc*o&'G
7|--!$9#g,v"NOOg/F&!$$S)H8!"<== r   c                   s2   a  ] tR tRt o R tR tR tRtV tR# )ConnectionWrapperi  c                sj    Wn         W n        W0n        R F  p\        W4      p\	        WV4       K  	  R# )rG   N)rG   rA   rf   r\   rR   )_conn_dumps_loadsr   Zsetattr)r1   connrT   r`   ZattrrV   rQ   r   r6   ZConnectionWrapper.__init__  s0    
KD$%CD$ Lr   c                s^    V P                  V4      pV P                  P                  V4       R # r   )r  r  rR   )r1   rV   r   r[   r   rX   ZConnectionWrapper.send  s"    KK

a r   c                sX    V P                   P                  4       pV P                  V4      # r   )r  r\   r  r   rb   r   rc   ZConnectionWrapper.recv  s"    JJ!!#{{1~r   )r  r  r  N)	rr   rs   rt   ru   r6   rX   rc   rw   rx   ry   rz   r   r  r    s     %! r   r  c                 sT    \         P                  V 3R R R ^4      P                  R4      # )Nutf-8)	xmlrpclibrT   r  )rV   r   r   
_xml_dumpsr"    s&    ??C64tQ7>>wGGr   c                 sV    \         P                  V P                  R 4      4      w  w  rV# )r   )r!  r`   r   )r   rV   Zmethodr   r   
_xml_loadsr#    s"    __QXXg%67NFSJr   c                   s&   a  ] tR tRt o R tRtV tR# )XmlListeneri  c                sb    ^ RI Hs \        P	                  V 4      p\        V\        \        4      # rp   )xmlrpc.clientclientr!  r   r   r  r"  r#  rU   rb   r   r   ZXmlListener.accept  s"    )ood# j*==r   rh   N)rr   rs   rt   ru   r   rw   rx   ry   rz   r   r$  r$    s     > >r   r$  c                  sJ    ^ RI Hs \        \	        V / VB \
        \        4      # rp   )r%  r&  r!  r  r    r"  r#  )r   Zkwdss   *,r   	XmlClientr'    s    %VT2T2J
KKr   c                 sJ  a \        V 4      o. p\        S4      ^<8  d    \        P                  ! SRV4      pTP                  T3R lT 4       4       T'       dB   \        S4       UUu. uF)  w  rEYC^ ,          T,          u;8  d
   T9  g   K#  M K'  TNK+  	  uppo^ pS'       d   \        S4      ^<8  d
   SR,          MSp\        P                  ! VRV4      pV\        8X  d    V# \        Tu;8:  d   \        \        S4      ,           8  d   M MV\        ,          pMC\        Tu;8:  d   \        \        S4      ,           8  d   M MV\        ,          pM\        R4      hVP                  SV,          4       SV^,           R o^ pK  V#   \         d    . u # i ; iu uppi )<   Fc              3   6   <"   T F  pSV,          x  K  	  R # 5ir   rh   )r   iL   & r   r   Z#_exhaustive_wait.<locals>.<genexpr>  s     +s!1s   :Nr(  NzShould not get hereN)listr]   r   ZBatchedWaitForMultipleObjectsZTimeoutErrorZextendZ	enumerater   r   r   r   r   r   )Zhandlesr   readyr   r*  r   Zshort_Lr+  s   &&     @r   _exhaustive_waitr0    sX    M q6B;;;AugN LL+s++#,Q<M<4111vz3L3LQ3LQ<MG #AafG00%ICl"  #>A(>>}$!SD+;c!f+DD''"#899LL3 #a%&	AG)   	 Ns#   F ) FFFFFc                s(  a Vf   \         pM#V^ 8  d   ^ pM\        VR,          R,           4      p\        V 4      p / o. p\        4       p\        4       p V  F  p \	        VR4      p \
        P                  ! V! 4       ^ R4      w  rxV\
        P                  8X  d#   VP                  V4       VSVP                  &   Kg  V'       dW   \        P                  ! 4       R,          R
8  d6    VP                  R4      w  rV'       g   \!        VR4      '       d   RVn        VP%                  V4       ^ pK  	  \+        SP-                  4       V4      pV F  pVP/                  4        K  	  V Fv  p VP                  R4      w  rV\
        P0                  8w  g   K.  SVP                  ,          pVP%                  V4       V^ 8X  g   K[  \!        VR4      '       g   Ko  RVn        Kx  	  TP3                  T3R	 lT 4       4       T  Uu. uF  qUT9   g   K  TNK  	  up#   \         d%   p	RT	P                  rT\        9  d   h  Rp	?	ELRp	?	ii ; i  \         d   p	T	P                  p Rp	?	ELkRp	?	ii ; i  \&         d    TSTP)                  4       &    EK9  i ; i  \         d$   p	T	P                  pT\        9  d   h  Rp	?	EL>Rp	?	ii ; i  T F  pTP/                  4        K  	  T F  p TP                  R4      w  rM0  \         d#   p	T	P                  pT\        9  d   h  Rp	?	MRp	?	ii ; iT\
        P0                  8w  g   K_  STP                  ,          pTP%                  T4       T^ 8X  g   K  \!        TR4      '       g   K  RTn        K  	  i ; iu upi )
Wait till an object in object_list is ready/readable.

Returns list of those objects in object_list which are ready/readable.
Nr   g      ?rG   T:Nr  NFr   c              3   r)  r   rh   )r   r   waithandle_to_objr,  r   r   Zwait.<locals>.<genexpr>p  s     I=a.q11=r-  )i   r  )r	   Zintr.  Zsetr   r   r   r<   r   _ready_errorsr   r   r   r"   Zgetwindowsversionr   r$   r   ZaddZAttributeErrorr-   r0  Zkeysr}   r   Zupdate)object_listr   Zov_listZready_objectsZready_handlesZorG   r~   r   r   r   r2  s   &&         @r   r   r   %  s,    ?Gq[G'D.3./G;'6	8 $$Q1F
"")"2"268Q"E
 g666r*67)"((3
 #"7"7"9""="G1)+)?)?)F $'716J+K+K7; 4%))!,"#= !@ -->-C-C-EwOM 		  33D9FA
 '999)"((3A!%%a(ax #1&:;;37A0   	I=II&=;a}*<;==_ # ""&

Cm3! 4"  $+ 1&'jj1- & 978%akkm49N  **C-/ 0 		  33D9FAs **C-/ 0 '999)"((3A!%%a(ax #1&:;;37A0 " >s   K I-'H>K !K 'I:K A
K +J NNI!I :K  IK I*I%K %I**K -JK JK KJ<<KN$K87N8L%	L 	N L%	%N?(N,N NPollSelectorc                s   \        4       ;_uu_ 4       pV  F#  pVP                  V\        P                  4       K%  	  Ve   \        P
                  ! 4       V,           p VP                  V4      pV'       d+   V UUu. uF  w  rgVP                  NK  	  uppuuRRR4       # Vf   KJ  X\        P
                  ! 4       ,
          pV^ 8  g   Ko  VuuRRR4       # u uppi   + '       g   i     R# ; i)r1  N)_WaitSelectorregister	selectorsZ
EVENT_READr   r   ZselectZfileobj)r4  r   ZselectorrV   Zdeadliner/  ZkeyZeventss   &&      r   r   r     s     __"!!#y';';< # ">>+g5 0=BCUMSCKKUC _ *"*T^^-="="Q;#( _ D __s6   A#C7C<C
C!C' CCCC/	c                 sB   V P                  4       p\        P                  ! V\        P                  \        P                  4      ;_uu_ 4       p^RIHp VP                  V4      p\        W@P                  V P                  33uuRRR4       #   + '       g   i     R# ; i)r   )resource_sharerN)rG   r%   Zfromfdr   ZSOCK_STREAMr   r9  Z	DupSocketrebuild_connectionr3   r4   )r  r2   r   r9  dss   &    r   reduce_connectionr<    sd    ]]66>>63E3EFF!) **1-B%MM4=='II GFFFs   5BB	c                 sV    V P                  4       p\        VP                  4       W4      # r   r   r   )r;  r3   r4   Zsockr   r   r:  r:    s     yy{$++-<<r   c                 s"   V P                   '       d   \        P                  M^ V P                  '       d   \        P                  M^ ,          p\
        P                  ! V P                  4       V4      p\        W P                   V P                  33# rq   )	r3   r   ZFILE_GENERIC_READr4   ZFILE_GENERIC_WRITEr   Z	DupHandlerG   rebuild_pipe_connection)r  r   dhr   r   reduce_pipe_connectionr@    s`    047,,1157--AG  7&]]DMM(JJJr   c                 :    V P                  4       p\        W1V4      # r   )r   r{   )r?  r3   r4   r2   r   r   r>  r>    s    f99r   c                 s    \         P                  ! V P                  4       4      p\        WP                  V P
                  33# r   )r   ZDupFdrG   r:  r3   r4   )r  dfrb   r   r<  r<    s.    __T[[]+!Bt}}#EEEr   c                 rA  r   r=  )rB  r3   r4   Zfdr   r   r:  r:    s    YY["11r   )r    r   r   r   i   )NNr   >   s   md5s   sha256s   sha384s   sha3_256s   sha3_384)r  r   )TZ__all__r   r   Z	itertoolsr   r"   r%   r   r   r   r   r   r   r   Zcontextr   ZForkingPicklerrS   r   r   r   r   r   r	   ZImportErrorr#   r   ZCONNECTION_TIMEOUTZcountr   r   Zfamiliesr$   r   r   r!   r&   r+   r,   r{   r   r   r   r    r   r   r   r   r   r  r  r  r  Z	frozensetr   Zmaxr   r  Z_MD5_DIGEST_LENr   r   r	  r
  r   r   r  r"  r#  r$  r'  r0  r   ZERROR_NETNAME_DELETEDr3  r   r8  r5  r6  ZSelectSelectorr<  r:  r7  r@  r>  rh   r   r   <module>rC     s   3  	  	 
      1 **OO   !;
69NH<<7NH - & 0
FF&X Xv g gTN Nj;v ;|* <<7&&X)V )X& <<76,v 6,p!> 
r @B 7&677  *O<24?8?2(*>* H>( >L <<7@ ..0M0MNML>` 
 y.))!..!00)6 <<7J= z#45K
: ~'=>F2 z#45m$  
||wGs   
I% %JJ