AlkantarClanX12

Your IP : 3.138.36.168


Current Path : /proc/self/root/opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python39/lib64/python3.9/__pycache__/selectors.cpython-39.opt-2.pyc

a

R�fPL�@s�ddlmZmZddlmZddlmZddlZddlZddl	Z	dZ
dZdd�Zed	gd
��Z
de
_e	jdkr�d
e
j_de
j_de
j_de
j_Gdd�de�ZGdd�ded�ZGdd�de�ZGdd�de�ZGdd�de�Zeed�r�Gdd�de�Zeed��rGd d!�d!e�Zeed"��r2Gd#d$�d$e�Zeed%��rNGd&d'�d'e�Zd(d)�Zed%��rfeZn4ed��rveZn$ed"��r�eZned��r�eZneZdS)*�)�ABCMeta�abstractmethod)�
namedtuple)�MappingN��c
Csdt|t�r|}n:zt|���}Wn(tttfyHtd�|��d�Yn0|dkr`td�|���|S)NzInvalid file object: {!r}rzInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError�	TypeError�
ValueError�format)�fileobj�fd�r�./opt/alt/python39/lib64/python3.9/selectors.py�_fileobj_to_fds
��r�SelectorKey)rr�events�dataz�SelectorKey(fileobj, fd, events, data)

    Object used to associate a file object to its backing
    file descriptor, selected event mask, and attached data.
)��zFile object registered.zUnderlying file descriptor.z3Events that must be waited for on this file object.zzOptional opaque data associated to this file object.
    For example, this could be used to store a per-client session ID.c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_SelectorMappingcCs
||_dS�N)�	_selector)�self�selectorrrr�__init__@sz_SelectorMapping.__init__cCst|jj�Sr)�lenr�
_fd_to_key�rrrr�__len__Csz_SelectorMapping.__len__cCsBz|j�|�}|jj|WSty<td�|��d�Yn0dS�N�{!r} is not registered)r�_fileobj_lookupr �KeyErrorr)rrrrrr�__getitem__Fs
z_SelectorMapping.__getitem__cCst|jj�Sr)�iterrr r!rrr�__iter__Msz_SelectorMapping.__iter__N)�__name__�
__module__�__qualname__rr"r'r)rrrrr=src@sjeZdZeddd��Zedd��Zddd�Zeddd	��Zd
d�Zdd
�Z	edd��Z
dd�Zdd�ZdS)�BaseSelectorNcCst�dSr��NotImplementedError�rrrrrrr�register`szBaseSelector.registercCst�dSrr.)rrrrr�
unregisterwszBaseSelector.unregistercCs|�|�|�|||�Sr)r2r1r0rrr�modify�s
zBaseSelector.modifycCst�dSrr.)r�timeoutrrr�select�szBaseSelector.selectcCsdSrrr!rrr�close�szBaseSelector.closecCsJ|��}|durtd��z
||WStyDtd�|��d�Yn0dS)NzSelector is closedr$)�get_map�RuntimeErrorr&r)rr�mappingrrr�get_key�s
zBaseSelector.get_keycCst�dSrr.r!rrrr7�szBaseSelector.get_mapcCs|Srrr!rrr�	__enter__�szBaseSelector.__enter__cGs|��dSr)r6)r�argsrrr�__exit__�szBaseSelector.__exit__)N)N)N)
r*r+r,rr1r2r3r5r6r:r7r;r=rrrrr-Qs


r-)�	metaclassc@sPeZdZdd�Zdd�Zddd�Zdd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dS)�_BaseSelectorImplcCsi|_t|�|_dSr)r r�_mapr!rrrr�sz_BaseSelectorImpl.__init__cCsLz
t|�WStyF|j��D]}|j|ur"|jYSq"�Yn0dSr)rr
r �valuesrr�rr�keyrrrr%�s	

z!_BaseSelectorImpl._fileobj_lookupNcCsb|r|ttB@r td�|���t||�|�||�}|j|jvrRtd�||j���||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered)	�
EVENT_READ�EVENT_WRITEr
rrr%rr r&�rrrrrCrrrr1�s�z_BaseSelectorImpl.registercCs>z|j�|�|��}Wn"ty8td�|��d�Yn0|Sr#)r �popr%r&rrBrrrr2�s
z_BaseSelectorImpl.unregistercCs�z|j|�|�}Wn"ty6td�|��d�Yn0||jkr\|�|�|�|||�}n"||jkr~|j|d�}||j|j	<|S)Nr$)r)
r r%r&rrr2r1r�_replacerrFrrrr3�s


z_BaseSelectorImpl.modifycCs|j��d|_dSr)r �clearr@r!rrrr6
s
z_BaseSelectorImpl.closecCs|jSr)r@r!rrrr7sz_BaseSelectorImpl.get_mapcCs&z|j|WSty YdS0dSr)r r&)rrrrr�_key_from_fds	z_BaseSelectorImpl._key_from_fd)N)N)r*r+r,rr%r1r2r3r6r7rJrrrrr?�s


r?cs\eZdZ�fdd�Zd
�fdd�	Z�fdd�ZejdkrDdd	d
�Zne	j	Zddd�Z	�Z
S)�SelectSelectorcst���t�|_t�|_dSr)�superr�set�_readers�_writersr!��	__class__rrr&s
zSelectSelector.__init__Ncs@t��|||�}|t@r&|j�|j�|t@r<|j�|j�|Sr)rLr1rDrN�addrrErOrFrPrrr1+szSelectSelector.registercs,t��|�}|j�|j�|j�|j�|Sr)rLr2rN�discardrrOrBrPrrr23szSelectSelector.unregisterZwin32cCs$t�||||�\}}}|||gfSr)r5)r�r�w�_r4�xrrr�_select:szSelectSelector._selectc	Cs�|durdnt|d�}g}z|�|j|jg|�\}}}WntyN|YS0t|�}t|�}||BD]J}d}||vr�|tO}||vr�|tO}|�|�}|rh|�	|||j
@f�qh|S�Nr)�maxrXrNrO�InterruptedErrorrMrDrErJ�appendr)	rr4�readyrTrUrVrrrCrrrr5@s$

zSelectSelector.select)N)N)N)r*r+r,rr1r2�sys�platformrXr5�
__classcell__rrrPrrK#s
rKcsZeZdZdZdZdZ�fdd�Zd�fdd�	Z�fdd�Zd
�fdd	�	Z	dd
d�Z
�ZS)�_PollLikeSelectorNcst���|��|_dSr)rLr�
_selector_clsrr!rPrrr\s
z_PollLikeSelector.__init__cslt��|||�}d}|t@r&||jO}|t@r8||jO}z|j�|j|�Wnt��|��Yn0|SrY)	rLr1rD�_EVENT_READrE�_EVENT_WRITErrr2)rrrrrCZ
poller_eventsrPrrr1`s

z_PollLikeSelector.registercs6t��|�}z|j�|j�Wnty0Yn0|Sr)rLr2rr�OSErrorrBrPrrr2nsz_PollLikeSelector.unregistercs�z|j|�|�}Wn"ty6t|�d��d�Yn0d}||jkr�d}|t@r\||jO}|t@rn||jO}z|j�	|j
|�Wnt��|��Yn0d}||j
kr�d}|r�|j||d�}||j|j
<|S)Nz is not registeredFrT)rr)r r%r&rrDrcrErdrr3rrLr2rrH)rrrrrCZchangedZselector_eventsrPrrr3xs.



z_PollLikeSelector.modifycCs�|durd}n|dkrd}nt�|d�}g}z|j�|�}WntyT|YS0|D]V\}}d}||j@rz|tO}||j@r�|tO}|�	|�}|rZ|�
|||j@f�qZ|S)Nr�@�@)�math�ceilr�pollr[rcrErdrDrJr\r)rr4r]�
fd_event_listr�eventrrCrrrr5�s(

z_PollLikeSelector.select)N)N)N)r*r+r,rbrcrdrr1r2r3r5r`rrrPrraVs
raric@seZdZejZejZejZ	dS)�PollSelectorN)
r*r+r,r5rirb�POLLINrc�POLLOUTrdrrrrrl�srl�epollcs@eZdZejZejZejZ	dd�Z
ddd�Z�fdd�Z�ZS)	�
EpollSelectorcCs
|j��Sr�rr
r!rrrr
�szEpollSelector.filenoNc	Cs�|durd}n |dkrd}nt�|d�d}tt|j�d�}g}z|j�||�}Wntyj|YS0|D]V\}}d}|tj	@r�|t
O}|tj@r�|tO}|�
|�}|rp|�|||j@f�qp|S)N���rrfg����MbP?r)rgrhrZrr rrir[r5�EPOLLINrE�EPOLLOUTrDrJr\r)	rr4�max_evr]rjrrkrrCrrrr5�s*

zEpollSelector.selectcs|j��t���dSr�rr6rLr!rPrrr6�s
zEpollSelector.close)N)
r*r+r,r5rorbrsrcrtrdr
r6r`rrrPrrp�s
 rp�devpollcs6eZdZejZejZejZ	dd�Z
�fdd�Z�ZS)�DevpollSelectorcCs
|j��Srrqr!rrrr
�szDevpollSelector.filenocs|j��t���dSrrvr!rPrrr6�s
zDevpollSelector.close)
r*r+r,r5rwrbrmrcrnrdr
r6r`rrrPrrx�s
rx�kqueuecsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�KqueueSelectorcst���t��|_dSr)rLrr5ryrr!rPrrr�s
zKqueueSelector.__init__cCs
|j��Srrqr!rrrr
szKqueueSelector.filenoNcs�t��|||�}z`|t@r@t�|jtjtj�}|j�	|gdd�|t
@rnt�|jtjtj�}|j�	|gdd�Wnt��|��Yn0|SrY)
rLr1rDr5�keventr�KQ_FILTER_READZ	KQ_EV_ADDr�controlrE�KQ_FILTER_WRITEr2)rrrrrC�kevrPrrr1s ��zKqueueSelector.registercs�t��|�}|jt@rTt�|jtjtj�}z|j	�
|gdd�WntyRYn0|jt@r�t�|jtj
tj�}z|j	�
|gdd�Wnty�Yn0|SrY)rLr2rrDr5r{rr|ZKQ_EV_DELETErr}rerEr~)rrrCrrPrrr2s$
�
�zKqueueSelector.unregisterc
Cs�|durdnt|d�}tt|j�d�}g}z|j�d||�}WntyT|YS0|D]Z}|j}|j}d}|tj	kr�|t
O}|tjkr�|tO}|�
|�}	|	rZ|�|	||	j@f�qZ|S)Nrr)rZrr rr}r[Zident�filterr5r|rDr~rErJr\r)
rr4rur]Zkev_listrr�flagrrCrrrr5*s&



zKqueueSelector.selectcs|j��t���dSrrvr!rPrrr6Cs
zKqueueSelector.close)N)N)
r*r+r,rr
r1r2r5r6r`rrrPrrz�s
rzcCsZtt|d�}|durdSz(|�}|dkr4|�d�n|��WdStyTYdS0dS)NFrirT)�getattrr5rir6re)�methodrZselector_objrrr�_can_useHsr�) �abcrr�collectionsr�collections.abcrrgr5r^rDrErr�__doc__�version_inforrrrrr-r?rKra�hasattrrlrprxrzr�ZDefaultSelectorrrrr�<module>sL
~T3Z
.M