Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/selectors.cpython-37.opt-2.pyc

B

YI~d�H�@s�ddlmZmZddlmZddlmZddlZddlZddl	Z	dZ
dZdd�Zed	d
ddd
g�Z
de
_e	jdkr�de
j_de
j_de
j_de
j_Gdd�de�ZGdd�ded�ZGdd�de�ZGdd�de�ZGdd�de�Zeed�r�Gd d!�d!e�Zeed"��rGd#d$�d$e�Zeed%��r6Gd&d'�d'e�Zeed(��rRGd)d*�d*e�Zd*e�k�rdeZn:d$e�k�rveZn(d'e�k�r�eZnd!e�k�r�eZneZdS)+�)�ABCMeta�abstractmethod)�
namedtuple)�MappingN��c
Csft|t�r|}n<yt|���}Wn*tttfk
rJtd�|��d�YnX|dkrbtd�|���|S)NzInvalid file object: {!r}rzInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError�	TypeError�
ValueError�format)�fileobj�fd�r�./opt/alt/python37/lib64/python3.7/selectors.py�_fileobj_to_fds
r�SelectorKeyrr�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)�selfZselectorrrr�__init__?sz_SelectorMapping.__init__cCst|jj�S)N)�lenr�
_fd_to_key)rrrr�__len__Bsz_SelectorMapping.__len__cCsBy|j�|�}|jj|Stk
r<td�|��d�YnXdS)Nz{!r} is not registered)r�_fileobj_lookupr�KeyErrorr)rrrrrr�__getitem__Es
z_SelectorMapping.__getitem__cCst|jj�S)N)�iterrr)rrrr�__iter__Lsz_SelectorMapping.__iter__N)�__name__�
__module__�__qualname__rrr"r$rrrrr<src@sjeZdZeddd��Zedd��Zddd�Zeddd	��Zd
d�Zdd
�Z	edd��Z
dd�Zdd�ZdS)�BaseSelectorNcCst�dS)N)�NotImplementedError)rrrrrrr�register_szBaseSelector.registercCst�dS)N)r))rrrrr�
unregistervszBaseSelector.unregistercCs|�|�|�|||�S)N)r+r*)rrrrrrr�modify�s
zBaseSelector.modifycCst�dS)N)r))r�timeoutrrr�select�szBaseSelector.selectcCsdS)Nr)rrrr�close�szBaseSelector.closecCsJ|��}|dkrtd��y||Stk
rDtd�|��d�YnXdS)NzSelector is closedz{!r} is not registered)�get_map�RuntimeErrorr!r)rr�mappingrrr�get_key�szBaseSelector.get_keycCst�dS)N)r))rrrrr0�szBaseSelector.get_mapcCs|S)Nr)rrrr�	__enter__�szBaseSelector.__enter__cGs|��dS)N)r/)r�argsrrr�__exit__�szBaseSelector.__exit__)N)N)N)
r%r&r'rr*r+r,r.r/r3r0r4r6rrrrr(Ps
r()�	metaclassc@sPeZdZdd�Zdd�Zddd�Zdd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dS)�_BaseSelectorImplcCsi|_t|�|_dS)N)rr�_map)rrrrr�sz_BaseSelectorImpl.__init__cCsHyt|�Stk
rBx"|j��D]}|j|kr$|jSq$W�YnXdS)N)rr
r�valuesrr)rr�keyrrrr �s	

z!_BaseSelectorImpl._fileobj_lookupNcCsb|r|ttB@r td�|���t||�|�||�}|j|jkrRtd�||j���||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered)	�
EVENT_READ�EVENT_WRITEr
rrr rrr!)rrrrr;rrrr*�sz_BaseSelectorImpl.registercCs@y|j�|�|��}Wn$tk
r:td�|��d�YnX|S)Nz{!r} is not registered)r�popr r!r)rrr;rrrr+�s
z_BaseSelectorImpl.unregistercCs�y|j|�|�}Wn$tk
r8td�|��d�YnX||jkr^|�|�|�|||�}n"||jkr�|j|d�}||j|j	<|S)Nz{!r} is not registered)r)
rr r!rrr+r*r�_replacer)rrrrr;rrrr,�s


z_BaseSelectorImpl.modifycCs|j��d|_dS)N)r�clearr9)rrrrr/s
z_BaseSelectorImpl.closecCs|jS)N)r9)rrrrr0sz_BaseSelectorImpl.get_mapcCs$y
|j|Stk
rdSXdS)N)rr!)rrrrr�_key_from_fds	
z_BaseSelectorImpl._key_from_fd)N)N)r%r&r'rr r*r+r,r/r0rArrrrr8�s


r8cs\eZdZ�fdd�Zd
�fdd�	Z�fdd�ZejdkrDdd	d
�Zne	j	Zddd�Z	�Z
S)�SelectSelectorcst���t�|_t�|_dS)N)�superr�set�_readers�_writers)r)�	__class__rrr%s
zSelectSelector.__init__Ncs@t��|||�}|t@r&|j�|j�|t@r<|j�|j�|S)N)rCr*r<rE�addrr=rF)rrrrr;)rGrrr**szSelectSelector.registercs,t��|�}|j�|j�|j�|j�|S)N)rCr+rE�discardrrF)rrr;)rGrrr+2szSelectSelector.unregister�win32cCs$t�||||�\}}}|||gfS)N)r.)r�r�w�_r-�xrrr�_select9szSelectSelector._selectc	Cs�|dkrdnt|d�}g}y|�|j|jg|�\}}}Wntk
rL|SXt|�}t|�}xV||BD]J}d}||kr�|tO}||kr�|tO}|�|�}|rh|�	|||j
@f�qhW|S)Nr)�maxrOrErF�InterruptedErrorrDr<r=rA�appendr)	rr-�readyrKrLrMrrr;rrrr.?s$
zSelectSelector.select)N)N)N)r%r&r'rr*r+�sys�platformrOr.�
__classcell__rr)rGrrB"s
rBcsZeZdZdZdZdZ�fdd�Zd�fdd�	Z�fdd�Zd
�fdd	�	Z	dd
d�Z
�ZS)�_PollLikeSelectorNcst���|��|_dS)N)rCr�
_selector_clsr)r)rGrrr[s
z_PollLikeSelector.__init__cslt��|||�}d}|t@r&||jO}|t@r8||jO}y|j�|j|�Wnt��|��YnX|S)Nr)	rCr*r<�_EVENT_READr=�_EVENT_WRITErrr+)rrrrr;Z
poller_events)rGrrr*_s

z_PollLikeSelector.registercs8t��|�}y|j�|j�Wntk
r2YnX|S)N)rCr+rr�OSError)rrr;)rGrrr+msz_PollLikeSelector.unregistercs�y|j|�|�}Wn$tk
r8t|�d��d�YnXd}||jkr�d}|t@r^||jO}|t@rp||jO}y|j�	|j
|�Wnt��|��YnXd}||j
kr�d}|r�|j||d�}||j|j
<|S)Nz is not registeredFrT)rr)rr r!rr<rYr=rZrr,rrCr+rr?)rrrrr;ZchangedZselector_events)rGrrr,ws.



z_PollLikeSelector.modifycCs�|dkrd}n|dkrd}nt�|d�}g}y|j�|�}Wntk
rR|SXx^|D]V\}}d}||j@rz|tO}||j@r�|tO}|�	|�}|rZ|�
|||j@f�qZW|S)Nrg@�@)�math�ceilr�pollrQrYr=rZr<rArRr)rr-rS�
fd_event_listr�eventrr;rrrr.�s(
z_PollLikeSelector.select)N)N)N)r%r&r'rXrYrZrr*r+r,r.rVrr)rGrrWUs
rWr^c@seZdZejZejZejZ	dS)�PollSelectorN)
r%r&r'r.r^rX�POLLINrY�POLLOUTrZrrrrra�sra�epollcs@eZdZejZejZejZ	dd�Z
ddd�Z�fdd�Z�ZS)	�
EpollSelectorcCs
|j��S)N)rr
)rrrrr
�szEpollSelector.filenoNc	Cs�|dkrd}n |dkrd}nt�|d�d}tt|j�d�}g}y|j�||�}Wntk
rh|SXx^|D]V\}}d}|tj	@r�|t
O}|tj@r�|tO}|�
|�}|rp|�|||j@f�qpW|S)N���rg@�@g����MbP?r)r\r]rPrrrr^rQr.�EPOLLINr=�EPOLLOUTr<rArRr)	rr-�max_evrSr_rr`rr;rrrr.�s*
zEpollSelector.selectcs|j��t���dS)N)rr/rC)r)rGrrr/�s
zEpollSelector.close)N)
r%r&r'r.rdrXrgrYrhrZr
r/rVrr)rGrre�s
 re�devpollcs6eZdZejZejZejZ	dd�Z
�fdd�Z�ZS)�DevpollSelectorcCs
|j��S)N)rr
)rrrrr
�szDevpollSelector.filenocs|j��t���dS)N)rr/rC)r)rGrrr/�s
zDevpollSelector.close)
r%r&r'r.rjrXrbrYrcrZr
r/rVrr)rGrrk�s
rk�kqueuecsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�KqueueSelectorcst���t��|_dS)N)rCrr.rlr)r)rGrrr�s
zKqueueSelector.__init__cCs
|j��S)N)rr
)rrrrr
szKqueueSelector.filenoNcs�t��|||�}y`|t@r@t�|jtjtj�}|j�	|gdd�|t
@rnt�|jtjtj�}|j�	|gdd�Wnt��|��YnX|S)Nr)
rCr*r<r.�keventr�KQ_FILTER_READZ	KQ_EV_ADDr�controlr=�KQ_FILTER_WRITEr+)rrrrr;�kev)rGrrr*szKqueueSelector.registercs�t��|�}|jt@rVt�|jtjtj�}y|j	�
|gdd�Wntk
rTYnX|jt@r�t�|jtj
tj�}y|j	�
|gdd�Wntk
r�YnX|S)Nr)rCr+rr<r.rnrroZKQ_EV_DELETErrpr[r=rq)rrr;rr)rGrrr+s 

zKqueueSelector.unregisterc
Cs�|dkrdnt|d�}t|j�}g}y|j�d||�}Wntk
rL|SXxb|D]Z}|j}|j}d}|tj	krz|t
O}|tjkr�|tO}|�
|�}	|	rT|�|	||	j@f�qTW|S)Nr)rPrrrrprQZident�filterr.ror<rqr=rArRr)
rr-rirSZkev_listrrr�flagrr;rrrr.)s&




zKqueueSelector.selectcs|j��t���dS)N)rr/rC)r)rGrrr/?s
zKqueueSelector.close)N)N)
r%r&r'rr
r*r+r.r/rVrr)rGrrm�s
rm) �abcrr�collectionsrZcollections.abcrr\r.rTr<r=rr�__doc__�version_inforrrrrr(r8rBrW�hasattrrarerkrm�globalsZDefaultSelectorrrrr�<module>sJ
~T3Z
.M

Hacked By AnonymousFox1.0, Coded By AnonymousFox