AlkantarClanX12

Your IP : 3.12.36.45


Current Path : /lib64/python3.8/__pycache__/
Upload File :
Current File : //lib64/python3.8/__pycache__/selectors.cpython-38.opt-2.pyc

U

e5d�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<zt|���}Wn*tttfk
rJtd�|��d�YnX|dkrbtd�|���|S)NzInvalid file object: {!r}rzInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError�	TypeError�
ValueError�format)�fileobj�fd�r�!/usr/lib64/python3.8/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�Sr)�lenr�
_fd_to_key�rrrr�__len__Bsz_SelectorMapping.__len__cCsDz|j�|�}|jj|WStk
r>td�|��d�YnXdS�N�{!r} is not registered)r�_fileobj_lookupr�KeyErrorr)rrrrrr�__getitem__Es
z_SelectorMapping.__getitem__cCst|jj�Sr)�iterrrr rrr�__iter__Lsz_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�
unregistervszBaseSelector.unregistercCs|�|�|�|||�Sr)r1r0r/rrr�modify�s
zBaseSelector.modifycCst�dSrr-)r�timeoutrrr�select�szBaseSelector.selectcCsdSrrr rrr�close�szBaseSelector.closecCsL|��}|dkrtd��z
||WStk
rFtd�|��d�YnXdS)NzSelector is closedr#)�get_map�RuntimeErrorr%r)rr�mappingrrr�get_key�s
zBaseSelector.get_keycCst�dSrr-r rrrr6�szBaseSelector.get_mapcCs|Srrr rrr�	__enter__�szBaseSelector.__enter__cGs|��dSr)r5)r�argsrrr�__exit__�szBaseSelector.__exit__)N)N)N)
r)r*r+rr0r1r2r4r5r9r6r:r<rrrrr,Ps


r,)�	metaclassc@sPeZdZdd�Zdd�Zddd�Zdd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dS)�_BaseSelectorImplcCsi|_t|�|_dSr)rr�_mapr rrrr�sz_BaseSelectorImpl.__init__cCsNz
t|�WStk
rH|j��D]}|j|kr$|jYSq$�YnXdSr)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%�rrrrrBrrrr0�s�z_BaseSelectorImpl.registercCs@z|j�|�|��}Wn$tk
r:td�|��d�YnX|Sr")r�popr$r%rrArrrr1�s
z_BaseSelectorImpl.unregistercCs�z|j|�|�}Wn$tk
r8td�|��d�YnX||jkr^|�|�|�|||�}n"||jkr�|j|d�}||j|j	<|S)Nr#)r)
rr$r%rrr1r0r�_replacerrErrrr2�s


z_BaseSelectorImpl.modifycCs|j��d|_dSr)r�clearr?r rrrr5s
z_BaseSelectorImpl.closecCs|jSr)r?r rrrr6sz_BaseSelectorImpl.get_mapcCs(z|j|WStk
r"YdSXdSr)rr%)rrrrr�_key_from_fds	z_BaseSelectorImpl._key_from_fd)N)N)r)r*r+rr$r0r1r2r5r6rIrrrrr>�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)rKr0rCrM�addrrDrNrErOrrr0*szSelectSelector.registercs,t��|�}|j�|j�|j�|j�|Sr)rKr1rM�discardrrNrArOrrr12szSelectSelector.unregisterZwin32cCs$t�||||�\}}}|||gfSr)r4)r�r�w�_r3�xrrr�_select9szSelectSelector._selectc	Cs�|dkrdnt|d�}g}z|�|j|jg|�\}}}Wntk
rP|YSXt|�}t|�}||BD]J}d}||kr�|tO}||kr�|tO}|�|�}|rj|�	|||j
@f�qj|S�Nr)�maxrWrMrN�InterruptedErrorrLrCrDrI�appendr)	rr3�readyrSrTrUrrrBrrrr4?s$

zSelectSelector.select)N)N)N)r)r*r+rr0r1�sys�platformrWr4�
__classcell__rrrOrrJ"s
rJcsZeZdZdZdZdZ�fdd�Zd�fdd�	Z�fdd�Zd
�fdd	�	Z	dd
d�Z
�ZS)�_PollLikeSelectorNcst���|��|_dSr)rKr�
_selector_clsrr rOrrr[s
z_PollLikeSelector.__init__cslt��|||�}d}|t@r&||jO}|t@r8||jO}z|j�|j|�Wnt��|��YnX|SrX)	rKr0rC�_EVENT_READrD�_EVENT_WRITErrr1)rrrrrBZ
poller_eventsrOrrr0_s

z_PollLikeSelector.registercs8t��|�}z|j�|j�Wntk
r2YnX|Sr)rKr1rr�OSErrorrArOrrr1msz_PollLikeSelector.unregistercs�z|j|�|�}Wn$tk
r8t|�d��d�YnXd}||jkr�d}|t@r^||jO}|t@rp||jO}z|j�	|j
|�Wnt��|��YnXd}||j
kr�d}|r�|j||d�}||j|j
<|S)Nz is not registeredFrT)rr)rr$r%rrCrbrDrcrr2rrKr1rrG)rrrrrBZchangedZselector_eventsrOrrr2ws.



z_PollLikeSelector.modifycCs�|dkrd}n|dkrd}nt�|d�}g}z|j�|�}Wntk
rV|YSX|D]V\}}d}||j@r||tO}||j@r�|tO}|�	|�}|r\|�
|||j@f�q\|S)Nr�@�@)�math�ceilr�pollrZrbrDrcrCrIr[r)rr3r\�
fd_event_listr�eventrrBrrrr4�s(

z_PollLikeSelector.select)N)N)N)r)r*r+rarbrcrr0r1r2r4r_rrrOrr`Us
r`rhc@seZdZejZejZejZ	dS)�PollSelectorN)
r)r*r+r4rhra�POLLINrb�POLLOUTrcrrrrrk�srk�epollcs@eZdZejZejZejZ	dd�Z
ddd�Z�fdd�Z�ZS)	�
EpollSelectorcCs
|j��Sr�rr
r rrrr
�szEpollSelector.filenoNc	Cs�|dkrd}n |dkrd}nt�|d�d}tt|j�d�}g}z|j�||�}Wntk
rl|YSX|D]V\}}d}|tj	@r�|t
O}|tj@r�|tO}|�
|�}|rr|�|||j@f�qr|S)N���rreg����MbP?r)rfrgrYrrrrhrZr4�EPOLLINrD�EPOLLOUTrCrIr[r)	rr3�max_evr\rirrjrrBrrrr4�s*

zEpollSelector.selectcs|j��t���dSr�rr5rKr rOrrr5�s
zEpollSelector.close)N)
r)r*r+r4rnrarrrbrsrcr
r5r_rrrOrro�s
 ro�devpollcs6eZdZejZejZejZ	dd�Z
�fdd�Z�ZS)�DevpollSelectorcCs
|j��Srrpr rrrr
�szDevpollSelector.filenocs|j��t���dSrrur rOrrr5�s
zDevpollSelector.close)
r)r*r+r4rvrarlrbrmrcr
r5r_rrrOrrw�s
rw�kqueuecsTeZdZ�fdd�Zdd�Zd�fdd�	Z�fdd	�Zdd
d�Z�fdd
�Z�Z	S)�KqueueSelectorcst���t��|_dSr)rKrr4rxrr rOrrr�s
zKqueueSelector.__init__cCs
|j��Srrpr rrrr
szKqueueSelector.filenoNcs�t��|||�}z`|t@r@t�|jtjtj�}|j�	|gdd�|t
@rnt�|jtjtj�}|j�	|gdd�Wnt��|��YnX|SrX)
rKr0rCr4�keventr�KQ_FILTER_READZ	KQ_EV_ADDr�controlrD�KQ_FILTER_WRITEr1)rrrrrB�kevrOrrr0s ��zKqueueSelector.registercs�t��|�}|jt@rVt�|jtjtj�}z|j	�
|gdd�Wntk
rTYnX|jt@r�t�|jtj
tj�}z|j	�
|gdd�Wntk
r�YnX|SrX)rKr1rrCr4rzrr{ZKQ_EV_DELETErr|rdrDr})rrrBr~rOrrr1s$
�
�zKqueueSelector.unregisterc
Cs�|dkrdnt|d�}t|j�}g}z|j�d||�}Wntk
rP|YSX|D]Z}|j}|j}d}|tj	kr||t
O}|tjkr�|tO}|�
|�}	|	rV|�|	||	j@f�qV|SrX)rYrrrr|rZZident�filterr4r{rCr}rDrIr[r)
rr3rtr\Zkev_listr~r�flagrrBrrrr4)s&




zKqueueSelector.selectcs|j��t���dSrrur rOrrr5?s
zKqueueSelector.close)N)N)
r)r*r+rr
r0r1r4r5r_rrrOrry�s
ry) �abcrr�collectionsrZcollections.abcrrfr4r]rCrDrr�__doc__�version_inforrrrrr,r>rJr`�hasattrrkrorwry�globalsZDefaultSelectorrrrr�<module>sJ
~T3Z
.M