3 \�me�# � @ s� d Z ddlZddlZddlZddlmZ ddlmZm Z ddl mZ dZdZ dZG d d � d e�Zed�ZG dd� d�ZG dd� de�Zddd�Zejdfdd�Zdd� ZG dd� d�Zdd� ZdS )z� events for reporting. The events here are designed to be used with reporting. They can be published to registered handlers with report_event. � N)�List)�available_handlers�instantiated_handler_registry)�ReportingHandlerZfinish�startZ cloudinitc @ s e Zd Zdd� ZdS )�_namesetc C s || kr|S t d| ��d S )Nz%s not a valid value)�AttributeError)�self�name� r �/usr/lib/python3.6/events.py�__getattr__ s z_nameset.__getattr__N)�__name__� __module__�__qualname__r r r r r r s r �SUCCESS�WARN�FAILc @ s. e Zd ZdZedfdd�Zdd� Zdd� ZdS ) �ReportingEventz"Encapsulation of event formatting.Nc C s2 || _ || _|| _|| _|d kr(tj� }|| _d S )N)� event_typer �description�origin�time� timestamp)r r r r r r r r r �__init__) s zReportingEvent.__init__c C s dj | j| j| j�S )z"The event represented as a string.z {0}: {1}: {2})�formatr r r )r r r r � as_string9 s zReportingEvent.as_stringc C s | j | j| j| j| jd�S )z&The event represented as a dictionary.)r r r r r )r r r r r )r r r r �as_dict? s zReportingEvent.as_dict)r r r �__doc__�DEFAULT_EVENT_ORIGINr r r r r r r r &