Hacked By AnonymousFox

Current Path : /opt/alt/python36/lib64/python3.6/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/__pycache__/selectors.cpython-36.opt-2.pyc

3

��2a�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�./opt/alt/python36/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.unregister�win32cCs$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)�maxrNrDrE�InterruptedErrorrCr;r<r@�appendr)	rr,�readyrJrKrLrrr:rrrr-?s$
zSelectSelector.select)N)N)N)r$r%r&rr)r*�sys�platformrNr-�
__classcell__rr)rFrrA"s
rA�pollcs@eZdZ�fdd�Zd
�fdd�	Z�fdd�Zddd	�Z�ZS)�PollSelectorcst�j�tj�|_dS)N)rBrr-rV�_poll)r)rFrrrZs
zPollSelector.__init__NcsLt�j|||�}d}|t@r&|tjO}|t@r8|tjO}|jj|j|�|S)Nr)	rBr)r;r-�POLLINr<�POLLOUTrXr)rrrrr:�poll_events)rFrrr)^s

zPollSelector.registercst�j|�}|jj|j�|S)N)rBr*rXr)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�ceilrXrVrPr-rYr<rZr;r@rQr)rr,rR�
fd_event_listr�eventrr:rrrr-ms(
zPollSelector.select)N)N)r$r%r&rr)r*r-rUrr)rFrrWWs
rW�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)rbr	)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<�EPOLLOUTrbr�
BaseExceptionr*)rrrrr:Zepoll_events)rFrrr)�s

zEpollSelector.registercs8t�j|�}y|jj|j�Wntk
r2YnX|S)N)rBr*rbr�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]rOrrrbrVrPr-rcr<rdr;r@rQr)	rr,�max_evrRr^rr_rr:rrrr-�s*
zEpollSelector.selectcs|jj�t�j�dS)N)rbr.rB)r)rFrrr.�s
zEpollSelector.close)N)N)
r$r%r&rr	r)r*r-r.rUrr)rFrra�s

 ra�devpollcsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�DevpollSelectorcst�j�tj�|_dS)N)rBrr-ri�_devpoll)r)rFrrr�s
zDevpollSelector.__init__cCs
|jj�S)N)rkr	)rrrrr	�szDevpollSelector.filenoNcsLt�j|||�}d}|t@r&|tjO}|t@r8|tjO}|jj|j|�|S)Nr)	rBr)r;r-rYr<rZrkr)rrrrr:r[)rFrrr)�s

zDevpollSelector.registercst�j|�}|jj|j�|S)N)rBr*rkr)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]rkrVrPr-rYr<rZr;r@rQr)rr,rRr^rr_rr:rrrr-�s(
zDevpollSelector.selectcs|jj�t�j�dS)N)rkr.rB)r)rFrrr.s
zDevpollSelector.close)N)N)
r$r%r&rr	r)r*r-r.rUrr)rFrrj�s

rj�kqueuecsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�KqueueSelectorcst�j�tj�|_dS)N)rBrr-rl�_kqueue)r)rFrrrs
zKqueueSelector.__init__cCs
|jj�S)N)rnr	)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_ADDrn�controlr<�KQ_FILTER_WRITErer*)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-rorrpZKQ_EV_DELETErnrqrfr<rr)rrr:rs)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)rOrrrnrqrPZident�filterr-rpr;rrr<r@rQr)
rr,rhrRZkev_listrsr�flagrr:rrrr-<s&




zKqueueSelector.selectcs|jj�t�j�dS)N)rnr.rB)r)rFrrr.Rs
zKqueueSelector.close)N)N)
r$r%r&rr	r)r*r-r.rUrr)rFrrm
s
rmr�)rr)�abcrr�collectionsrrr\r-rSr;r<rr�__doc__�version_inforrrrrr'r7rA�hasattrrWrarjrm�globalsZDefaultSelectorrrrr�<module>sF
~U3
1G8M

Hacked By AnonymousFox1.0, Coded By AnonymousFox