Mini Shell
3
{)c�$ � @ s� d Z ddlmZ eddddddd g�Zddd�Zed
dg�Zeddg�Zeddg�Zeddg�Zedddg�Z eddg�Z
G dd� de�ZG dd� de�Z
e
� Zd
S )zV
Module providing classes defining the callbacks used by Blivet and their
arguments.
� )�
namedtuple�_CallbacksRegister�create_format_pre�create_format_post�resize_format_pre�resize_format_post�wait_for_entropy�report_progressNc C s t | |||||�S )a�
A function for creating a new opaque object holding the references to
callbacks. The point of this function is to hide the implementation of such
object and to provide default values for non-specified fields (e.g. newly
added callbacks).
:type create_format_pre: :class:`.CreateFormatPreData` -> NoneType
:type create_format_post: :class:`.CreateFormatPostData` -> NoneType
:type resize_format_pre: :class:`.ResizeFormatPreData` -> NoneType
:type resize_format_post: :class:`.ResizeFormatPostData` -> NoneType
:param wait_for_entropy: callback for waiting for enough entropy whose return
value indicates whether continuing regardless of
available entropy should be forced (True) or not (False)
:type wait_for_entropy: :class:`.WaitForEntropyData` -> bool
:type report_progress: :class:`.ReportProgressData` -> NoneType
)r )r r r r r r � r
�/usr/lib/python3.6/callbacks.py�create_new_callbacks_register* s r �CreateFormatPreData�msg�CreateFormatPostData�ResizeFormatPreData�ResizeFormatPostData�WaitForEntropyDataZmin_entropy�ReportProgressDatac @ s, e Zd Zdd� Zdd� Zdd� Zdd� Zd S )
�CallbackListc C s t � | _d S )N)�list�_cb_list)�selfr
r
r �__init__Y s zCallbackList.__init__c C s | j j|� dS )z Add a callback. N)r �append)r �cbr
r
r �add\ s zCallbackList.addc C s | j j|� dS )z Remove a callback. N)r �remove)r r r
r
r r ` s zCallbackList.removec O s x| j D ]}|||� qW dS )z Run all of the callbacks. N)r )r �args�kwargsr r
r
r �__call__d s zCallbackList.__call__N)�__name__�
__module__�__qualname__r r r r r
r
r
r r X s r c @ s e Zd ZdZdd� ZdS )� Callbacksz�A collection of callbacks for various events
Each trigger/event gets a list of callbacks to run, represented by an
instance of :class:`~.callbacks.CallbackList`.
c C sd t � | _t � | _t � | _t � | _t � | _t � | _t � | _t � | _t � | _ t � | _
t � | _t � | _d S )N)
r Zpopulate_startedZdevice_scannedZdevice_addedZdevice_removedZformat_addedZformat_removedZaction_addedZaction_removedZaction_executedZparent_addedZparent_removedZattribute_changed)r r
r
r r p s zCallbacks.__init__N)r r! r"