Anons79 Mini Shell

Directory : /proc/self/root/lib/python2.7/site-packages/ansible/module_utils/compat/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyo

�
�Udac@sddlZddlZddlZddlZddlZddlZddlmZddlm	Z	y
ej
Z
Wn eefk
r�ejZ
nXdZ
dZdZdZdd	d
ddgZd-Zd.ZeZe�Zd
efd��YZd�Zejd/krd�Zn	d�Zedddddg�Zde	fd��YZdefd��YZe ed�r�defd��YZ!ej"d�ne ed �r�d!efd"��YZ#ej"d!�ne ed#�r	d$efd%��YZ$ej"d$�ne ed&�r>d'efd(��YZ%ej"d'�ne ed)�rsd*efd+��YZ&ej"d*�nd*e'�kr�e&Z(nud'e'�kr�e%Z(n]d$e'�kr�e$Z(nEd!e'�kr�e#Z(n-de'�kr�e!Z(nd,�Z)e)Z(e*ZdS(0i����N(t
namedtuple(tMappingsSeth Michael Larsons [email protected]1.1.1tMITt
EVENT_READtEVENT_WRITEt
SelectorErrortSelectorKeytDefaultSelectoriicBs#eZd�Zd�Zd�ZRS(cCs tt|�j�||_dS(N(tsuperRt__init__terrno(tselfterrcode((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR	8scCsdj|j�S(Ns<SelectorError errno={0}>(tformatR
(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt__repr__<scCs
|j�S(N(R(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt__str__?s(t__name__t
__module__R	RR(((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR7s		cCs�t|t�r|}nHyt|j��}Wn/tttfk
r_tdj|���nX|dkr�tdj|���n|S(sl Return a file descriptor from a file object. If
    given an integer will simply return that integer back. sInvalid file object: {0!r}isInvalid file descriptor: {0}(t
isinstancetinttfilenotAttributeErrort	TypeErrort
ValueErrorR
(tfileobjtfd((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt_fileobj_to_fdCs	iicOs�y|||�SWnktttjfk
r~}d}t|d�rP|j}nt|d�ro|jd}nt|��nXdS(sy This is the short-circuit version of the below logic
        because in Python 3.5+ all selectors restart system calls. R
targsiN(	tOSErrortIOErrortselectterrortNonethasattrR
RR(tfunct_RtkwargsteR((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt_syscall_wrapperTscOs�|jdd�}|dkr-d}t}n.t|�}|dkrNd}n
t�|}t|�}|r�d|kr�td��nt}x2|tkr�y|||�}Wq�tt	t
jfk
r�}d}t|d�r�|j
}nt|d�r|jd}n|t
jkp8tt
d�o8|t
jk}	|	r�|dk	r�t�}
|
|krttt
j��n|r�d|kr�||
|d<q�q�q�q�n|r�t|��q��q�Xq�W|S(	s� Wrapper function for syscalls that could fail due to EINTR.
        All functions should be retried if there is time left in the timeout
        in accordance with PEP 475. ttimeoutgs4Timeout must be in args or kwargs to be recalculatedR
RitWSAEINTRN(tgetR tFalsetfloatt	monotonictlistRt_SYSCALL_SENTINELRRRRR!R
RtEINTRR(t	ETIMEDOUTR(R"trecalc_timeoutRR$R'texpirestresultR%Rtis_interrupttcurrent_time((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR&asJ		
	RRteventstdatat_SelectorMappingcBs2eZdZd�Zd�Zd�Zd�ZRS(s* Mapping of file objects to selector keys cCs
||_dS(N(t	_selector(Rtselector((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR	�scCst|jj�S(N(tlenR9t
_fd_to_key(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt__len__�scCsQy$|jj|�}|jj|SWn&tk
rLtdj|���nXdS(Ns{0!r} is not registered.(R9t_fileobj_lookupR<tKeyErrorR
(RRR((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt__getitem__�s

cCst|jj�S(N(titerR9R<(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt__iter__�s(RRt__doc__R	R=R@RB(((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR8�s
			tBaseSelectorcBs�eZdZd�Zd�Zd
d�Zd�Zd
d�Zd
d�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�ZRS(s/ Abstract Selector class

    A selector supports registering file objects to be monitored
    for specific I/O events.

    A file object is a file descriptor or any object with a
    `fileno()` method. An arbitrary object can be attached to the
    file object which can be used for example to store context info,
    a callback, etc.

    A selector can use various implementations (select(), poll(), epoll(),
    and kqueue()) depending on the platform. The 'DefaultSelector' class uses
    the most efficient implementation for the current platform.
    cCsi|_t|�|_dS(N(R<R8t_map(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR	�s	cCsYyt|�SWnDtk
rTx-|jj�D]}|j|kr.|jSq.W�nXdS(sa Return a file descriptor from a file object.
        This wraps _fileobj_to_fd() to do an exhaustive
        search in case the object is invalid but we still
        have it in our map. Used by unregister() so we can
        unregister an object that was previously registered
        even if it is closed. It is also used by _SelectorMapping
        N(RRR<tvaluesRR(RRtkey((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR>�s
cCs�|s|ttB@r.tdj|���nt||j|�||�}|j|jkr|tdj||j���n||j|j<|S(s8 Register a file object for a set of events to monitor. sInvalid events: {0!r}s${0!r} (FD {1}) is already registered(	RRRR
RR>RR<R?(RRR6R7RG((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pytregister�s	cCs�y|jj|j|��}Wn�tk
rGtdj|���n�tjk
r�}|jtjkrq�q�xV|jj	�D],}|j
|kr�|jj|j�Pq�q�Wtdj|���nX|S(s0 Unregister a file object from being monitored. s{0!r} is not registered(R<tpopR>R?R
tsocketRR
tEBADFRFRR(RRRGterr((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt
unregister�s
cCs�y|j|j|�}Wn&tk
rBtdj|���nX||jkrw|j|�|j|||�}n4||jkr�|jd|�}||j|j	<n|S(s< Change a registered file object monitored events and data. s{0!r} is not registeredR7(
R<R>R?R
R6RMRHR7t_replaceR(RRR6R7RG((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pytmodify�s

cCs
t��dS(sj Perform the actual selection until some monitored file objects
        are ready or the timeout expires. N(tNotImplementedError(RR'((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRscCs|jj�d|_dS(sd Close the selector. This must be called to ensure that all
        underlying resources are freed. N(R<tclearR RE(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pytcloses
cCs`|j�}|dkr'td��ny||SWn&tk
r[tdj|���nXdS(s: Return the key associated with a registered file object. sSelector is closeds{0!r} is not registeredN(tget_mapR tRuntimeErrorR?R
(RRtmapping((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pytget_keys
cCs|jS(s3 Return a mapping of file objects to selector keys (RE(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRS$scCs(y|j|SWntk
r#dSXdS(s_ Return the key associated to a given file descriptor
         Return None if it is not found. N(R<R?R (RR((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt_key_from_fd(s
cCs|S(N((R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt	__enter__0scGs|j�dS(N(RR(RR((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt__exit__3sN(RRRCR	R>R RHRMRORRRRVRSRWRXRY(((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRD�s					
			RtSelectSelectorcBsDeZdZd�Zdd�Zd�Zdd�Zdd�ZRS(s Select-based selector. cCs/tt|�j�t�|_t�|_dS(N(RRZR	tsett_readerst_writers(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR	;scCsbtt|�j|||�}|t@r>|jj|j�n|t@r^|jj|j�n|S(N(	RRZRHRR\taddRRR](RRR6R7RG((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRH@s

cCsBtt|�j|�}|jj|j�|jj|j�|S(N(RRZRMR\tdiscardRR](RRRG((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRMHscCstj||g|�S(s? Wrapper for select.select because timeout is a positional arg (R(RtrtwR'((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt_selectNsc	Cst|j�r$t|j�r$gS|dkr6dnt|d�}g}t|jt|j|jd|�\}}}t|�}t|�}x|||BD]p}d}||kr�|t	O}n||kr�|t
O}n|j|�}|r�|j|||j
@f�q�q�W|S(NgR'i(R;R\R]R tmaxR&RbtTrueR[RRRWtappendR6(	RR'treadyR`RaR#RR6RG((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRRs$ !

!N(	RRRCR	R RHRMRbR(((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRZ9s		tpolltPollSelectorcBsDeZdZd�Zdd�Zd�Zdd�Zdd�ZRS(s Poll-based selector cCs&tt|�j�tj�|_dS(N(RRhR	RRgt_poll(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR	oscCsrtt|�j|||�}d}|t@r>|tjO}n|t@rX|tjO}n|jj|j	|�|S(Ni(
RRhRHRRtPOLLINRtPOLLOUTRiR(RRR6R7RGt
event_mask((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRHss

cCs/tt|�j|�}|jj|j�|S(N(RRhRMRiR(RRRG((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRM}scCsM|dk	r7|dkr!d}q7tj|d�}n|jj|�}|S(sj Wrapper function for select.poll.poll() so that
            _syscall_wrapper can work with only seconds. ig@�@N(R tmathtceilRiRg(RR'R3((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt
_wrap_poll�s	cCs�g}t|jtd|�}x�|D]z\}}d}|tj@rR|tO}n|tj@rm|tO}n|j|�}|r%|j	|||j
@f�q%q%W|S(NR'i(R&RoRdRRjRRkRRWReR6(RR'Rft	fd_eventsRRlR6RG((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR�s

!N(	RRRCR	R RHRMRoR(((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRhms	
	tepollt
EpollSelectorcBsJeZdZd�Zd�Zdd�Zd�Zdd�Zd�Z	RS(s Epoll-based selector cCs&tt|�j�tj�|_dS(N(RRrR	RRqt_epoll(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR	�scCs
|jj�S(N(RsR(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR�scCsxtt|�j|||�}d}|t@r>|tjO}n|t@rX|tjO}nt|j	jt
|j|�|S(Ni(RRrRHRRtEPOLLINRtEPOLLOUTR&RsR*R(RRR6R7RGtevents_mask((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRH�s

cCsMtt|�j|�}yt|jjt|j�Wntk
rHnX|S(N(RRrRMR&RsR*RR(RRRG((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRM�s
c	Cs|dk	rG|dkr!d}ntj|d�d}t|�}nd}tt|j�d�}g}t|jj	t
d|d|�}x�|D]z\}}d}|tj@r�|t
O}n|tj@r�|tO}n|j|�}|r�|j|||j@f�q�q�W|S(	Nigg@�@g����MbP?g�iR't	maxevents(R RmRnR+RcR;R<R&RsRgRdRRtRRuRRWReR6(	RR't
max_eventsRfRpRRlR6RG((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR�s*		

!cCs$|jj�tt|�j�dS(N(RsRRRRr(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRR�s
N(
RRRCR	RR RHRMRRR(((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRr�s		
		!tdevpolltDevpollSelectorcBsVeZdZd�Zd�Zdd�Zd�Zdd�Zdd�Z	d�Z
RS(	sSolaris /dev/poll selector.cCs&tt|�j�tj�|_dS(N(RRzR	RRyt_devpoll(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR	�scCs
|jj�S(N(R{R(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR�scCsrtt|�j|||�}d}|t@r>|tjO}n|t@rX|tjO}n|jj|j	|�|S(Ni(
RRzRHRRRjRRkR{R(RRR6R7RGtpoll_events((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRH�s

cCs/tt|�j|�}|jj|j�|S(N(RRzRMR{R(RRRG((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRM�scCsM|dk	r7|dkr!d}q7tj|d�}n|jj|�}|S(sj Wrapper function for select.poll.poll() so that
            _syscall_wrapper can work with only seconds. ig@�@N(R RmRnR{Rg(RR'R3((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRos	cCs�g}t|jtd|�}x�|D]z\}}d}|tj@rR|tO}n|tj@rm|tO}n|j|�}|r%|j	|||j
@f�q%q%W|S(NR'i(R&RoRdRRjRRkRRWReR6(RR'RfRpRRlR6RG((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRs

!cCs$|jj�tt|�j�dS(N(R{RRRRz(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRRs
N(RRRCR	RR RHRMRoRRR(((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRz�s		
	tkqueuetKqueueSelectorcBsSeZdZd�Zd�Zdd�Zd�Zdd�Zd�Z	d�Z
RS(	s  Kqueue / Kevent-based selector cCs&tt|�j�tj�|_dS(N(RR~R	RR}t_kqueue(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR	)scCs
|jj�S(N(RR(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR-scCs�tt|�j|||�}|t@retj|jtjtj�}t	|j
t|gdd�n|t@r�tj|jtj
tj�}t	|j
t|gdd�n|S(Ni(RR~RHRRtkeventRtKQ_FILTER_READt	KQ_EV_ADDR&t
_wrap_controlR*RtKQ_FILTER_WRITE(RRR6R7RGR�((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRH0s

cCs�tt|�j|�}|jt@rztj|jtjtj	�}y t
|jt|gdd�Wqzt
k
rvqzXn|jt@r�tj|jtjtj	�}y t
|jt|gdd�Wq�t
k
r�q�Xn|S(Ni(RR~RMR6RRR�RR�tKQ_EV_DELETER&R�R*RRR�(RRRGR�((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRMBs$
 

 
cCs9|dk	rt|d�}nt|j�d}i}t|jtd|d|�}x�|D]�}|j}|j}d}|t	j
kr�|tO}n|t	jkr�|t
O}n|j|�}	|	r\|	j|kr�|	||	j@f||	j<q%||	jd}
|	||
B|	j@f||	j<q\q\Wt|j��S(NiiR'i(R RcR;R<R&R�RdtidenttfilterRR�RR�RRWRR6R-RF(RR'Rxt	ready_fdstkevent_listR�RRlR6RGt
old_events((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRWs*
		

%cCs$|jj�tt|�j�dS(N(RRRRR~(R((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyRRts
cCs|jj|||�S(N(Rtcontrol(Rt
changelistRxR'((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR�xsN(RRRCR	RR RHRMRRRR�(((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyR~'s				cCstd��dS(Ns!Platform does not have a selector(R(R#((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pytno_selector�sii(ii(+R
RmRRJtsysttimetcollectionsRt/ansible.module_utils.common._collections_compatRR,RtImportErrort
__author__t	__email__t__version__t__license__t__all__RRRdt
HAS_SELECTtobjectR.t	ExceptionRRtversion_infoR&RR8RDR!RZReRhRrRzR~tglobalsRR�R*(((sK/usr/lib/python2.7/site-packages/ansible/module_utils/compat/_selectors2.pyt<module>sx

			
	8�03A;T						

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]