HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3/dist-packages/breezy/__pycache__/progress.cpython-39.pyc
a

�*�^}!�@sndZddlmZddlZddlZdd�ZGdd�de�ZGdd	�d	e�Zd
d�Z	ddd�Z
Gdd�de�ZdS)z�Progress indicators.

The usual way to use this is via breezy.ui.ui_factory.nested_progress_bar which
will manage a conceptual stack of nested activities.
�)�absolute_importNcCs:t|dd�}|durdS|�s"dStj�d�dkr6dSdS)z�Detect if we can use pretty progress bars on file F.

    If this returns true we expect that a human may be looking at that
    output, and that we can repaint a line to update it.

    This doesn't check the policy for whether we *should* use them.
    �isattyNFZTERMZdumbT)�getattr�os�environ�get)�fr�r	�1/usr/lib/python3/dist-packages/breezy/progress.py�_supports_progresssrc@sfeZdZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Z	ddd�Z
dd�Zdd�Zdd�Z
dS)�ProgressTaskaqModel component of a progress indicator.

    Most code that needs to indicate progress should update one of these,
    and it will in turn update the display, if one is present.

    Code updating the task may also set fields as hints about how to display
    it: show_pct, show_spinner, show_eta, show_count, show_bar.  UIs
    will not necessarily respect all these fields.

    The message given when updating a task must be unicode, not bytes.

    :ivar update_latency: The interval (in seconds) at which the PB should be
        updated.  Setting this to zero suggests every update should be shown
        synchronously.

    :ivar show_transport_activity: If true (default), transport activity
        will be shown when this task is drawn.  Disable it if you're sure
        that only irrelevant or uninteresting transport activity can occur
        during this task.
    NcCsX||_d|_d|_d|_d|_||_||_d|_d|_d|_	d|_
d|_d|_d|_
dS)a�Construct a new progress task.

        :param parent_task: Enclosing ProgressTask or None.

        :param progress_view: ProgressView to display this ProgressTask.

        :param ui_factory: The UI factory that will display updates;
            deprecated in favor of passing progress_view directly.

        Normally you should not call this directly but rather through
        `ui_factory.nested_progress_bar`.
        rN�FT)Fg�������?)�_parent_taskZ_last_update�	total_cnt�current_cnt�msg�
ui_factory�
progress_viewZshow_pctZshow_spinnerZshow_etaZ
show_countZshow_barZupdate_latencyZshow_transport_activity)�selfZparent_taskrrr	r	r
�__init__Js
zProgressTask.__init__cCsd|jj|j|j|jfS)Nz%s(%r/%r, msg=%r))�	__class__�__name__rrr�rr	r	r
�__repr__gs�zProgressTask.__repr__cCs:||_||_|r||_|jr*|j�|�n|j�|�dS)z�Report updated task message and if relevent progress counters

        The message given must be unicode, not a byte string.
        N)rrrrZ
show_progressrZ_progress_updated)rrrrr	r	r
�updatenszProgressTask.updatecCs|�|j�dS�N)rrrr	r	r
�tick|szProgressTask.tickcCs$|jr|j�|�n|j�|�dSr)rZ
task_finishedrZ_progress_finishedrr	r	r
�finishedszProgressTask.finishedcCst||j|jd�S)N)rr)rrrrr	r	r
�
make_sub_task�s�zProgressTask.make_sub_task�cCsT|jdur&|jr&t|j�||j}n|}|jdur8|S|durDd}|j�|�SdS)zqReturn fractional completion of this task and its parents

        Returns None if no completion can be computed.Nr)rr�floatr�_overall_completion_fraction)rZchild_fractionZown_fractionr	r	r
r!�s��
z)ProgressTask._overall_completion_fractioncCs |jr|j��n
|j��dSr)r�clearrZ
clear_termrr	r	r
r"�szProgressTask.clearcCs|Srr	rr	r	r
�	__enter__�szProgressTask.__enter__cCs|��dS)NF)r)r�exc_typeZexc_valZexc_tbr	r	r
�__exit__�szProgressTask.__exit__)NNN)NN)r)r�
__module__�__qualname__�__doc__rrrrrrr!r"r#r%r	r	r	r
r4s



rc@s:eZdZdZdd�Zd
dd�Zdd�Zd	d
�Zdd�ZdS)�
DummyProgressaVProgress-bar standin that does nothing.

    This was previously often constructed by application code if no progress
    bar was explicitly passed in.  That's no longer recommended: instead, just
    create a progress task from the ui_factory.  This class can be used in
    test code that needs to fake a progress task for some reason.
    cCsdSrr	rr	r	r
r�szDummyProgress.tickNcCsdSrr	)rr�current�totalr	r	r
r�szDummyProgress.updatecCsdSrr	)r�messager*r+r	r	r
�child_update�szDummyProgress.child_updatecCsdSrr	rr	r	r
r"�szDummyProgress.clearcKstfi|��Sr)r))r�kwargsr	r	r
�child_progress�szDummyProgress.child_progress)NNN)	rr&r'r(rrr-r"r/r	r	r	r
r)�s
r)cCs6|durdStt|��}d|d|dd|dfS)Nz-:--:--z%d:%02d:%02di�<)�int�round)Zdeltr	r	r
�
str_tdelta�s
�r3��
cCs�|durdS|sdS||kr dS||kr,dSt��|}|dkrDdSt|�t|�t|�}|r�t|�|kr�t|�tt|��}|||}	||}
|	|
dS||S)Ng@�)�timer �len�sum)Z
start_timer*r+Zenough_samplesZlast_updatesZn_recent�elapsedZtotal_durationZavgZ	time_leftZ
old_time_leftr	r	r
�get_eta�s$r;c@s eZdZdZdd�Zdd�ZdS)�
ProgressPhasez-Update progress object with the current phasecCs&t�|�||_||_||_d|_dSr)�objectr�pbr,r+�	cur_phase)rr,r+r>r	r	r
r�s

zProgressPhase.__init__cCs:|jdurd|_n|jd7_|j�|j|j|j�dS)Nr�)r?r>rr,r+rr	r	r
�
next_phase�s
zProgressPhase.next_phaseN)rr&r'r(rrAr	r	r	r
r<�sr<)r4Nr5)r(Z
__future__rr7rrr=rr)r3r;r<r	r	r	r
�<module>s|	�
!