%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core22/current/usr/share/subiquity/subiquitycore/__pycache__/
Upload File :
Create Path :
Current File : //snap/core22/current/usr/share/subiquity/subiquitycore/__pycache__/context.cpython-310.pyc

o

K��^��@sRddlZddlZddlZddlZGdd�dej�ZdaGdd�d�Zd	dd�ZdS)
�Nc@s$eZdZe��Ze��Ze��ZdS)�StatusN)�__name__�
__module__�__qualname__�enum�auto�SUCCESS�FAIL�WARN�rr�-/usr/share/subiquity/subiquitycore/context.pyrsrc@steZdZdZddd�Zedd��Zddd	�Zd
d�Zddd
�Z	de
jfdd�Zdd�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)
    NcCsHt|_td7a||_||_||_||_||_|dur|}||_i|_dS)N�)	�
context_id�id�app�name�description�parent�level�
childlevel�data)�selfrrrrrrrrr�__init__4s
zContext.__init__cCs|||jddd�S)N��INFO)�project)�clsrrrr�newBszContext.newrcCs&|dur|j}t|�|j|||||�S�N)r�typer)rrrrrrrr�childFsz
Context.childcCs8|}g}|dur|�|j�|j}|dusd�t|��S)N�/)�appendrr�join�reversed)r�c�namesrrr�	full_nameKs�zContext.full_namecCs |dur|j}|j�||�dSr)rr�report_start_event)rrrrr�enterSsz
Context.entercCs"|dur|j}|j�|||�dSr)rr�report_finish_event)rr�resultrrr�exitXszContext.exitcCs|��|Sr)r*)rrrr�	__enter__]szContext.__enter__cCsD|durtj}t|tj�rd}n
t|�}ntj}d}|�||�dS)N�	cancelled)rr	�
isinstance�asyncio�CancelledError�strrr-)r�exc�value�tbr,rrrr�__exit__as
zContext.__exit__cCs||j|<dSr)r)r�keyr5rrr�setmszContext.setcCs2|}|dur||jvr|j|S|j}|dus|Sr)rr)rr8�defaultr&rrr�getps

�zContext.getr)rNN)rrr�__doc__r�classmethodrr!r(r*rrr-r.r7r9r;rrrrr
s



r
rcs���fdd�}|S)Ncs`�dur�j����fdd��t�����fdd��}t�����fdd��}t���r.|S|S)NcsR|�d�}|dur|j}|jd�jdi|���jdd|i|��d����|d<|S)N�contextr)rrr)r;r>r!�format)r�kwr>��
context_kwrrrr�convargss
�
�z0with_context.<locals>.decorate.<locals>.convargscsF�||�}|d��|fi|��Wd�S1swYdS�Nr>r�rr@�rC�methrr�decorated_sync�s

$�z6with_context.<locals>.decorate.<locals>.decorated_syncc�sN��||�}|d��|fi|��IdHWd�S1s wYdSrDrrErFrr�decorated_async�s
�

$�z7with_context.<locals>.decorate.<locals>.decorated_async)r�	functools�wraps�inspect�iscoroutinefunction)rGrHrIrArFr�decoratezs

zwith_context.<locals>.decorater)rrrBrNrrAr�with_contextysrO)Nr)	r1rrJrL�Enumrrr
rOrrrr�<module>s[

Zerion Mini Shell 1.0