U
K��^> � @ sN d dl Z d dlZd dlZd dlZG dd� dej�ZG dd� d�Zd dd�ZdS )
� Nc @ s$ e Zd Ze�� Ze�� Ze�� ZdS )�StatusN)�__name__�
__module__�__qualname__�enum�auto�SUCCESS�FAILZWARN� r
r
�-/usr/share/subiquity/subiquitycore/context.pyr s r c @ st e Zd ZdZddd�Zedd� �Zddd �Zd
d� Zddd
�Z de
jfdd�Zdd� Z
dd� Zdd� Zddd�ZdS )�Contexta� Class to report when things start and finish.
The expected way to use this is something like:
with somecontext.child("operation"):
await long_running_operation()
but you can also call .enter() and .exit() if use as a context
manager isn't possible.
start and finish events are reported via the report_start_event and
report_finish_event methods on app.
You can override the message shown on exit by passing it to the .exit
method or by assigning to description:
with somecontext.child("operation") as context:
result = await long_running_operation()
context.description = "result was {}".format(result)
Nc C s: || _ || _|| _|| _|| _|d kr*|}|| _i | _d S �N)�app�name�description�parent�level�
childlevel�data)�selfr r r r r r r
r
r �__init__1 s zContext.__init__c C s | ||j dd d�S )N� �INFO)Zproject)�clsr r
r
r �new< |