Current File : //snap/core22/2115/usr/share/subiquity/subiquitycore/__pycache__/context.cpython-310.pyc |
o
K��^� � @ sR d dl Z d dlZd dlZd dlZG dd� dej�Zd aG dd� d�Zd dd�ZdS )
� Nc @ s$ e Zd Ze�� Ze�� Ze�� ZdS )�StatusN)�__name__�
__module__�__qualname__�enum�auto�SUCCESS�FAIL�WARN� 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 sH t | _t d7 a || _|| _|| _|| _|| _|d u r|}|| _i | _d S )N� ) �
context_id�id�app�name�description�parent�level�
childlevel�data)�selfr r r r r r r r r �__init__4 s
zContext.__init__c C s | ||j dd d�S )N� �INFO)�project)�clsr r r r �newB s zContext.newr c C s&