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 : |
3 �rkc^A � @ s d Z ddlZddlZddlZddlZddlZddlmZmZm Z m Z mZmZ ed�Z dZdZddd gZeed d�Zes�eed�ZG dd � d e�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�Zdaee d�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�asyncc s` e Zd ZdZej� Zdeee gdf e e e dd�� fdd�Zed�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�returnc s0 t � j||� t| j�| _|| _|| _|| _d S )N)�super�__init__�next� _iden_counter�idenr r r )�selfr r r r r )� __class__� �"/usr/lib64/python3.6/libvirtaio.pyr E s zCallback.__init__)r c C s dj | jj| j�S )Nz<{} iden={}>)�formatr �__name__r )r r r r �__repr__L s zCallback.__repr__c C s( | j jjd| j� | j j| j| j� dS )zSchedule *ff* callbackz"callback %d close(), scheduling ffN)r �log�debugr �schedule_ff_callbackr )r r r r �closeO s zCallback.close)r � __module__�__qualname__�__doc__� itertools�countr r �intr r r �strr r$ � __classcell__r r )r r r : s (r c @ s` e Zd ZdZdedd�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 �fdr c C s || _ || _i | _d S )N)r r. � callbacks)r r r. r r r r _ s zDescriptor.__init__)�eventr c C sF x@t | jj� �D ].}|jdk r|j|@ r|j|j| j||j� qW dS )zDispatch the event to the descriptors :param int event: The event (from libvirt's constants) being dispatched N)�listr/ �valuesr0 r r r. r )r r0 �callbackr r r �_handled s zDescriptor._handle)r c C s� t dd� | jj� D ��r$tjdt� t dd� | jj� D ��rV| jjj| j | j tj� n| jjj | j � t dd� | 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. c s s"