ok

Mini Shell

Direktori : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/selectors.cpython-35.opt-2.pyc



���]�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�dde�ZGdd�de�ZGdd�de�Zeed�rKGdd�de�Zeed�rpGd d!�d!e�Zeed"�r�Gd#d$�d$e�Zeed%�r�Gd&d'�d'e�Zd'e�kr�eZnNd!e�kr�eZn6d$e�kreZnde�kreZneZdS)+�)�ABCMeta�abstractmethod)�
namedtuple�MappingN�c
Cs�t|t�r|}nLyt|j��}Wn3tttfk
rctdj|��d�YnX|dkr�tdj|���|S)NzInvalid file object: {!r}rzInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError�	TypeError�
ValueError�format)�fileobj�fd�r�./opt/alt/python35/lib64/python3.5/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)�self�selectorrrr�__init__>sz_SelectorMapping.__init__cCst|jj�S)N)�lenr�
_fd_to_key)rrrr�__len__Asz_SelectorMapping.__len__cCsUy$|jj|�}|jj|SWn*tk
rPtdj|��d�YnXdS)Nz{!r} is not registered)r�_fileobj_lookupr�KeyErrorr
)rrrrrr�__getitem__Ds

z_SelectorMapping.__getitem__cCst|jj�S)N)�iterrr)rrrr�__iter__Ksz_SelectorMapping.__iter__N)�__name__�
__module__�__qualname__rrr"r$rrrrr;src@s�eZdZeddd��Zedd��Zddd�Zeddd	��Zd
d�Zdd
�Z	edd��Z
dd�Zdd�ZdS)�BaseSelectorNcCs
t�dS)N)�NotImplementedError)rrrrrrr�register^szBaseSelector.registercCs
t�dS)N)r))rrrrr�
unregisteruszBaseSelector.unregistercCs |j|�|j|||�S)N)r+r*)rrrrrrr�modify�s
zBaseSelector.modifycCs
t�dS)N)r))r�timeoutrrr�select�szBaseSelector.selectcCsdS)Nr)rrrr�close�szBaseSelector.closecCsa|j�}|dkr$td��y||SWn*tk
r\tdj|��d�YnXdS)NzSelector is closedz{!r} is not registered)�get_map�RuntimeErrorr!r
)rr�mappingrrr�get_key�s
zBaseSelector.get_keycCs
t�dS)N)r))rrrrr0�szBaseSelector.get_mapcCs|S)Nr)rrrr�	__enter__�szBaseSelector.__enter__cGs|j�dS)N)r/)r�argsrrr�__exit__�szBaseSelector.__exit__)
r%r&r'rr*r+r,r.r/r3r0r4r6rrrrr(Osr(�	metaclassc@sveZdZdd�Zdd�Zddd�Zdd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dS)�_BaseSelectorImplcCsi|_t|�|_dS)N)rr�_map)rrrrr�s	z_BaseSelectorImpl.__init__cCsZyt|�SWnEtk
rUx-|jj�D]}|j|kr.|jSq.W�YnXdS)N)rrr�valuesrr)rr�keyrrrr �s	
z!_BaseSelectorImpl._fileobj_lookupNcCs�|s|ttB@r+tdj|���t||j|�||�}|j|jkrvtdj||j���||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered)	�
EVENT_READ�EVENT_WRITErr
rr rrr!)rrrrr;rrrr*�s	z_BaseSelectorImpl.registercCsPy|jj|j|��}Wn*tk
rKtdj|��d�YnX|S)Nz{!r} is not registered)r�popr r!r
)rrr;rrrr+�s

z_BaseSelectorImpl.unregistercCs�y|j|j|�}Wn*tk
rFtdj|��d�YnX||jkr{|j|�|j|||�}n1||jkr�|jd|�}||j|j	<|S)Nz{!r} is not registeredr)
rr r!r
rr+r*r�_replacer)rrrrr;rrrr,�s

z_BaseSelectorImpl.modifycCs|jj�d|_dS)N)r�clearr9)rrrrr/s
z_BaseSelectorImpl.closecCs|jS)N)r9)rrrrr0sz_BaseSelectorImpl.get_mapcCs,y|j|SWntk
r'dSYnXdS)N)rr!)rrrrr�_key_from_fds	
z_BaseSelectorImpl._key_from_fd)r%r&r'rr r*r+r,r/r0rArrrrr8�s
r8cs�eZdZ�fdd�Zd�fdd�Z�fdd�Zejdkrfdd	d
�Zn	e	j	Zddd�Z	�S)
�SelectSelectorcs)t�j�t�|_t�|_dS)N)�superr�set�_readers�_writers)r)�	__class__rrr%s
zSelectSelector.__init__NcsVt�j|||�}|t@r5|jj|j�|t@rR|jj|j�|S)N)rCr*r<rE�addrr=rF)rrrrr;)rGrrr**s

zSelectSelector.registercs<t�j|�}|jj|j�|jj|j�|S)N)rCr+rE�discardrrF)rrr;)rGrrr+2szSelectSelector.unregister�win32cCs2tj||||�\}}}|||gfS)N)r.)r�r�w�_r-�xrrr�_select9s!zSelectSelector._selectc	
Cs�|dkrdnt|d�}g}y+|j|j|jg|�\}}}Wntk
rj|SYnXt|�}t|�}xs||BD]g}d}||kr�|tO}||kr�|tO}|j|�}|r�|j	|||j
@f�q�W|S)Nr)�maxrOrErF�InterruptedErrorrDr<r=rA�appendr)	rr-�readyrKrLrMrrr;rrrr.?s$!+
	

zSelectSelector.select)
r%r&r'rr*r+�sys�platformrOr.rr)rGrrB"s	rB�pollcsXeZdZ�fdd�Zd�fdd�Z�fdd�Zddd	�Z�S)
�PollSelectorcs t�j�tj�|_dS)N)rCrr.rV�_poll)r)rGrrrZs
zPollSelector.__init__Ncsft�j|||�}d}|t@r5|tjO}|t@rL|tjO}|jj|j|�|S)Nr)	rCr*r<r.�POLLINr=�POLLOUTrXr)rrrrr;�poll_events)rGrrr*^s



zPollSelector.registercs)t�j|�}|jj|j�|S)N)rCr+rXr)rrr;)rGrrr+hszPollSelector.unregisterc
Cs�|dkrd}n(|dkr*d}ntj|d�}g}y|jj|�}Wntk
rq|SYnXxy|D]q\}}d}|tj@r�|tO}|tj@r�|t	O}|j
|�}|ry|j|||j@f�qyW|S)Nrg@�@)
�math�ceilrXrVrQr.rYr=rZr<rArRr)rr-rS�
fd_event_listr�eventrr;rrrr.ms(		
	

zPollSelector.select)r%r&r'rr*r+r.rr)rGrrWWs
rW�epollcsveZdZ�fdd�Zdd�Zd�fdd�Z�fdd	�Zdd
d�Z�fdd
�Z�S)�
EpollSelectorcs t�j�tj�|_dS)N)rCrr.r`�_epoll)r)rGrrr�s
zEpollSelector.__init__cCs
|jj�S)N)rbr	)rrrrr	�szEpollSelector.filenoNcs�t�j|||�}d}|t@r5|tjO}|t@rL|tjO}y|jj|j|�Wn%t	k
r�t�j
|��YnX|S)Nr)rCr*r<r.�EPOLLINr=�EPOLLOUTrbr�
BaseExceptionr+)rrrrr;�epoll_events)rGrrr*�s




zEpollSelector.registercsBt�j|�}y|jj|j�Wntk
r=YnX|S)N)rCr+rbr�OSError)rrr;)rGrrr+�s
zEpollSelector.unregisterc	
Cs|dkrd}n,|dkr*d}ntj|d�d}tt|j�d�}g}y|jj||�}Wntk
r�|SYnXxy|D]q\}}d}|tj	@r�|t
O}|tj@r�|tO}|j
|�}|r�|j|||j@f�q�W|S)Nrrg@�@g����MbP?���)r\r]rPrrrbrVrQr.rcr=rdr<rArRr)	rr-�max_evrSr^rr_rr;rrrr.�s*		
	

zEpollSelector.selectcs|jj�t�j�dS)N)rbr/rC)r)rGrrr/�s
zEpollSelector.close)	r%r&r'rr	r*r+r.r/rr)rGrra�s
 ra�devpollcsveZdZ�fdd�Zdd�Zd�fdd�Z�fdd	�Zdd
d�Z�fdd
�Z�S)�DevpollSelectorcs t�j�tj�|_dS)N)rCrr.rj�_devpoll)r)rGrrr�s
zDevpollSelector.__init__cCs
|jj�S)N)rlr	)rrrrr	�szDevpollSelector.filenoNcsft�j|||�}d}|t@r5|tjO}|t@rL|tjO}|jj|j|�|S)Nr)	rCr*r<r.rYr=rZrlr)rrrrr;r[)rGrrr*�s



zDevpollSelector.registercs)t�j|�}|jj|j�|S)N)rCr+rlr)rrr;)rGrrr+�szDevpollSelector.unregisterc
Cs�|dkrd}n(|dkr*d}ntj|d�}g}y|jj|�}Wntk
rq|SYnXxy|D]q\}}d}|tj@r�|tO}|tj@r�|t	O}|j
|�}|ry|j|||j@f�qyW|S)Nrg@�@)
r\r]rlrVrQr.rYr=rZr<rArRr)rr-rSr^rr_rr;rrrr.�s(		
	

zDevpollSelector.selectcs|jj�t�j�dS)N)rlr/rC)r)rGrrr/s
zDevpollSelector.close)	r%r&r'rr	r*r+r.r/rr)rGrrk�s
rk�kqueuecsveZdZ�fdd�Zdd�Zd�fdd�Z�fdd	�Zdd
d�Z�fdd
�Z�S)�KqueueSelectorcs t�j�tj�|_dS)N)rCrr.rm�_kqueue)r)rGrrrs
zKqueueSelector.__init__cCs
|jj�S)N)ror	)rrrrr	szKqueueSelector.filenoNcs�t�j|||�}y�|t@r\tj|jtjtj�}|jj	|gdd�|t
@r�tj|jtjtj�}|jj	|gdd�Wn%tk
r�t�j
|��YnX|S)Nr)rCr*r<r.�keventr�KQ_FILTER_READZ	KQ_EV_ADDro�controlr=�KQ_FILTER_WRITErer+)rrrrr;�kev)rGrrr*s


zKqueueSelector.registercs�t�j|�}|jt@rotj|jtjtj�}y|j	j
|gdd�Wntk
rnYnX|jt@r�tj|jtj
tj�}y|j	j
|gdd�Wntk
r�YnX|S)Nr)rCr+rr<r.rprrqZKQ_EV_DELETErorrrgr=rs)rrr;rt)rGrrr+'s 



zKqueueSelector.unregisterc

Cs�|dkrdnt|d�}t|j�}g}y|jjd||�}Wntk
rj|SYnXx�|D]}|j}|j}d}|tj	kr�|t
O}|tjkr�|tO}|j
|�}	|	rr|j|	||	j@f�qrW|S)Nr)rPrrrorrrQ�ident�filterr.rqr<rsr=rArRr)
rr-rirSZkev_listrtr�flagrr;rrrr.<s&!
	
		

zKqueueSelector.selectcs|jj�t�j�dS)N)ror/rC)r)rGrrr/Rs
zKqueueSelector.close)	r%r&r'rr	r*r+r.r/rr)rGrrn
srnr�)rr)�abcrr�collectionsrrr\r.rTr<r=rr�__doc__�version_inforrrrrr(r8rB�hasattrrWrarkrn�globals�DefaultSelectorrrrr�<module>sF	~U31G8M				

Zerion Mini Shell 1.0