§
    cÌcf!  ã                   ó‚   — d Z 	 ddlZddlZd„ Z G d„ d¦  «        Z G d„ d¦  «        Zd„ Z	 	 dd„Z G d„ d¦  «        ZdS )Úgoogleé    Nc                 ó’   — t          | dd¦  «        }|€dS  |¦   «         sdS t          j                             d¦  «        dk    rdS dS )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.
    ÚisattyNFÚTERMÚdumbT)ÚgetattrÚosÚenvironÚget)Úfr   s     ú1/usr/lib/python3/dist-packages/breezy/progress.pyÚ_supports_progressr      sW   € õ �Q˜ $Ñ'Ô'€FØ€~ØˆuØˆ6‰8Œ8ð Øˆuõ
 
„z‡~‚~�fÑÔ Ò'Ð'àˆuØˆ4ó    c                   óT   — e Zd ZdZdd„Zd„ Zdd„Zd„ Zd„ Zd„ Z	dd
„Z
d„ Zd„ Zd„ ZdS )ÚProgressTaskay  Model 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.

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

      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.
    Nc                 óÊ   — || _         d| _        d| _        d| _        d| _        || _        || _        d| _        d| _        d| _	        d| _
        d| _        d| _        d| _        dS )a¥  Construct a new progress task.

        Args:
          parent_task: Enclosing ProgressTask or None.
          progress_view: ProgressView to display this ProgressTask.
          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`.
        r   NÚ FT)Fgš™™™™™¹?)Ú_parent_taskÚ_last_updateÚ	total_cntÚcurrent_cntÚmsgÚ
ui_factoryÚprogress_viewÚshow_pctÚshow_spinnerÚshow_etaÚ
show_countÚshow_barÚupdate_latencyÚshow_transport_activity)ÚselfÚparent_taskr   r   s       r   Ú__init__zProgressTask.__init__K   ss   € ð (ˆÔØˆÔØˆŒØˆÔØˆŒà$ˆŒØ*ˆÔØˆŒØ ˆÔØˆŒØˆŒØˆŒØ!ˆÔØ'+ˆÔ$Ð$Ð$r   c                 ód   — d                      | j        j        | j        | j        | j        ¦  «        S )Nz{}({!r}/{!r}, msg={!r}))ÚformatÚ	__class__Ú__name__r   r   r   ©r"   s    r   Ú__repr__zProgressTask.__repr__g   s2   € Ø(×/Ò/ØŒNÔ#ØÔØŒNØŒHñ	ô ð 	r   c                 ó®   — || _         || _        |r|| _        | j        r| j                             | ¦  «         dS | j                             | ¦  «         dS )z…Report updated task message and if relevent progress counters

        The message given must be unicode, not a byte string.
        N)r   r   r   r   Úshow_progressr   Ú_progress_updated)r"   r   r   r   s       r   ÚupdatezProgressTask.updaten   sf   € ð
 ˆŒØ&ˆÔØð 	'Ø&ˆDŒNØÔð 	4ØÔ×,Ò,¨TÑ2Ô2Ð2Ð2Ð2àŒO×-Ò-¨dÑ3Ô3Ð3Ð3Ð3r   c                 ó:   — |                       | j        ¦  «         d S ©N)r.   r   r)   s    r   ÚtickzProgressTask.tick|   s   € Ø�Š�D”HÑÔÐÐÐr   c                 ó€   — | j         r| j                              | ¦  «         d S | j                             | ¦  «         d S r0   )r   Útask_finishedr   Ú_progress_finishedr)   s    r   ÚfinishedzProgressTask.finished   sF   € ØÔð 	5ØÔ×,Ò,¨TÑ2Ô2Ð2Ð2Ð2àŒO×.Ò.¨tÑ4Ô4Ð4Ð4Ð4r   c                 ó:   — t          | | j        | j        ¬¦  «        S )N)r   r   )r   r   r   r)   s    r   Úmake_sub_taskzProgressTask.make_sub_task…   s%   € Ý˜D¨T¬_Ø*.Ô*<ð>ñ >ô >ð 	>r   ç        c                 ó°   — | j         �'| j        r t          | j         ¦  «        |z   | j        z  }n|}| j        €|S |€d}| j                             |¦  «        S )zqReturn fractional completion of this task and its parents

        Returns None if no completion can be computed.Nr8   )r   r   Úfloatr   Ú_overall_completion_fraction)r"   Úchild_fractionÚown_fractions      r   r;   z)ProgressTask._overall_completion_fraction‰   sp   € ð ÔÐ'¨D¬NÐ'Ý! $Ô"2Ñ3Ô3Ø*ñ+Ø.2¬nñ=ˆLˆLð
 *ˆLØÔÐ$ØÐàÐ#Ø"�ØÔ$×AÒAÀ,ÑOÔOÐOr   c                 ó|   — | j         r| j                              ¦   «          d S | j                             ¦   «          d S r0   )r   Úclearr   Ú
clear_termr)   s    r   r?   zProgressTask.clear›   sD   € ð Ôð 	)ØÔ×$Ò$Ñ&Ô&Ð&Ð&Ð&àŒO×&Ò&Ñ(Ô(Ð(Ð(Ð(r   c                 ó   — | S r0   © r)   s    r   Ú	__enter__zProgressTask.__enter__¨   s   € Øˆr   c                 ó.   — |                       ¦   «          dS )NF)r5   )r"   Úexc_typeÚexc_valÚexc_tbs       r   Ú__exit__zProgressTask.__exit__«   s   € Ø�Š‰ŒˆØˆur   ©NNN)NN)r8   )r(   Ú
__module__Ú__qualname__Ú__doc__r$   r*   r.   r1   r5   r7   r;   r?   rC   rH   rB   r   r   r   r   4   sÇ   € € € € € ðð ð,,ð ,ð ,ð ,ð8ð ð ð4ð 4ð 4ð 4ðð ð ð5ð 5ð 5ð>ð >ð >ðPð Pð Pð Pð$)ð )ð )ðð ð ðð ð ð ð r   r   c                   ó2   — e Zd ZdZd„ Zdd„Zd„ Zd„ Zd„ ZdS )	ÚDummyProgressaV  Progress-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.
    c                 ó   — d S r0   rB   r)   s    r   r1   zDummyProgress.tick¹   ó   € Øˆr   Nc                 ó   — d S r0   rB   )r"   r   ÚcurrentÚtotals       r   r.   zDummyProgress.update¼   rP   r   c                 ó   — d S r0   rB   )r"   ÚmessagerR   rS   s       r   Úchild_updatezDummyProgress.child_update¿   rP   r   c                 ó   — d S r0   rB   r)   s    r   r?   zDummyProgress.clearÂ   rP   r   c                 ó   — t          di |¤ŽS )NrB   )rN   )r"   Úkwargss     r   Úchild_progresszDummyProgress.child_progressÅ   s   € ÝÐ&Ð&˜vÐ&Ð&Ð&r   rI   )	r(   rJ   rK   rL   r1   r.   rV   r?   rZ   rB   r   r   rN   rN   °   sn   € € € € € ðð ðð ð ðð ð ð ðð ð ðð ð ð'ð 'ð 'ð 'ð 'r   rN   c                 ój   — | €dS t          t          | ¦  «        ¦  «        } d| dz  | dz  dz  | dz  fz  S )Nz-:--:--z%d:%02d:%02di  é<   )ÚintÚround)Údelts    r   Ú
str_tdeltar`   É   sJ   € Ø€|ØˆyÝ�u�T‰{Œ{ÑÔ€DØ˜T D™[Ø" R™i¨2Ñ-Ø! B™Yð(ñ (ð (r   é   é
   c                 ó‚  — | €d S |sd S ||k     rd S ||k    rd S t          j         ¦   «         | z
  }|dk     rd S t          |¦  «        t          |¦  «        z  t          |¦  «        z  }|rTt          |¦  «        |k    rAt          |¦  «        t          t          |¦  «        ¦  «        z  }|||z
  z  }	||z
  }
|	|
z   dz  S ||z
  S )Ng       @é   )Útimer:   ÚlenÚsum)Ú
start_timerR   rS   Úenough_samplesÚlast_updatesÚn_recentÚelapsedÚtotal_durationÚavgÚ	time_leftÚold_time_lefts              r   Úget_etarq   Ò   sè   € àÐØˆtàð Øˆtà�ÒÐØˆtà�‚€ØˆtåŒi‰kŒk˜JÑ&€Gà�‚}€}Øˆtå˜7‘^”^¥e¨E¡l¤lÑ2µU¸7±^´^ÑC€Nàð /�˜LÑ)Ô)¨XÒ5Ð5Ý�,ÑÔ¥%­¨LÑ(9Ô(9Ñ":Ô":Ñ:ˆØ˜5 7™?Ñ+ˆ	à&¨Ñ0ˆð ˜MÑ)¨QÑ.Ð.à˜GÑ#Ð#r   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚProgressPhasez-Update progress object with the current phasec                 ór   — t                                | ¦  «         || _        || _        || _        d | _        d S r0   )Úobjectr$   ÚpbrU   rS   Ú	cur_phase)r"   rU   rS   rv   s       r   r$   zProgressPhase.__init__ö   s4   € Ý�Š˜ÑÔÐØˆŒØˆŒØˆŒ
ØˆŒˆˆr   c                 óš   — | j         €d| _         n| xj         dz  c_         | j                             | j        | j         | j        ¦  «         d S )Nr   é   )rw   rv   r.   rU   rS   r)   s    r   Ú
next_phasezProgressPhase.next_phaseý   sG   € ØŒ>Ð!ØˆDŒNˆNàˆNŒN˜aÑˆNŒNØŒ�Š�t”| T¤^°T´ZÑ@Ô@Ð@Ð@Ð@r   N)r(   rJ   rK   rL   r$   rz   rB   r   r   rs   rs   ó   s=   € € € € € Ø7Ð7ðð ð ðAð Að Að Að Ar   rs   )ra   Nrb   )	Ú__docformat__re   r	   r   r   rN   r`   rq   rs   rB   r   r   ú<module>r|      s÷   ðð" €ðð €€€Ø 	€	€	€	ðð ð ð.yð yð yð yð yñ yô yð yðx'ð 'ð 'ð 'ð 'ñ 'ô 'ð 'ð2(ð (ð (ð HLØð$ð $ð $ð $ðBAð Að Að Að Añ Aô Að Að Að Ar   