- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 3.135.219.165
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 8.2.26
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib64/python3.6/site-packages/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/python3.6/site-packages/__pycache__/libvirtaio.cpython-36.pyc
3

�rkc^A�@sdZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZed�Z
dZdZddd	gZeed
d�Zes�eed�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Zdaeed�dd�Zdejed�dd	�ZdS)z�Libvirt event loop implementation using asyncio

Register the implementation of default loop:

    >>> import libvirtaio
    >>> libvirtaio.virEventRegisterAsyncIOImpl()

.. seealso::
    https://libvirt.org/html/libvirt-libvirt-event.html
�N)�Any�Callable�Dict�	Generator�Optional�TypeVar�_Tz,Wojtek Porczyk <woju@invisiblethingslab.com>z	LGPL-2.1+�getCurrentImpl�virEventAsyncIOImpl�virEventRegisterAsyncIOImpl�
ensure_future�asynccs`eZdZdZej�Zdeee	gdfe	e
e
dd��fdd�Zed�dd	�Z
dd�d
d�Z�ZS)�Callbackz�Base class for holding callback

    :param virEventAsyncIOImpl impl: the implementation in which we run
    :param cb: the callback itself
    :param opaque: the opaque tuple passed by libvirt
    r
N)�impl�cb�opaque�args�kwargs�returncs0t�j||�t|j�|_||_||_||_dS)N)�super�__init__�next�
_iden_counter�idenrrr)�selfrrrrr)�	__class__��"/usr/lib64/python3.6/libvirtaio.pyrEs
zCallback.__init__)rcCsdj|jj|j�S)Nz<{} iden={}>)�formatr�__name__r)rrrr�__repr__LszCallback.__repr__cCs(|jjjd|j�|jj|j|j�dS)zSchedule *ff* callbackz"callback %d close(), scheduling ffN)r�log�debugr�schedule_ff_callbackr)rrrr�closeOszCallback.close)r�
__module__�__qualname__�__doc__�	itertools�countrr�intrrr�strr r$�
__classcell__rr)rrr:s
(rc@s`eZdZdZdedd�dd�Zedd�dd	�Zdd
�dd�Zd
dd�dd�Zedd�dd�Z	dS)�
Descriptorz�Manager of one file descriptor

    :param virEventAsyncIOImpl impl: the implementation in which we run
    :param int fd: the file descriptor
    r
N)r�fdrcCs||_||_i|_dS)N)rr.�	callbacks)rrr.rrrr_szDescriptor.__init__)�eventrcCsFx@t|jj��D].}|jdk	r|j|@r|j|j|j||j�qWdS)zDispatch the event to the descriptors

        :param int event: The event (from libvirt's constants) being dispatched
        N)�listr/�valuesr0rrr.r)rr0�callbackrrr�_handledszDescriptor._handle)rcCs�tdd�|jj�D��r$tjdt�tdd�|jj�D��rV|jjj|j	|j
tj�n|jjj
|j	�tdd�|jj�D��r�|jjj|j	|j
tj�n|jjj|j	�dS)z�Register or unregister callbacks at event loop

        This should be called after change of any ``.event`` in callbacks.
        css"|]}|jtjtjB@VqdS)N)r0�libvirt�VIR_EVENT_HANDLE_READABLE�VIR_EVENT_HANDLE_WRITABLE)�.0r3rrr�	<genexpr>xsz$Descriptor.update.<locals>.<genexpr>zTThe only event supported are VIR_EVENT_HANDLE_READABLE and VIR_EVENT_HANDLE_WRITABLEcss|]}|jtj@VqdS)N)r0r5r6)r8r3rrrr9�scss|]}|jtj@VqdS)N)r0r5r7)r8r3rrrr9�sN)�anyr/r2�warnings�warn�UserWarningr�loopZ
add_readerr.r4r5r6Z
remove_readerZ
add_writerr7Z
remove_writer)rrrr�updatemszDescriptor.update�
FDCallback)r3rcCs||j|j<|j�dS)z�Add a callback to the descriptor

        :param FDCallback callback: the callback to add
        :rtype: None

        After adding the callback, it is immediately watched.
        N)r/rr?)rr3rrr�
add_handle�szDescriptor.add_handle)rrcCs|jj|�}|j�|S)aRemove a callback from the descriptor

        :param int iden: the identifier of the callback
        :returns: the callback
        :rtype: FDCallback

        After removing the callback, the descriptor may be unwatched, if there
        are no more handles for it.
        )r/�popr?)rrr3rrr�
remove_handle�s
zDescriptor.remove_handle)
rr%r&r'r*rr4r?rArCrrrrr-Ys	"r-cs8eZdZdZddd��fdd�Zeed�dd	�Z�ZS)
�DescriptorDictzdDescriptors collection

    This is used internally by virEventAsyncIOImpl to hold descriptors.
    r
N)rrcst�j�||_dS)N)rrr)rr)rrrr�s
zDescriptorDict.__init__)r.rcCst|j|�}|||<|S)N)r-r)rr.�
descriptorrrr�__missing__�szDescriptorDict.__missing__)	rr%r&r'rr*r-rFr,rr)rrrD�srDcsLeZdZdZeeeedd��fdd�Zed�dd�Z	edd	�d
d�Z
�ZS)r@z�Callback for file descriptor (watcher)

    :param Descriptor descriptor: the descriptor manager
    :param int event: bitset of events on which to fire the callback
    N)rrEr0rrcst�j||�||_||_dS)N)rrrEr0)rrEr0rr)rrrr�szFDCallback.__init__)rcCsdj|jj|j|jj|j�S)Nz<{} iden={} fd={} event={}>)rrrrrEr.r0)rrrrr �szFDCallback.__repr__)r0rcCs||_|jj�dS)z1Update the callback and fix descriptor's watchersN)r0rEr?)rr0rrrr?�szFDCallback.update)rr%r&r'rr-r*rr+r r?r,rr)rrr@�sr@csxeZdZdZeedd��fdd�Zed�dd�Zej	e
eddfd�d	d
��Zedd�dd
�Z
dd��fdd�Z�ZS)�TimeoutCallbackzCallback for timerN)rrrcst�j||�d|_d|_dS)N����)rr�timeout�_task)rrr)rrrr�szTimeoutCallback.__init__)rcCsdj|jj|j|j�S)Nz<{} iden={} timeout={}>)rrrrrJ)rrrrr �szTimeoutCallback.__repr__ccs�x�y@|jdkr:|jd}|jjjd|�tj|�EdHndVWn*tjk
rl|jjjd|j�PYnX|j|j|j	�|jjjd|j�qWdS)zQAn actual timer running on the event loop.

        This is a coroutine.
        rg����MbP?zsleeping %rNztimer %d cancelledztimer %r callback ended)
rJrr!r"�asyncioZsleepZCancelledErrorrrr)rrJrrr�_timer�s


zTimeoutCallback._timer)rJrcCs~||_|jdkrD|jdkrD|jjjd|j�t|j�|jjd�|_n6|jdkrz|jdk	rz|jjjd|j�|jj	�d|_dS)z-Start or the timer, possibly updating timeoutrNztimer %r start)r>z
timer %r stop)
rJrKrr!r"rrrMr>Zcancel)rrJrrrr?�s
zTimeoutCallback.updatecs|jdd�tt|�j�dS)z#Stop the timer and call ff callbackrH)rJNrI)r?rrGr$)r)rrrr$szTimeoutCallback.close)rr%r&r'rrr+r rL�	coroutinerrMr*r?r$r,rr)rrrG�srGc@s$eZdZdZd*ejdd�dd�Zed�dd�Zdd�d	d
�Z	dd�dd�Z
dd�d
d�Zee
dd�dd�Zejee
dd�dd��Zejeeddfd�dd��Zed�dd�Zeeeje
ed�dd�Zeedd�dd�Zeed�dd �Zeeje
ed!�d"d#�Zeedd$�d%d&�Zeed'�d(d)�ZdS)+r
z�Libvirt event adapter to asyncio.

    :param loop: asyncio's event loop

    If *loop* is not specified, the current (or default) event loop is used.
    N)r>rcCsP|p
tj�|_i|_t|�|_tj|jj	�|_
d|_tj|d�|_
|j
j�dS)Nr)r>)rLZget_event_loopr>r/rD�descriptors�loggingZ	getLoggerrrr!�_pendingZEvent�	_finished�set)rr>rrrrs
zvirEventAsyncIOImpl.__init__)rcCsdjt|�j|j|j�S)Nz <{} callbacks={} descriptors={}>)r�typerr/rO)rrrrr  szvirEventAsyncIOImpl.__repr__cCs|jd7_|jj�dS)z;Increase the count of pending affairs. Do not use directly.rHN)rQrR�clear)rrrr�_pending_inc$sz virEventAsyncIOImpl._pending_inccCs4|jdkst�|jd8_|jdkr0|jj�dS)z;Decrease the count of pending affairs. Do not use directly.rrHN)rQ�AssertionErrorrRrS)rrrr�_pending_dec)s
z virEventAsyncIOImpl._pending_deccCs0|jjd�tj|j|j|j|j|j|j	�|S)z3Register this instance as event loop implementationz
register())
r!r"r5ZvirEventRegisterImpl�_add_handle�_update_handle�_remove_handle�_add_timeout�_update_timeout�_remove_timeout)rrrr�register0s
zvirEventAsyncIOImpl.register)rrrcCst|j||�|jd�dS)z8Schedule a ff callback from one of the handles or timers)r>N)r�_ff_callbackr>)rrrrrrr#9sz(virEventAsyncIOImpl.schedule_ff_callbackcCs$|jjd|�tj|�|j�dS)zFDirectly free the opaque object

        This is a coroutine.
        z ff_callback(iden=%d, opaque=...)N)r!r"r5ZvirEventInvokeFreeCallbackrX)rrrrrrr`=s
z virEventAsyncIOImpl._ff_callbackccs2|jjd�|jr"|jj�EdH|jjd�dS)zRWait for the implementation to become idle.

        This is a coroutine.
        zdrain()Nzdrain ended)r!r"rQrR�wait)rrrr�drainGszvirEventAsyncIOImpl.draincCs|jo|jS)z�Returns False if there are leftovers from a connection

        Those may happen if there are sematical problems while closing
        a connection. For example, not deregistered events before .close().
        )r/rQ)rrrr�is_idleRszvirEventAsyncIOImpl.is_idle)r.r0rrrcCsft||||j||d�}|j|jks(t�|jjd|||j�||j|j<|j|j|�|j�|jS)aRegister a callback for monitoring file handle events

        :param int fd: file descriptor to listen on
        :param int event: bitset of events on which to fire the callback
        :param cb: the callback to be called when an event occurrs
        :param opaque: user data to pass to the callback
        :rtype: int
        :returns: handle watch number to be used for updating and unregistering for events

        .. seealso::
            https://libvirt.org/html/libvirt-libvirt-event.html#virEventAddHandleFuncFunc
        )rEr0z4add_handle(fd=%d, event=%d, cb=..., opaque=...) = %d)	r@rOrr/rWr!r"rArV)rr.r0rrr3rrrrYZs
zvirEventAsyncIOImpl._add_handle)�watchr0rcCs8|jjd||�|j|}t|t�s(t�|j|d�dS)aChange event set for a monitored file handle

        :param int watch: file descriptor watch to modify
        :param int event: new events to listen on

        .. seealso::
            https://libvirt.org/html/libvirt-libvirt-event.html#virEventUpdateHandleFunc
        z!update_handle(watch=%d, event=%d))r0N)r!r"r/�
isinstancer@rWr?)rrdr0r3rrrrZrs	
z"virEventAsyncIOImpl._update_handle)rdrcCs�|jjd|�y|jj|�}Wn4tk
rR}z|jjd|jd�dSd}~XnXt|t�sbt	�|j
j}||j|j
|�ks�t	�t|j|j�dkr�|j|=|j�dS)aUnregister a callback from a file handle.

        :param int watch: file descriptor watch to stop listening on
        :returns: -1 on error, 0 on success

        .. seealso::
            https://libvirt.org/html/libvirt-libvirt-event.html#virEventRemoveHandleFunc
        zremove_handle(watch=%d)z#remove_handle(): no such handle: %rrrHNrI)r!r"r/rB�KeyError�warningrrer@rWrEr.rOrC�lenr$)rrdr3�errr.rrrr[�s	z"virEventAsyncIOImpl._remove_handle)rJrrrcCsTt|||�}|j|jkst�|jjd||j�||j|j<|j|d�|j�|jS)a}Register a callback for a timer event

        :param int timeout: the timeout to monitor
        :param cb: the callback to call when timeout has expired
        :param opaque: user data to pass to the callback
        :rtype: int
        :returns: a timer value

        .. seealso::
            https://libvirt.org/html/libvirt-libvirt-event.html#virEventAddTimeoutFunc
        z0add_timeout(timeout=%d, cb=..., opaque=...) = %d)rJ)rGrr/rWr!r"r?rV)rrJrrr3rrrr\�s
z virEventAsyncIOImpl._add_timeout)�timerrJrcCs8|jjd||�|j|}t|t�s(t�|j|d�dS)z�Change frequency for a timer

        :param int timer: the timer to modify
        :param int timeout: the new timeout value in ms

        .. seealso::
            https://libvirt.org/html/libvirt-libvirt-event.html#virEventUpdateTimeoutFunc
        z$update_timeout(timer=%d, timeout=%d))rJN)r!r"r/rerGrWr?)rrjrJr3rrrr]�s	
z#virEventAsyncIOImpl._update_timeout)rjrcCs`|jjd|�y|jj|�}Wn4tk
rR}z|jjd|jd�dSd}~XnX|j�dS)z�Unregister a callback for a timer

        :param int timer: the timer to remove
        :returns: -1 on error, 0 on success

        .. seealso::
            https://libvirt.org/html/libvirt-libvirt-event.html#virEventRemoveTimeoutFunc
        zremove_timeout(timer=%d)z%remove_timeout(): no such timeout: %rrrHNrI)r!r"r/rBrfrgrr$)rrjr3rirrrr^�s	z#virEventAsyncIOImpl._remove_timeout)N)rr%r&r'rL�AbstractEventLooprr+r rVrXr_r*rr#rNr`rrrb�boolrcr5Z_EventCBrYrZr[Z_TimerCBr\r]r^rrrrr

s$		
)rcCstS)z@Return the current implementation, or None if not yet registered)�
_current_implrrrrr	�s)r>rcCst|d�j�atS)z�Arrange for libvirt's callbacks to be dispatched via asyncio event loop

    The implementation object is returned, but in normal usage it can safely be
    discarded.
    )r>)r
r_rm)r>rrrr�s)N)r'rLr(rPr;r5Ztypingrrrrrrr�
__author__Z__license__�__all__�getattrr�objectrr-�dictrDr@rGr
rmr	rkrrrrr�<module>s2 
P:B

Youez - 2016 - github.com/yon3zu
LinuXploit