ó
    Ö›‘hV  ã                   óÈ   • S r SSKrSSKJrJrJrJrJrJr	J
r
  SSKJr  SSKJr  SSKJr  SSKJr  \" \5       " S S	\R&                  \R(                  5      5       rS
 rS	S/rg)zñ
A poll() based implementation of the twisted main loop.

To install the event loop (and you should do this before any connections,
listeners or connectors are added)::

    from twisted.internet import pollreactor
    pollreactor.install()
é    N)ÚPOLLERRÚPOLLHUPÚPOLLINÚPOLLNVALÚPOLLOUTÚerrorÚpoll)Úimplementer)Ú	posixbase)ÚIReactorFDSet)Úlogc                   óv   • \ rS rSrSr\\-  \-  r\	r
\rS rS rS rS rS rS rS	 rS
 rS r\rS rS rSrg)ÚPollReactoré$   a  
A reactor that uses poll(2).

@ivar _poller: A L{select.poll} which will be used to check for I/O
    readiness.

@ivar _selectables: A dictionary mapping integer file descriptors to
    instances of L{FileDescriptor} which have been registered with the
    reactor.  All L{FileDescriptor}s which are currently receiving read or
    write readiness notifications will be present as values in this
    dictionary.

@ivar _reads: A dictionary mapping integer file descriptors to arbitrary
    values (this is essentially a set).  Keys in this dictionary will be
    registered with C{_poller} for read readiness notifications which will
    be dispatched to the corresponding L{FileDescriptor} instances in
    C{_selectables}.

@ivar _writes: A dictionary mapping integer file descriptors to arbitrary
    values (this is essentially a set).  Keys in this dictionary will be
    registered with C{_poller} for write readiness notifications which will
    be dispatched to the corresponding L{FileDescriptor} instances in
    C{_selectables}.
c                 óŠ   • [        5       U l        0 U l        0 U l        0 U l        [
        R                  R                  U 5        g)zW
Initialize polling object, file descriptor tracking dictionaries, and
the base class.
N)r	   Ú_pollerÚ_selectablesÚ_readsÚ_writesr   ÚPosixReactorBaseÚ__init__)Úselfs    Ú`C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/internet/pollreactor.pyr   ÚPollReactor.__init__C   s7   € ô
 “vˆŒØˆÔØˆŒØˆŒÜ×"Ñ"×+Ñ+¨DÕ1ó    c                 ó>  •  U R                   R                  U5        SnXR                  ;   a	  U[        -  nXR
                  ;   a	  U[        -  nUS:w  a  U R                   R                  X5        gXR                  ;   a  U R                  U	 gg! [         a     N~f = f)z*Register/unregister an fd with the poller.r   N)	r   Ú
unregisterÚKeyErrorr   r   r   r   Úregisterr   )r   ÚfdÚmasks      r   Ú_updateRegistrationÚPollReactor._updateRegistrationN   s’   € ð	Ø�L‰L×#Ñ# BÔ'ð ˆØ—‘ÓØœ&‘=ˆDØ—‘ÓØœ'‘>ˆDØ�1‹9Ø�L‰L×!Ñ! "Õ+à×&Ñ&Ó&Ø×%Ñ% bÑ)ð 'øô ó 	Ùð	ús   ‚B Â
BÂBc                 óÖ   •  UR                  5       nX#     X2;   a  X#	 U R	                  U5        g g ! [         a.    U R                  R                  5        H  u  p4XL d  M     MM      g f = f©N)ÚfilenoÚBaseExceptionr   Úitemsr"   )r   Ú
selectableÚmdictr    Úfdess        r   Ú_dictRemoveÚPollReactor._dictRemove`   sw   € ð	à×"Ñ"Ó$ˆBð ŠIð ‹;Ø�	Ø×$Ñ$ RÕ(ð øô ó 		ð !×-Ñ-×3Ñ3Ö5‘�ØÔ%Ûñ 6ñ ð		ús   ‚0 °+A(ÁA(Á#A(Á'A(c                 ó    • UR                  5       nX R                  ;  a/  XR                  U'   SU R                  U'   U R                  U5        gg)z@Add a FileDescriptor for notification of data available to read.é   N)r&   r   r   r"   )r   Úreaderr    s      r   Ú	addReaderÚPollReactor.addReaderu   sE   € à�]‰]‹_ˆØ—[‘[Ó Ø$*×Ñ˜bÑ!ØˆD�K‰K˜‰OØ×$Ñ$ RÕ(ð !r   c                 ó    • UR                  5       nX R                  ;  a/  XR                  U'   SU R                  U'   U R                  U5        gg)zAAdd a FileDescriptor for notification of data available to write.r/   N)r&   r   r   r"   )r   Úwriterr    s      r   Ú	addWriterÚPollReactor.addWriter}   sF   € à�]‰]‹_ˆØ—\‘\Ó!Ø$*×Ñ˜bÑ!Ø ˆD�L‰L˜ÑØ×$Ñ$ RÕ(ð "r   c                 ó8   • U R                  XR                  5      $ )z?Remove a Selectable for notification of data available to read.)r,   r   )r   r0   s     r   ÚremoveReaderÚPollReactor.removeReader…   s   € à×Ñ ¯©Ó4Ð4r   c                 ó8   • U R                  XR                  5      $ )z@Remove a Selectable for notification of data available to write.)r,   r   )r   r4   s     r   ÚremoveWriterÚPollReactor.removeWriter‰   s   € à×Ñ ¯©Ó5Ð5r   c                 óÖ   • U R                  U R                   Vs/ s H  oR                  U   PM     snU R                   Vs/ s H  oR                  U   PM     sn5      $ s  snf s  snf )z4
Remove all selectables, and return a list of them.
)Ú
_removeAllr   r   r   ©r   r    s     r   Ú	removeAllÚPollReactor.removeAll�   sY   € ð �‰Ø-1¯[ª[Ó9ª[ r×Ñ˜rÔ"©[Ñ9Ø-1¯\ª\Ó:ª\ r×Ñ˜rÔ"©\Ñ:ó
ð 	
ùÚ9ùÚ:s   šA!ÁA&
c                 óp  • Ub  [        US-  5      n U R                  R                  U5      nU R                  nU H-  u  pV U R                  U   n[        R                  " XtXuU5        M/     g! [         a,  nUR                  S   [
        R                  :X  a   SnAge SnAff = f! [         a     Mx  f = f)zPoll the poller for new events.Niè  r   )Úintr   r	   ÚSelectErrorÚargsÚerrnoÚEINTRÚ_doReadOrWriter   r   r   ÚcallWithLogger)r   ÚtimeoutÚlÚeÚ_drdwr    Úeventr)   s           r   ÚdoPollÚPollReactor.doPoll–   s²   € àÑÜ˜' D™.Ó)ˆGð	Ø—‘×!Ñ! 'Ó*ˆAð ×#Ñ#ˆÛ‰IˆBðØ!×.Ñ.¨rÑ2�
ô
 ×Ò˜z°*À%ÖHò øô ó 	Ø�v‰v�a‰yœEŸK™KÓ'Üàûð		ûô ó ò ðús/   “A. ÁB'Á.
B$Á8!BÂBÂB$Â'
B5Â4B5c                 ó^   • U R                    Vs/ s H  oR                  U   PM     sn$ s  snf r%   )r   r   r?   s     r   Ú
getReadersÚPollReactor.getReaders®   s'   € Ø04·²Ó<²¨"×!Ñ! "Ô%±Ñ<Ð<ùÒ<ó   �*c                 ó^   • U R                    Vs/ s H  oR                  U   PM     sn$ s  snf r%   )r   r   r?   s     r   Ú
getWritersÚPollReactor.getWriters±   s'   € Ø04·²Ó=²¨"×!Ñ! "Ô%±Ñ=Ð=ùÒ=rT   )r   r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   Ú_POLL_DISCONNECTEDr   Ú_POLL_INr   Ú	_POLL_OUTr   r"   r,   r1   r5   r8   r;   r@   rO   ÚdoIterationrR   rV   Ú__static_attributes__© r   r   r   r   $   sb   † ñð2 ! 7Ñ*¨XÑ5ÐØ€HØ€Iò	2ò*ò$)ò*)ò)ò5ò6ò
òIð, €Kò=õ>r   r   c                  ó4   • [        5       n SSKJn  U" U 5        g)zInstall the poll() reactor.r   )ÚinstallReactorN)r   Útwisted.internet.mainrd   )Úprd   s     r   Úinstallrg   µ   s   € ä‹€AÝ4á�1Õr   rg   )r\   rF   Úselectr   r   r   r   r   r   rD   r	   Úzope.interfacer
   Útwisted.internetr   Útwisted.internet.interfacesr   Útwisted.pythonr   r   Ú_PollLikeMixinr   rg   Ú__all__rb   r   r   Ú<module>ro      sq   ðñó ÷÷ ñ õ 'å &Ý 5õ ñ ˆ]ÓôM>�)×,Ñ,¨i×.FÑ.Fó M>ó ðM>ò`ð ˜)Ð
$�r   