AlkantarClanX12

Your IP : 18.221.183.34


Current Path : /proc/self/root/lib64/python3.6/__pycache__/
Upload File :
Current File : //proc/self/root/lib64/python3.6/__pycache__/selectors.cpython-36.opt-2.pyc

3


 \�K�@s�ddlmZmZddlmZmZddlZddlZddlZd(Z	d)Z
dd�Zeddd	d
dg�Zde_
ejd*kr�dej_
dej_
dej_
dej_
Gdd�de�ZGdd�ded�ZGdd�de�ZGdd�de�Zeed�r�Gdd�de�Zeed��rGd d!�d!e�Zeed"��rGd#d$�d$e�Zeed%��r:Gd&d'�d'e�Zd'e�k�rLeZn:d!e�k�r^eZn(d$e�k�rpeZnde�k�r�eZneZdS)+�)�ABCMeta�abstractmethod)�
namedtuple�MappingN�c
Csft|t�r|}n<yt|j��}Wn*tttfk
rJtdj|��d�YnX|dkrbtdj|���|S)NzInvalid file object: {!r}rzInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError�	TypeError�
ValueError�format)�fileobj�fd�r�!/usr/lib64/python3.6/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__Asz_SelectorMapping.__len__cCsBy|jj|�}|jj|Stk
r<tdj|��d�YnXdS)Nz{!r} is not registered)r�_fileobj_lookupr�KeyErrorr
)rrrrrr�__getitem__Ds
z_SelectorMapping.__getitem__cCst|jj�S)N)�iterrr)rrrr�__iter__Ksz_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�
unregisteruszBaseSelector.unregistercCs|j|�|j|||�S)N)r*r))rrrrrrr�modify�s
zBaseSelector.modifycCst�dS)N)r()r�timeoutrrr�select�szBaseSelector.selectcCsdS)Nr)rrrr�close�szBaseSelector.closecCsJ|j�}|dkrtd��y||Stk
rDtdj|��d�YnXdS)NzSelector is closedz{!r} is not registered)�get_map�RuntimeErrorr r
)rr�mappingrrr�get_key�szBaseSelector.get_keycCst�dS)N)r()rrrrr/�szBaseSelector.get_mapcCs|S)Nr)rrrr�	__enter__�szBaseSelector.__enter__cGs|j�dS)N)r.)r�argsrrr�__exit__�szBaseSelector.__exit__)N)N)N)
r$r%r&rr)r*r+r-r.r2r/r3r5rrrrr'Os
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"|jj�D]}|j|kr$|jSq$W�YnXdS)N)rrr�valuesrr)rr�keyrrrr�s	

z!_BaseSelectorImpl._fileobj_lookupNcCsd|s|ttB@r"tdj|���t||j|�||�}|j|jkrTtdj||j���||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered)	�
EVENT_READ�EVENT_WRITErr
rrrrr )rrrrr:rrrr)�sz_BaseSelectorImpl.registercCs@y|jj|j|��}Wn$tk
r:tdj|��d�YnX|S)Nz{!r} is not registered)r�poprr r
)rrr:rrrr*�s
z_BaseSelectorImpl.unregistercCs�y|j|j|�}Wn$tk
r8tdj|��d�YnX||jkr^|j|�|j|||�}n"||jkr�|j|d�}||j|j	<|S)Nz{!r} is not registered)r)
rrr r
rr*r)r�_replacer)rrrrr:rrrr+�s


z_BaseSelectorImpl.modifycCs|jj�d|_dS)N)r�clearr8)rrrrr.s
z_BaseSelectorImpl.closecCs|jS)N)r8)rrrrr/sz_BaseSelectorImpl.get_mapcCs$y
|j|Stk
rdSXdS)N)rr )rrrrr�_key_from_fds	
z_BaseSelectorImpl._key_from_fd)N)N)r$r%r&rrr)r*r+r.r/r@rrrrr7�s


r7cs\eZdZ�fdd�Zd
�fdd�	Z�fdd�ZejdkrDdd	d
�Zne	j	Zddd�Z	�Z
S)�SelectSelectorcst�j�t�|_t�|_dS)N)�superr�set�_readers�_writers)r)�	__class__rrr%s
zSelectSelector.__init__Ncs@t�j|||�}|t@r&|jj|j�|t@r<|jj|j�|S)N)rBr)r;rD�addrr<rE)rrrrr:)rFrrr)*szSelectSelector.registercs,t�j|�}|jj|j�|jj|j�|S)N)rBr*rD�discardrrE)rrr:)rFrrr*2szSelectSelector.unregisterZwin32cCs$tj||||�\}}}|||gfS)N)r-)r�r�w�_r,�xrrr�_select9szSelectSelector._selectc	
Cs�|dkrdnt|d�}g}y|j|j|jg|�\}}}Wntk
rL|SXt|�}t|�}xV||BD]J}d}||kr�|tO}||kr�|tO}|j|�}|rh|j	|||j
@f�qhW|S)Nr)�maxrMrDrE�InterruptedErrorrCr;r<r@�appendr)	rr,�readyrIrJrKrrr:rrrr-?s$
zSelectSelector.select)N)N)N)r$r%r&rr)r*�sys�platformrMr-�
__classcell__rr)rFrrA"s
rA�pollcs@eZdZ�fdd�Zd
�fdd�	Z�fdd�Zddd	�Z�ZS)�PollSelectorcst�j�tj�|_dS)N)rBrr-rU�_poll)r)rFrrrZs
zPollSelector.__init__NcsLt�j|||�}d}|t@r&|tjO}|t@r8|tjO}|jj|j|�|S)Nr)	rBr)r;r-�POLLINr<�POLLOUTrWr)rrrrr:�poll_events)rFrrr)^s

zPollSelector.registercst�j|�}|jj|j�|S)N)rBr*rWr)rrr:)rFrrr*hszPollSelector.unregisterc
Cs�|dkrd}n|dkrd}ntj|d�}g}y|jj|�}Wntk
rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r�|t	O}|j
|�}|rZ|j|||j@f�qZW|S)Nrg@�@)
�math�ceilrWrUrOr-rXr<rYr;r@rPr)rr,rQ�
fd_event_listr�eventrr:rrrr-ms(
zPollSelector.select)N)N)r$r%r&rr)r*r-rTrr)rFrrVWs
rV�epollcsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�
EpollSelectorcst�j�tj�|_dS)N)rBrr-r_�_epoll)r)rFrrr�s
zEpollSelector.__init__cCs
|jj�S)N)rar	)rrrrr	�szEpollSelector.filenoNcstt�j|||�}d}|t@r&|tjO}|t@r8|tjO}y|jj|j|�Wn"t	k
rnt�j
|��YnX|S)Nr)rBr)r;r-�EPOLLINr<�EPOLLOUTrar�
BaseExceptionr*)rrrrr:Zepoll_events)rFrrr)�s

zEpollSelector.registercs8t�j|�}y|jj|j�Wntk
r2YnX|S)N)rBr*rar�OSError)rrr:)rFrrr*�szEpollSelector.unregisterc	
Cs�|dkrd}n |dkrd}ntj|d�d}tt|j�d�}g}y|jj||�}Wntk
rh|SXx^|D]V\}}d}|tj	@r�|t
O}|tj@r�|tO}|j
|�}|rp|j|||j@f�qpW|S)Nrrg@�@g����MbP?���)r[r\rNrrrarUrOr-rbr<rcr;r@rPr)	rr,�max_evrQr]rr^rr:rrrr-�s*
zEpollSelector.selectcs|jj�t�j�dS)N)rar.rB)r)rFrrr.�s
zEpollSelector.close)N)N)
r$r%r&rr	r)r*r-r.rTrr)rFrr`�s

 r`�devpollcsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�DevpollSelectorcst�j�tj�|_dS)N)rBrr-rh�_devpoll)r)rFrrr�s
zDevpollSelector.__init__cCs
|jj�S)N)rjr	)rrrrr	�szDevpollSelector.filenoNcsLt�j|||�}d}|t@r&|tjO}|t@r8|tjO}|jj|j|�|S)Nr)	rBr)r;r-rXr<rYrjr)rrrrr:rZ)rFrrr)�s

zDevpollSelector.registercst�j|�}|jj|j�|S)N)rBr*rjr)rrr:)rFrrr*�szDevpollSelector.unregisterc
Cs�|dkrd}n|dkrd}ntj|d�}g}y|jj|�}Wntk
rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r�|t	O}|j
|�}|rZ|j|||j@f�qZW|S)Nrg@�@)
r[r\rjrUrOr-rXr<rYr;r@rPr)rr,rQr]rr^rr:rrrr-�s(
zDevpollSelector.selectcs|jj�t�j�dS)N)rjr.rB)r)rFrrr.s
zDevpollSelector.close)N)N)
r$r%r&rr	r)r*r-r.rTrr)rFrri�s

ri�kqueuecsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�KqueueSelectorcst�j�tj�|_dS)N)rBrr-rk�_kqueue)r)rFrrrs
zKqueueSelector.__init__cCs
|jj�S)N)rmr	)rrrrr	szKqueueSelector.filenoNcs�t�j|||�}y`|t@r@tj|jtjtj�}|jj	|gdd�|t
@rntj|jtjtj�}|jj	|gdd�Wn"tk
r�t�j
|��YnX|S)Nr)rBr)r;r-�keventr�KQ_FILTER_READZ	KQ_EV_ADDrm�controlr<�KQ_FILTER_WRITErdr*)rrrrr:�kev)rFrrr)szKqueueSelector.registercs�t�j|�}|jt@rVtj|jtjtj�}y|j	j
|gdd�Wntk
rTYnX|jt@r�tj|jtj
tj�}y|j	j
|gdd�Wntk
r�YnX|S)Nr)rBr*rr;r-rnrroZKQ_EV_DELETErmrprer<rq)rrr:rr)rFrrr*'s 

zKqueueSelector.unregisterc

Cs�|dkrdnt|d�}t|j�}g}y|jjd||�}Wntk
rL|SXxb|D]Z}|j}|j}d}|tj	krz|t
O}|tjkr�|tO}|j
|�}	|	rT|j|	||	j@f�qTW|S)Nr)rNrrrmrprOZident�filterr-ror;rqr<r@rPr)
rr,rgrQZkev_listrrr�flagrr:rrrr-<s&




zKqueueSelector.selectcs|jj�t�j�dS)N)rmr.rB)r)rFrrr.Rs
zKqueueSelector.close)N)N)
r$r%r&rr	r)r*r-r.rTrr)rFrrl
s
rlr�)rr)�abcrr�collectionsrrr[r-rRr;r<rr�__doc__�version_inforrrrrr'r7rA�hasattrrVr`rirl�globalsZDefaultSelectorrrrr�<module>sF
~U3
1G8M