+
    Dfj(T                       R t ^ RIHt ^ RIt^ RIt^ RIHt ^ RIHtH	t	 ^ RI
HtHtHt ^ RIHt ^ RIHtHtHtHtHtHtHtHtHtHtHt ^ RIHtHt ^ R	IH t  ^ R
I!H"t"H#t# ^ RI$H%t%H&t& ^RI'H(t(H)t)H*t*H+t+H,t, ]PZ                  ! R4      t. ^ RI/H0t1 ]1t0 ^ RI
H3t4 ]4t3]&R8H  t5Rt6]5'       d   ^ RI
H7t7H8t8 Rt6]%Pr                  ! 4       '       d    ^ RI:t:Rt6 ! R R4      t;]	! ]]]4       ! R R];]4      4       t< ! R R4      t=]	! ]4       ! R R]=];4      4       t>]0f   ]3e
   ]! ]<]4       ]5'       d   ]! ]<]]4       ]6'       d
   ]! ]<]4       ]?! ]RR4      e
   ]! ]<]4       R.t@R#   ]2 d    Rt0 Li ; i  ]2 d    Rt3 Li ; i  ]2 d    Rt: Li ; i)z
Posix reactor base class
)annotationsN)Sequence)classImplementsimplementer)errortcpudp)ReactorBase)
IConnectorIHalfCloseableDescriptorIReactorFDSetIReactorMulticastIReactorProcessIReactorSocketIReactorSSLIReactorTCPIReactorUDPIReactorUNIXIReactorUNIXDatagram)CONNECTION_DONECONNECTION_LOST)ClientFactory)failurelog)platformplatformType)SignalHandling_ChildSignalHandling_IWaker_MultiSignalHandling_WakerzFile descriptor lost)tls)sslposixF)processunixTc                      ] tR t^PtRt]P                  ]P                  ! ]P                  ! 4       4      ]P                  ]P                  ! ]P                  ! 4       4      /3R lt
RtR# )_DisconnectSelectableMixinz6
Mixin providing the C{_disconnectSelectable} method.
c                   V P                  V4       VP                  VP                  4      pV'       d{   V'       dO   VP                  \        P                  8X  d0   \
        P                  ! V4      '       d   VP                  V4       R# V P                  V4       VP                  V4       R# V P                  V4       VP                  \        P                  ! V4      4       R# )z
Utility function for disconnecting a selectable.

Supports half-close notification, isRead should be boolean indicating
whether error resulted from doRead().
N)removeReaderget	__class__r   ConnectionDoner   
providedByreadConnectionLostremoveWriterconnectionLostr   Failure)self
selectablewhyisReadfaildictfs   &&&&& </usr/lib/python3/dist-packages/twisted/internet/posixbase.py_disconnectSelectable0_DisconnectSelectableMixin._disconnectSelectableU   s      	*%LL'MMU%9%99,77
CC--a0!!*-))!,j)%%gooc&:;     N)__name__
__module____qualname____firstlineno____doc__r   r,   r   r1   ConnectionLostr9   __static_attributes__r<   r;   r8   r'   r'   P   sR       '//%2F2F2H"I  '//%2F2F2H"I
< <r;   r'   c                    a a ] tR t^vt0 o$ RtRtR R ltR tR V 3R lltR/ RRR^ R3R lt	RR	 lt
RR
 ltRR ltRR ltR R ltR!R lt]'       d*   ]P$                  ]P&                  ]P(                  3tR]R&   M]P$                  ]P&                  3tR tR tR"R ltR#R ltR$R R lltR%R ltR#R ltR tRtV ;t # )&PosixReactorBasez
A basis for reactors that use file descriptors.

@ivar _childWaker: L{None} or a reference to the L{_SIGCHLDWaker}
    which is used to properly notice child process termination.
Nc                   V ^8  d   QhRR/# )   returnr   r<   )formats   "r8   __annotate__PosixReactorBase.__annotate__   s      w r;   c                	    \        4       # N)r    r2   s   &r8   _wakerFactoryPosixReactorBase._wakerFactory   s	    xr;   c                    V P                   '       gX   V P                  4       V n         V P                  P                  V P                   4       V P	                  V P                   4       R# R# )z
Install a `waker' to allow threads and signals to wake up the IO thread.

We use the self-pipe trick (http://cr.yp.to/docs/selfpipe.html) to wake
the reactor. On Windows we use a pair of sockets.
N)wakerrO   _internalReadersadd	addReaderrN   s   &r8   installWakerPosixReactorBase.installWaker   sJ     zzz++-DJ!!%%djj1NN4::& r;   c                   V ^8  d   QhRR/# )rG   rH   r   r<   )rI   s   "r8   rJ   rK      s       r;   c                   < \         SV `  4       p\        R8X  d,   \        V\	        V P
                  V P                  4      34      # V# )zR
Customize reactor signal handling to support child processes on POSIX
platforms.
r#   )super_signalsFactoryr   r   r   _addInternalReader_removeInternalReader)r2   baseHandlingr+   s   & r8   r[    PosixReactorBase._signalsFactory   sS    
 w.07"' !(//22	
 
 r;   c
                	   \         R 8X  dP   V'       d*   V	e   \        R4      h\        P                  ! WW4WQWgV4	      # \        P                  ! V VVVVVVVV	4	      # \         R8X  dl   Ve   \        R4      hVe   \        R4      hV'       d   \        R4      hV	'       d   \        R4      h\
        '       d   ^ RIHp
 V
! WW#WE4      # \        R4      h\        R	4      h)
r#   z1Using childFDs is not supported with usePTY=True.win32z,Setting UID is unsupported on this platform.z,Setting GID is unsupported on this platform.z1The usePTY parameter is not supported on Windows.z1Customizing childFDs is not supported on Windows.)Processz:spawnProcess not available since pywin32 is not installed.z0spawnProcess only available on Windows or POSIX.)r   
ValueErrorr$   
PTYProcessrb   win32processtwisted.internet._dumbwin32procNotImplementedError)r2   processProtocol
executableargsenvpathuidgidusePTYchildFDsrb   s   &&&&&&&&&& r8   spawnProcessPosixReactorBase.spawnProcess   s     7"'$K  ))dRX  #
 
 W$ !OPP !OPP !TUU !TUU|CtjRR)P  &B r;   c                V    \         P                  ! WW4V 4      pVP                  4        V# )zwConnects a given L{DatagramProtocol} to the given numeric UDP port.

@returns: object conforming to L{IListeningPort}.
)r   PortstartListening)r2   portprotocol	interfacemaxPacketSizeps   &&&&& r8   	listenUDPPosixReactorBase.listenUDP   s'    
 HHTYtD	r;   c                V    \         P                  ! WW4W4      pVP                  4        V# )zConnects a given DatagramProtocol to the given numeric UDP port.

EXPERIMENTAL.

@returns: object conforming to IListeningPort.
)r   MulticastPortru   )r2   rv   rw   rx   ry   listenMultiplerz   s   &&&&&& r8   listenMulticast PosixReactorBase.listenMulticast   s.     Id
 	
r;   c                	|    \         '       g   Q R 4       h\        P                  ! WW0V4      pVP                  4        V# UNIX support is not present)unixEnabledr%   	Connectorconnect)r2   addressfactorytimeoutcheckPIDcs   &&&&& r8   connectUNIXPosixReactorBase.connectUNIX  s2    {999{NN7WHE			r;   c                	|    \         '       g   Q R 4       h\        P                  ! WW4W4      pVP                  4        V# r   )r   r%   rt   ru   )r2   r   r   backlogmodewantPIDrz   s   &&&&&& r8   
listenUNIXPosixReactorBase.listenUNIX  s5    {999{IIgtE	r;   c                |    \         '       g   Q R4       h\        P                  ! WW4V 4      pVP                  4        V# )z{
Connects a given L{DatagramProtocol} to the given path.

EXPERIMENTAL.

@returns: object conforming to L{IListeningPort}.
r   )r   r%   DatagramPortru   )r2   r   rw   ry   r   rz   s   &&&&& r8   listenUNIXDatagram#PosixReactorBase.listenUNIXDatagram  s9     {999{gdK	r;   c                |    \         '       g   Q R4       h\        P                  ! WW4WP4      pVP                  4        V# )zL
Connects a L{ConnectedDatagramProtocol} instance to a path.

EXPERIMENTAL.
r   )r   r%   ConnectedDatagramPortru   )r2   r   rw   ry   r   bindAddressrz   s   &&&&&& r8   connectUNIXDatagram$PosixReactorBase.connectUNIXDatagram  s>     {999{&&}K
 	
r;   zSequence[socket.AddressFamily]_supportedAddressFamiliesc                6   W P                   9  d   \        P                  ! V4      h\        '       d7   V\        P
                  8X  d"   \        P                  P                  WV4      pM \        P                  P                  WW#4      pVP                  4        V# )a  
Create a new L{IListeningPort} from an already-initialized socket.

This just dispatches to a suitable port implementation (eg from
L{IReactorTCP}, etc) based on the specified C{addressFamily}.

@see: L{twisted.internet.interfaces.IReactorSocket.adoptStreamPort}
)r   r   UnsupportedAddressFamilyr   socketAF_UNIXr%   rt   _fromListeningDescriptorr   ru   )r2   fileDescriptoraddressFamilyr   rz   s   &&&& r8   adoptStreamPort PosixReactorBase.adoptStreamPort:  ss      > >>00??;=FNN:		224QA11mA 	
r;   c                   W P                   9  d   \        P                  ! V4      h\        '       d6   V\        P
                  8X  d!   \        P                  P                  WV 4      # \        P                  P                  WW04      # )zO
@see:
    L{twisted.internet.interfaces.IReactorSocket.adoptStreamConnection}
)
r   r   r   r   r   r   r%   Server_fromConnectedSocketr   )r2   r   r   r   s   &&&&r8   adoptStreamConnection&PosixReactorBase.adoptStreamConnectionO  sd    
  > >>00??;=FNN:;;33NTRR::22w r;   c                	    V\         P                  \         P                  39  d   \        P                  ! V4      h\
        P                  P                  WW#VR 7      pVP                  4        V# ))ry   )	r   AF_INETAF_INET6r   r   r   rt   r   ru   )r2   r   r   rw   ry   rz   s   &&&&& r8   adoptDatagramPort"PosixReactorBase.adoptDatagramPort^  s]      AA00??HH--- . 
 	
r;   c                	V    \         P                  ! WW4V 4      pVP                  4        V# rM   )r   rt   ru   )r2   rv   r   r   rx   rz   s   &&&&& r8   	listenTCPPosixReactorBase.listenTCPl  s%    HHTG=	r;   c               0    V ^8  d   QhRRRRRRRRR	R
RR/# )rG   hoststrrv   intr   z'ClientFactory'r   floatr   ztuple[str, int] | NonerH   r
   r<   )rI   s   "r8   rJ   rK   q  sF     
 

 
 !	

 
 ,
 

r;   c                	V    \         P                  ! WW4WP4      pVP                  4        V# rM   )r   r   r   )r2   r   rv   r   r   r   r   s   &&&&&& r8   
connectTCPPosixReactorBase.connectTCPq  s$     MM$gJ			r;   c           	     	    \         e+   \         P                  VRV4      pV P                  WWuV4      # \        e+   \        P	                  WW4WVV 4      pVP                  4        V# Q R4       h)NTSSL support is not present)r!   TLSMemoryBIOFactoryr   r"   r   r   )	r2   r   rv   r   contextFactoryr   r   
tlsFactoryr   s	   &&&&&&&  r8   
connectSSLPosixReactorBase.connectSSL  sg     ?00wOJ??4zKPP_GW4A IIKH6665r;   c                	    \         e3   \         P                  VRV4      pV P                  WWE4      pRVn        V# \        e*   \        P                  WW4WP4      pVP                  4        V# Q R4       h)NFTLSr   )r!   r   r   _typer"   rt   ru   )r2   rv   r   r   r   rx   r   rz   s   &&&&&&  r8   	listenSSLPosixReactorBase.listenSSL  sj    ?00PJ>>$GGDDJK_QAH6665r;   c                    \        V4      V P                  ,
          pV F  pV P                  V4       K  	  \        V4      pV F  pV P                  V4       K  	  \	        W5,          4      # )a/  
Remove all readers and writers, and list of removed L{IReadDescriptor}s
and L{IWriteDescriptor}s.

Meant for calling from subclasses, to implement removeAll, like::

  def removeAll(self):
      return self._removeAll(self._reads, self._writes)

where C{self._reads} and C{self._writes} are iterables.
)setrS   r)   r/   list)r2   readerswritersremovedReadersreaderremovedWriterswriters   &&&    r8   
_removeAllPosixReactorBase._removeAll  sc     W(=(==$Ff% % W$Ff% % N344r;   )rR   r<   )     )r   r   F)       )2     r   )r   r   )r   r   N)r   )r   r   )g      >@N)r   N)!r=   r>   r?   r@   rA   _childWakerrO   rV   r[   rq   r{   r   r   r   r   r   r   r   r   r   r   r   __annotations__r   r   r   r   r   r   r   r   rC   __classcell__)r+   __conditional_annotations__s   @@r8   rE   rE   v   s      K
' < 6t"" NNOONNE
!#A 	
 NNOO%
!
*


775 5r;   rE   c                       ] tR tRtRtR tRtR# )_PollLikeMixini  a  
Mixin for poll-like reactors.

Subclasses must define the following attributes::

  - _POLL_DISCONNECTED - Bitmask for events indicating a connection was
    lost.
  - _POLL_IN - Bitmask for events indicating there is input to read.
  - _POLL_OUT - Bitmask for events indicating output can be written.

Must be mixed in to a subclass of PosixReactorBase (for
_disconnectSelectable).
c                \   RpRpW0P                   ,          '       d9   W0P                  ,          '       g!   W P                  9   d
   Rp\        pM\        pMy VP                  4       R8X  d   \        pM\W0P                  ,          '       d   VP                  4       pRpV'       g+   W0P                  ,          '       d   VP                  4       pRpV'       d   V P                  WV4       R# R#   \         d5    \        P                  ! 4       ^,          p\        P                  ! 4         L\i ; i)zO
fd is available for read or write, do the work and raise errors if
necessary.
NFT)_POLL_DISCONNECTED_POLL_IN_readsr   r   fileno_NO_FILEDESCdoRead	_POLL_OUTdoWriteBaseExceptionsysexc_infor   errr9   )r2   r3   fdeventr4   inReads   &&&&  r8   _doReadOrWrite_PollLikeMixin._doReadOrWrite  s    
 ****EMM4I4I [[ 
 % & $$&", 'C}},,(//1!%5>>#9#9 )002!& &&z?  !  llnQ'		s   C, 21C, $*C, ,<D+*D+r<   N)r=   r>   r?   r@   rA   r   rC   r<   r;   r8   r   r     s    7@r;   r   c                  n    ] tR tRtRt^t^t^tR tR t	R t
R tR tR tR	 tR
 tR tR tR tR tRtR# )_ContinuousPollingi  ao  
Schedule reads and writes based on the passage of time, rather than
notification.

This is useful for supporting polling filesystem files, which C{epoll(7)}
does not support.

The implementation uses L{_PollLikeMixin}, which is a bit hacky, but
re-implementing and testing the relevant code yet again is unappealing.

@ivar _reactor: The L{EPollReactor} that is using this instance.

@ivar _loop: A C{LoopingCall} that drives the polling, or L{None}.

@ivar _readers: A C{set} of C{FileDescriptor} objects that should be read
    from.

@ivar _writers: A C{set} of C{FileDescriptor} objects that should be
    written to.
c                	\    Wn         R V n        \        4       V n        \        4       V n        R # rM   )_reactor_loopr   _readers_writers)r2   reactors   &&r8   __init___ContinuousPolling.__init__  s     
r;   c                   V P                   '       g   V P                  '       dj   V P                  fZ   ^ RIHpHp V! V P                  4      V n        V P                  V P                  n        V P                  P                  VRR7       R# R# V P                  '       d$   V P                  P                  4        RV n        R# R# )zP
Start or stop a C{LoopingCall} based on whether there are readers and
writers.
N)_EPSILONLoopingCallF)now)r   r   r   twisted.internet.taskr   r   iterater   clockstartstop)r2   r   r   s   &  r8   
_checkLoop_ContinuousPolling._checkLoop  s    
 ===DMMMzz!G(6
#'==

  

  u 5 " ZZZJJOODJ r;   c                    \        V P                  4       F  pV P                  WV P                  4       K!  	  \        V P                  4       F  pV P                  W"V P
                  4       K!  	  R# )zH
Call C{doRead} and C{doWrite} on all readers and writers respectively.
N)r   r   r   r   r   r   )r2   r   r   s   &  r8   r  _ContinuousPolling.iterate/  sR     4==)F> *4==)F? *r;   c                \    V P                   P                  V4       V P                  4        R# )zE
Add a C{FileDescriptor} for notification of data available to read.
N)r   rT   r  r2   r   s   &&r8   rU   _ContinuousPolling.addReader8        	&!r;   c                \    V P                   P                  V4       V P                  4        R# )zF
Add a C{FileDescriptor} for notification of data available to write.
N)r   rT   r  r2   r   s   &&r8   	addWriter_ContinuousPolling.addWriter?  r  r;   c                     V P                   P                  V4       T P                  4        R#   \         d     R# i ; i)zI
Remove a C{FileDescriptor} from notification of data available to read.
N)r   removeKeyErrorr  r  s   &&r8   r)   _ContinuousPolling.removeReaderF  s9    	MM  ( 	  		   / >>c                     V P                   P                  V4       T P                  4        R#   \         d     R# i ; i)zJ
Remove a C{FileDescriptor} from notification of data available to
write.
N)r   r  r  r  r  s   &&r8   r/   _ContinuousPolling.removeWriterP  s9    
	MM  ( 	  		r  c                    \        V P                  V P                  ,          4      pV P                  P                  4        V P                  P                  4        V# )z!
Remove all readers and writers.
)r   r   r   clear)r2   results   & r8   	removeAll_ContinuousPolling.removeAll[  sB     dmmdmm34 	r;   c                ,    \        V P                  4      # )z
Return a list of the readers.
)r   r   rN   s   &r8   
getReaders_ContinuousPolling.getReadersf       DMM""r;   c                ,    \        V P                  4      # )z
Return a list of the writers.
)r   r   rN   s   &r8   
getWriters_ContinuousPolling.getWritersl  r!  r;   c                    WP                   9   # )a*  
Checks if the file descriptor is currently being observed for read
readiness.

@param fd: The file descriptor being checked.
@type fd: L{twisted.internet.abstract.FileDescriptor}
@return: C{True} if the file descriptor is being observed for read
    readiness, C{False} otherwise.
@rtype: C{bool}
)r   r2   r   s   &&r8   	isReading_ContinuousPolling.isReadingr       ]]""r;   c                    WP                   9   # )a,  
Checks if the file descriptor is currently being observed for write
readiness.

@param fd: The file descriptor being checked.
@type fd: L{twisted.internet.abstract.FileDescriptor}
@return: C{True} if the file descriptor is being observed for write
    readiness, C{False} otherwise.
@rtype: C{bool}
)r   r&  s   &&r8   	isWriting_ContinuousPolling.isWriting  r)  r;   )r   r   r   r   N)r=   r>   r?   r@   rA   r   r   r   r   r  r  rU   r  r)   r/   r  r  r#  r'  r+  rC   r<   r;   r8   r   r     sV    , HI$@		####r;   r   fromfd)ArA   
__future__r   r   r   typingr   zope.interfacer   r   twisted.internetr   r   r   twisted.internet.baser	   twisted.internet.interfacesr
   r   r   r   r   r   r   r   r   r   r   twisted.internet.mainr   r   twisted.internet.protocolr   twisted.pythonr   r   twisted.python.runtimer   r   _signalsr   r   r   r   r    ConnectionFdescWentAwayr   twisted.protocolsr!   _tlsImportErrorr"   _sslr   processEnabledr$   r%   	isWindowsre   r'   rE   r   r   getattr__all__r<   r;   r8   <module>rB     s  
 #  
  7 , , -    C 3 ' 9  ,,-CD- C, Cg%.N 
#< #<L [+'89x51; x5 :x5v	F@ F@R ]N#)C N# N#b ?co$k2$l4HI$o6
68T".$n5
I  
C  
C&  s6   E" E1 
F  "	E.-E.1	E=<E= 	FF