o
    a+)h                  +   @   s   d dl Z d dlZd dlZd dlZd dlmZmZ d dlmZ d dl	m
Z
 d dlmZmZ d dlmZ d dl mZmZ d dlmZ d d	lmZ d d
lmZmZ d dlmZmZmZ d dlmZ d dlmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/ ej0dkrd dlm1Z1 nd dl2m1Z1 ddl3m4Z4m5Z5 ddl6m7Z7m8Z8m9Z9m:Z: ddl;m<Z< ddl=m>Z> ddl?m@Z@ ddlAmBZB ddlCmDZD ddlEmFZF ddlGmHZHmIZI ddlJmKZKmLZL e(deMZNe.dZOe g ePf ZQe.de+eZRG dd deZS	 		!		"		#	$	%	&	'	(	"	!dd)e/e*eO e%eO f d*eTd+e)eP d,eUd-e)e7 d.eUd/e)e g ePf  d0ePd1eFd2eFd3eFd4eFd5ePd6eUd7eUd8e%eO f d9d:ZVG d;d< d<eeZWG d=d> d>e!eR e$eR ZXd?d!dd"dd#d$d%d&d'd"d@dAed+eMd*eTd,eUd-e)e7 d.eUd/e)e g ePf  d0ePd1eFd2eFd3eFd4eFd6eUd8e!e fdBdCZYejZ	D			ddd?d!dd"dd#d$d%d&d'd"dEdAe/eTdFe[f dGe/e1dH e1dI f dJeMdKe)eT dLe)eT dMe)eT d+e)eM d*eTd,eUd-e)e7 d.eUd/e)e g ePf  d0ePd1eFd2eFd3eFd4eFd6eUd8e!e+ f&dNdOZ\ejZ	D			ddd?d!dd"dd#d$d%d&d'd"dEdAe/eTdFe[f dGe1dP dJeMdKe)eT dLe)eT dMe)eT d+e)eM d*eTd,eUd-e)e7 d.eUd/e)e g ePf  d0ePd1eFd2eFd3eFd4eFd6eUd8e!e f&dQdOZ\	I	D			ddd?d!dd"dd#d$d%d&d'd"dEdAe/eTdFe[f dGe/e1dP e1dH e1dI f dJeMdKe)eT dLe)eT dMe)eT d+e)eM d*eTd,eUd-e)e7 d.eUd/e)e g ePf  d0ePd1eFd2eFd3eFd4eFd6eUd8e/e!e e!e+ f f&dRdOZ\G dSdT dTeZ]G dUdV dVe]Z^G dWdX dXe]Z_G dYdZ dZe]Z`G d[d\ d\e]ZaG d]d^ d^e]ZbG d_d` d`e`ZcG dadb dbe]ZdG dcdd dde]ZeG dedf dfe]ZfG dgdh dhe]ZgG didj dje]ZhG dkdl dle]ZiG dmdn dne'ZjeG dodp dpZkG dqdr dre>Zlemdskrd dlnZnd dloZoddtlpmqZq ddulrmsZs ddvltmuZu ddwlGmIZI eudxdyd!dzZteId{d|d}ZGeGvd~dd deqddeGdddddetesdg	Zwd dlxmyZy eyewZze7d!dZ6ele_ gel{ eb R e6d"dQZ|e|j}dddZ~e|j}dddZe|j}dddZe|jse|je~dd e|jedd eod end ddk re|eez e|jrW d   dS W d   dS 1 sw   Y  dS dS )    N)ABCabstractmethoddeque)Sized)	dataclassfield)	timedelta)	RawIOBaseUnsupportedOperation)ceil)mmap)PathLikestat)EventRLockThread)TracebackType)AnyBinaryIOCallableContextManagerDequeDictGenericIterableList
NamedTupleNewTypeOptionalSequenceTextIOTupleTypeTypeVarUnion)      )Literal   )filesizeget_console)ConsoleGroupJustifyMethodRenderableType)Highlighter)JupyterMixin)Live)ProgressBar)Spinner)	StyleType)ColumnTable)TextTextTypeTaskIDProgressType_Ic                       sl   e Zd ZdZdddddef fddZdddZdddZdee	e
  dee
 dee d	d
fddZ  ZS )_TrackThreadz)A thread to periodically update progress.progressProgresstask_idr:   update_periodc                    s.   || _ || _|| _t | _d| _t   d S )Nr   )r>   r@   rA   r   done	completedsuper__init__)selfr>   r@   rA   	__class__ XC:\Users\User\Downloads\Proyecto_IoT\venv\Lib\site-packages\pip/_vendor/rich/progress.pyrE   B   s   z_TrackThread.__init__returnNc                 C   sj   | j }| jj}| j}d}| jj}||s(| j}||kr$||||  |}||r| jj| j | jdd d S )Nr   T)rC   refresh)r@   r>   advancerA   rB   waitrC   update)rF   r@   rM   rA   last_completedrN   rC   rI   rI   rJ   runK   s   z_TrackThread.runc                 C      |    | S NstartrF   rI   rI   rJ   	__enter__Y      z_TrackThread.__enter__exc_typeexc_valexc_tbc                 C   s   | j   |   d S rS   )rB   setjoinrF   rY   rZ   r[   rI   rI   rJ   __exit__]   s   
z_TrackThread.__exit__rK   N)rK   r=   )__name__
__module____qualname____doc__floatrE   rQ   rW   r   r#   BaseExceptionr   r_   __classcell__rI   rI   rG   rJ   r=   ?   s    
	

r=   
Working...TF
   bar.backbar.completebar.finished	bar.pulse皙?sequencedescriptiontotalauto_refreshconsole	transientget_timerefresh_per_secondstylecomplete_stylefinished_stylepulse_stylerA   disable
show_speedrK   c              	   c   s    |rt dgng }|t||	|
|dt|dt f t||||||p%d|d}| |j| |||dE dH  W d   dS 1 sDw   Y  dS )a  Track progress by iterating over a sequence.

    Args:
        sequence (Iterable[ProgressType]): A sequence (must support "len") you wish to iterate over.
        description (str, optional): Description of task show next to progress bar. Defaults to "Working".
        total: (float, optional): Total number of steps. Default is len(sequence).
        auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
        transient: (bool, optional): Clear the progress on exit. Defaults to False.
        console (Console, optional): Console to write to. Default creates internal Console instance.
        refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
        style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
        complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
        finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
        pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
        update_period (float, optional): Minimum time (in seconds) between calls to update(). Defaults to 0.1.
        disable (bool, optional): Disable display of progress.
        show_speed (bool, optional): Show speed if total isn't known. Defaults to True.
    Returns:
        Iterable[ProgressType]: An iterable of the values in the sequence.

    ([progress.description]{task.description}rw   rx   ry   rz   )r|   ri   rr   rs   rt   ru   rv   r{   )rq   rp   rA   N)
TextColumnextend	BarColumnTaskProgressColumnTimeRemainingColumnr?   track)ro   rp   rq   rr   rs   rt   ru   rv   rw   rx   ry   rz   rA   r{   r|   columnsr>   rI   rI   rJ   r   g   s8   (
"r   c                   @   s  e Zd ZdZ	d?dedddededd	f
d
dZd@ddZde	e
e  de	e de	e dd	fddZdefddZdefddZedefddZdefddZdefddZedefddZedefdd Zdefd!d"Zdefd#d$Zdefd%d&ZdAd(edefd)d*Zd+eeee f fd,d-Z!dAd(edefd.d/Z"dAd0ede#e fd1d2Z$dBd3d4Z%dCd6ed7edefd8d9Z&defd:d;Z'd<e(defd=d>Z)d	S )D_Readerz9A reader that tracks progress while it's being read from.Thandler>   r?   taskclose_handlerK   Nc                 C   s"   || _ || _|| _|| _d| _d S NF)r   r>   r   r   _closed)rF   r   r>   r   r   rI   rI   rJ   rE      s
   
z_Reader.__init__c                 C   s   | j   | S rS   )r   rW   rV   rI   rI   rJ   rW      s   
z_Reader.__enter__rY   rZ   r[   c                 C      |    d S rS   )closer^   rI   rI   rJ   r_         z_Reader.__exit__c                 C   s   | S rS   rI   rV   rI   rI   rJ   __iter__      z_Reader.__iter__c                 C   s$   t | j}| jj| jt|d |S NrM   )nextr   r>   rM   r   len)rF   linerI   rI   rJ   __next__   s   
z_Reader.__next__c                 C      | j S rS   )r   rV   rI   rI   rJ   closed   s   z_Reader.closedc                 C   
   | j  S rS   )r   filenorV   rI   rI   rJ   r         
z_Reader.filenoc                 C   r   rS   )r   isattyrV   rI   rI   rJ   r      r   z_Reader.isattyc                 C      | j jS rS   )r   moderV   rI   rI   rJ   r         z_Reader.modec                 C   r   rS   )r   namerV   rI   rI   rJ   r      r   z_Reader.namec                 C   r   rS   )r   readablerV   rI   rI   rJ   r      r   z_Reader.readablec                 C   r   rS   )r   seekablerV   rI   rI   rJ   r      r   z_Reader.seekablec                 C      dS r   rI   rV   rI   rI   rJ   writable   r   z_Reader.writablesizec                 C   &   | j |}| jj| jt|d |S r   )r   readr>   rM   r   r   )rF   r   blockrI   rI   rJ   r         z_Reader.readbc                 C   s"   | j |}| jj| j|d |S r   )r   readintor>   rM   r   )rF   r   nrI   rI   rJ   r      s   z_Reader.readintoc                 C   r   r   )r   readliner>   rM   r   r   )rF   r   r   rI   rI   rJ   r      r   z_Reader.readlinehintc                 C   s,   | j |}| jj| jttt|d |S r   )r   	readlinesr>   rM   r   summapr   )rF   r   linesrI   rI   rJ   r      s   z_Reader.readlinesc                 C   s   | j r| j  d| _d S )NT)r   r   r   r   rV   rI   rI   rJ   r      s   

z_Reader.closer   offsetwhencec                 C   s$   | j ||}| jj| j|d |S )NrC   )r   seekr>   rO   r   )rF   r   r   posrI   rI   rJ   r     s   z_Reader.seekc                 C   r   rS   )r   tellrV   rI   rI   rJ   r   
  r   z_Reader.tellsc                 C   s   t d)Nwrite)r   )rF   r   rI   rI   rJ   r     s   z_Reader.write)T)rK   r   )r   r`   )r   )*ra   rb   rc   rd   r   r:   boolrE   rW   r   r#   rf   r   r_   r   bytesr   propertyr   intr   r   strr   r   r   r   r   r   r%   	bytearray
memoryviewr   r   r   r   r   r   r   r   r   r   rI   rI   rI   rJ   r      sZ    




r   c                   @   s^   e Zd ZdZdddeddfddZdefd	d
Zdeee	  dee	 dee
 ddfddZdS )_ReadContextzEA utility class to handle a context for both a reader and a progress.r>   r?   readerrK   Nc                 C   s   || _ || _d S rS   )r>   r   )rF   r>   r   rI   rI   rJ   rE     s   
z_ReadContext.__init__c                 C   s   | j   | j S rS   )r>   rU   r   rW   rV   rI   rI   rJ   rW     s   

z_ReadContext.__enter__rY   rZ   r[   c                 C   s   | j   | j||| d S rS   )r>   stopr   r_   r^   rI   rI   rJ   r_     s   
z_ReadContext.__exit__)ra   rb   rc   rd   r<   rE   rW   r   r#   rf   r   r_   rI   rI   rI   rJ   r     s    
r   
Reading...)rp   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   filec             	   C   sh   |rt dgng }|t||	|
|dt t f t||||||p"d|d}|j| ||d}t||S )a  Read bytes from a file while tracking progress.

    Args:
        file (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.
        total (int): Total number of bytes to read.
        description (str, optional): Description of task show next to progress bar. Defaults to "Reading".
        auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
        transient: (bool, optional): Clear the progress on exit. Defaults to False.
        console (Console, optional): Console to write to. Default creates internal Console instance.
        refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
        style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
        complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
        finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
        pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
        disable (bool, optional): Disable display of progress.
    Returns:
        ContextManager[BinaryIO]: A context manager yielding a progress reader.

    r}   r~   ri   r   )rq   rp   )r   r   r   DownloadColumnr   r?   	wrap_filer   )r   rq   rp   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r   r>   r   rI   rI   rJ   r   &  s0   %

r   r   )rq   rp   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   PathLike[str]r   rtr	bufferingencodingerrorsnewlinec                C      d S rS   rI   r   r   r   r   r   r   rq   rp   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   rI   rI   rJ   openg     r   rbc                C   r   rS   rI   r   rI   rI   rJ   r     r   c             
   C   sr   |rt dgng }|t||||dt t f t|||	|
||p"d|d}|j| |||||||d}t||S )a  Read bytes from a file while tracking progress.

    Args:
        path (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.
        mode (str): The mode to use to open the file. Only supports "r", "rb" or "rt".
        buffering (int): The buffering strategy to use, see :func:`io.open`.
        encoding (str, optional): The encoding to use when reading in text mode, see :func:`io.open`.
        errors (str, optional): The error handling strategy for decoding errors, see :func:`io.open`.
        newline (str, optional): The strategy for handling newlines in text mode, see :func:`io.open`
        total: (int, optional): Total number of bytes to read. Must be provided if reading from a file handle. Default for a path is os.stat(file).st_size.
        description (str, optional): Description of task show next to progress bar. Defaults to "Reading".
        auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
        transient: (bool, optional): Clear the progress on exit. Defaults to False.
        console (Console, optional): Console to write to. Default creates internal Console instance.
        refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
        style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
        complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
        finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
        pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
        disable (bool, optional): Disable display of progress.
        encoding (str, optional): The encoding to use when reading in text mode.

    Returns:
        ContextManager[BinaryIO]: A context manager yielding a progress reader.

    r}   r~   ri   r   )r   r   r   r   r   rq   rp   )r   r   r   r   r   r?   r   r   )r   r   r   r   r   r   rq   rp   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r   r>   r   rI   rI   rJ   r     sB   1


c                   @   sp   e Zd ZU dZdZee ed< ddee ddfddZ	defdd	Z
d
ddefddZed
ddefddZdS )ProgressColumnz3Base class for a widget to use in progress display.Nmax_refreshtable_columnrK   c                 C   s   || _ i | _d | _d S rS   )_table_column_renderable_cache_update_time)rF   r   rI   rI   rJ   rE     s   
zProgressColumn.__init__c                 C   s   | j pt S )z.Get a table column, used to build tasks table.)r   r6   rV   rI   rI   rJ   get_table_column  s   zProgressColumn.get_table_columnr   Taskc                 C   sp   |  }| jdur)|js)z
| j|j \}}W n	 ty   Y n
w || j |kr)|S | |}||f| j|j< |S )a  Called by the Progress object to return a renderable for the given task.

        Args:
            task (Task): An object containing information regarding the task.

        Returns:
            RenderableType: Anything renderable (including str).
        N)ru   r   rC   r   idKeyErrorrender)rF   r   current_time	timestamp
renderablerI   rI   rJ   __call__  s   	
zProgressColumn.__call__c                 C   r   )z"Should return a renderable object.NrI   rF   r   rI   rI   rJ   r     s    zProgressColumn.renderrS   )ra   rb   rc   rd   r   r   re   __annotations__r6   rE   r   r/   r   r   r   rI   rI   rI   rJ   r     s   
 r   c                       sJ   e Zd ZdZ	ddddedee f fddZd	d
defddZ  Z	S )RenderableColumnzA column to insert an arbitrary column.

    Args:
        renderable (RenderableType, optional): Any renderable. Defaults to empty string.
     Nr   r   r   c                      || _ t j|d d S Nr   )r   rD   rE   )rF   r   r   rG   rI   rJ   rE         zRenderableColumn.__init__r   r   rK   c                 C   r   rS   )r   r   rI   rI   rJ   r   &  s   zRenderableColumn.render)r   )
ra   rb   rc   rd   r/   r   r6   rE   r   rg   rI   rI   rG   rJ   r     s    r   c                       s   e Zd ZdZ					ddedee d	ed
edee	 f
 fddZ
		ddedee d	eddfddZdddefddZ  ZS )SpinnerColumna  A column with a 'spinner' animation.

    Args:
        spinner_name (str, optional): Name of spinner animation. Defaults to "dots".
        style (StyleType, optional): Style of spinner. Defaults to "progress.spinner".
        speed (float, optional): Speed factor of spinner. Defaults to 1.0.
        finished_text (TextType, optional): Text used when task is finished. Defaults to " ".
    dotsprogress.spinner      ? Nspinner_namerw   speedfinished_textr   c                    s<   t |||d| _t|trt|n|| _t j|d d S )Nrw   r   r   )	r4   spinner
isinstancer   r8   from_markupr   rD   rE   )rF   r   rw   r   r   r   rG   rI   rJ   rE   4  s   zSpinnerColumn.__init__spinner_stylerK   c                 C   s   t |||d| _dS )a-  Set a new spinner.

        Args:
            spinner_name (str): Spinner name, see python -m rich.spinner.
            spinner_style (Optional[StyleType], optional): Spinner style. Defaults to "progress.spinner".
            speed (float, optional): Speed factor of spinner. Defaults to 1.0.
        r   N)r4   r   )rF   r   r   r   rI   rI   rJ   set_spinnerD  s   zSpinnerColumn.set_spinnerr   r   c                 C   s$   |j r| j}|S | j| }|S rS   )finishedr   r   r   ru   )rF   r   textrI   rI   rJ   r   S  s   zSpinnerColumn.render)r   r   r   r   N)r   r   )ra   rb   rc   rd   r   r   r5   re   r9   r6   rE   r   r/   r   rg   rI   rI   rG   rJ   r   *  s<    
r   c                       sd   e Zd ZdZ					ddededed	ed
ee	 dee
 ddf fddZdddefddZ  ZS )r   zA column containing text.noneleftTNtext_formatrw   justifymarkuphighlighterr   rK   c                    s:   || _ || _|| _|| _|| _t j|ptddd d S )NTno_wrapr   )r   r  rw   r  r  rD   rE   r6   )rF   r   rw   r  r  r  r   rG   rI   rJ   rE   _  s   	zTextColumn.__init__r   r   c                 C   sR   | j j|d}| jrtj|| j| jd}n	t|| j| jd}| jr'| j| |S Nr   )rw   r  )	r   formatr  r8   r   rw   r  r  	highlight)rF   r   _textr   rI   rI   rJ   r   o  s   zTextColumn.render)r   r   TNN)ra   rb   rc   rd   r   r5   r.   r   r   r0   r6   rE   r8   r   rg   rI   rI   rG   rJ   r   \  s.    r   c                       sf   e Zd ZdZ						ddee d	ed
edededee ddf fddZddde	fddZ
  ZS )r   a  Renders a visual progress bar.

    Args:
        bar_width (Optional[int], optional): Width of bar or None for full width. Defaults to 40.
        style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
        complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
        finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
        pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
    (   rj   rk   rl   rm   N	bar_widthrw   rx   ry   rz   r   rK   c                    s0   || _ || _|| _|| _|| _t j|d d S r   )r  rw   rx   ry   rz   rD   rE   )rF   r  rw   rx   ry   rz   r   rG   rI   rJ   rE     s   	zBarColumn.__init__r   r   c                 C   s^   t |jdurtd|jndtd|j| jdu rdntd| j|j | | j| j| j	| j
d	S )z&Gets a progress bar widget for a task.Nr   r)   )	rq   rC   widthpulseanimation_timerw   rx   ry   rz   )r3   rq   maxrC   r  startedru   rw   rx   ry   rz   r   rI   rI   rJ   r     s   
zBarColumn.render)r  rj   rk   rl   rm   N)ra   rb   rc   rd   r   r   r5   r6   rE   r3   r   rg   rI   rI   rG   rJ   r   z  s0    r   c                   @   "   e Zd ZdZdddefddZdS )TimeElapsedColumnzRenders time elapsed.r   r   rK   c                 C   sD   |j r|jn|j}|du rtdddS tt|d}tt|ddS )Show time remaining.N-:--:--progress.elapsedrw   )seconds)r   finished_timeelapsedr8   r	   r   r   )rF   r   r  deltarI   rI   rJ   r     s
   zTimeElapsedColumn.renderNra   rb   rc   rd   r8   r   rI   rI   rI   rJ   r        r  c                       s   e Zd ZdZ								dd	ed
ededededee	 dee
 deddf fddZedee defddZdddefddZ  ZS )r   a  Show task progress as a percentage.

    Args:
        text_format (str, optional): Format for percentage display. Defaults to "[progress.percentage]{task.percentage:>3.0f}%".
        text_format_no_percentage (str, optional): Format if percentage is unknown. Defaults to "".
        style (StyleType, optional): Style of output. Defaults to "none".
        justify (JustifyMethod, optional): Text justification. Defaults to "left".
        markup (bool, optional): Enable markup. Defaults to True.
        highlighter (Optional[Highlighter], optional): Highlighter to apply to output. Defaults to None.
        table_column (Optional[Column], optional): Table Column to use. Defaults to None.
        show_speed (bool, optional): Show speed if total is unknown. Defaults to False.
    -[progress.percentage]{task.percentage:>3.0f}%r   r   r   TNFr   text_format_no_percentagerw   r  r  r  r   r|   rK   c	           	         s(   || _ || _t j||||||d d S )N)r   rw   r  r  r  r   )r  r|   rD   rE   )	rF   r   r  rw   r  r  r  r   r|   rG   rI   rJ   rE     s   
zTaskProgressColumn.__init__r   c                 C   sN   |du r
t dddS tt|g dd\}}|| }t |d| dddS )	zRender the speed in iterations per second.

        Args:
            task (Task): A Task object.

        Returns:
            Text: Text object containing the task speed.
        Nr   zprogress.percentager  )r   u   ×10³u   ×10⁶u   ×10⁹u   ×10¹²  z.1fz it/s)r8   r*   pick_unit_and_suffixr   )clsr   unitsuffix
data_speedrI   rI   rJ   render_speed  s   
zTaskProgressColumn.render_speedr   r   c                 C   s   |j d u r| jr| |jp|jS |j d u r| jn| j}|j|d}| jr0t	j
|| j| jd}n	t	|| j| jd}| jrB| j| |S r  )rq   r|   r&  finished_speedr   r  r   r  r  r8   r   rw   r  r  r	  )rF   r   r   r
  r   rI   rI   rJ   r     s   zTaskProgressColumn.render)r  r   r   r   TNNF)ra   rb   rc   rd   r   r5   r.   r   r   r0   r6   rE   classmethodre   r8   r&  r   rg   rI   rI   rG   rJ   r     s@    	
r   c                       sP   e Zd ZdZdZ			ddededee f fdd	Zd
dde	fddZ
  ZS )r   a  Renders estimated time remaining.

    Args:
        compact (bool, optional): Render MM:SS when time remaining is less than an hour. Defaults to False.
        elapsed_when_finished (bool, optional): Render time elapsed when the task is finished. Defaults to False.
          ?FNcompactelapsed_when_finishedr   c                    s   || _ || _t j|d d S r   )r*  r+  rD   rE   )rF   r*  r+  r   rG   rI   rJ   rE     s   zTimeRemainingColumn.__init__r   r   rK   c                 C   s   | j r|jr|j}d}n|j}d}|jdu rtd|dS |du r.t| jr)d|dS d|dS tt|d\}}t|d\}}| jrM|sM|d	d
|d	}n|dd
|d	d
|d	}t||dS )r  r  zprogress.remainingNr   r  z--:--r  <   02d:d)	r+  r   r  time_remainingrq   r8   r*  divmodr   )rF   r   	task_timerw   minutesr  hours	formattedrI   rI   rJ   r     s   

zTimeRemainingColumn.render)FFN)ra   rb   rc   rd   r   r   r   r6   rE   r8   r   rg   rI   rI   rG   rJ   r     s    
r   c                   @   r  )FileSizeColumnzRenders completed filesize.r   r   rK   c                 C   s   t t|j}t|ddS )Show data completed.zprogress.filesizer  )r*   decimalr   rC   r8   rF   r   	data_sizerI   rI   rJ   r   ,  s   zFileSizeColumn.renderNr  rI   rI   rI   rJ   r6  )  r  r6  c                   @   r  )TotalFileSizeColumnzRenders total filesize.r   r   rK   c                 C   s*   |j durtt|j nd}t|ddS )r7  Nr   zprogress.filesize.totalr  )rq   r*   r8  r   r8   r9  rI   rI   rJ   r   5  s   zTotalFileSizeColumn.renderNr  rI   rI   rI   rJ   r;  2  r  r;  c                       sB   e Zd ZdZddedee f fddZdd	d
efddZ	  Z
S )MofNCompleteColumnaH  Renders completed count/total, e.g. '  10/1000'.

    Best for bounded tasks with int quantities.

    Space pads the completed count so that progress length does not change as task progresses
    past powers of 10.

    Args:
        separator (str, optional): Text to separate completed and total values. Defaults to "/".
    /N	separatorr   c                    r   r   )r>  rD   rE   )rF   r>  r   rG   rI   rJ   rE   G  s   zMofNCompleteColumn.__init__r   r   rK   c                 C   sP   t |j}|jdurt |jnd}tt|}t|| d| j | ddS )zShow completed/total.N?r/  progress.downloadr  )r   rC   rq   r   r   r8   r>  )rF   r   rC   rq   total_widthrI   rI   rJ   r   K  s   
zMofNCompleteColumn.render)r=  N)ra   rb   rc   rd   r   r   r6   rE   r8   r   rg   rI   rI   rG   rJ   r<  ;  s    r<  c                       sH   e Zd ZdZ	ddedee ddf fddZd	d
defddZ	  Z
S )r   zRenders file size downloaded and total, e.g. '0.5/2.3 GB'.

    Args:
        binary_units (bool, optional): Use binary units, KiB, MiB etc. Defaults to False.
    FNbinary_unitsr   rK   c                    r   r   )rB  rD   rE   )rF   rB  r   rG   rI   rJ   rE   ]  r   zDownloadColumn.__init__r   r   c                 C   s   t |j}|jdurt |jn|}| jr t|g dd\}}nt|g dd\}}|dkr1dnd}|| }|d| d	}|jdurVt |j}	|	| }
|
d| d	}nd
}| d| d| }t|dd}|S )z.Calculate common unit for completed and total.N)	r   KiBMiBGiBTiBPiBEiBZiBYiBi   )	r   kBMBGBTBPBEBZBYBr   r)   r   z,.fr?  r=  r   r@  r  )r   rC   rq   rB  r*   r!  r8   )rF   r   rC    unit_and_suffix_calculation_baser#  r$  	precisioncompleted_ratiocompleted_strrq   total_ratio	total_strdownload_statusdownload_textrI   rI   rJ   r   c  s2   



zDownloadColumn.render)FN)ra   rb   rc   rd   r   r   r6   rE   r8   r   rg   rI   rI   rG   rJ   r   V  s    r   c                   @   r  )TransferSpeedColumnz&Renders human readable transfer speed.r   r   rK   c                 C   s@   |j p|j}|du rtdddS tt|}t| dddS )zShow data transfer speed.Nr?  zprogress.data.speedr  z/s)r'  r   r8   r*   r8  r   )rF   r   r   r%  rI   rI   rJ   r     s
   zTransferSpeedColumn.renderNr  rI   rI   rI   rJ   r\    r  r\  c                   @   s$   e Zd ZU dZeed< 	 eed< dS )ProgressSamplez$Sample of progress for a given time.r   rC   N)ra   rb   rc   rd   re   r   rI   rI   rI   rJ   r]    s   
 r]  c                   @   s  e Zd ZU dZeed< 	 eed< 	 ee ed< 	 eed< 	 e	ed< 	 dZ
ee ed< 	 d	Zeed
< 	 eedZeeef ed< 	 eddddZee ed< 	 eddddZee ed< 	 dZee ed< 	 edd dddZee ed< ededZeed< 	 defddZedefddZedee fddZedee fdd Zedefd!d"Zedefd#d$Z edee fd%d&Z!edee fd'd(Z"d+d)d*Z#dS ),r   zInformation regarding a progress task.

    This object should be considered read-only outside of the :class:`~Progress` class.

    r   rp   rq   rC   	_get_timeNr  Tvisible)default_factoryfieldsF)defaultinitrepr
start_time	stop_timer'  c                   C   s
   t ddS )Nr   )maxlenr   rI   rI   rI   rJ   <lambda>  s   
 zTask.<lambda>)r`  rc  rd  	_progress)rd  r`  _lockrK   c                 C   s   |   S )z(float: Get the current time, in seconds.)r^  rV   rI   rI   rJ   ru     r   zTask.get_timec                 C   
   | j duS )z#bool: Check if the task as started.N)re  rV   rI   rI   rJ   r       
zTask.startedc                 C   s   | j du rdS | j | j S )zPOptional[float]: Get the number of steps remaining, if a non-None total was set.N)rq   rC   rV   rI   rI   rJ   	remaining  s   
zTask.remainingc                 C   s2   | j du rdS | jdur| j| j  S |  | j  S )z]Optional[float]: Time elapsed since task was started, or ``None`` if the task hasn't started.N)re  rf  ru   rV   rI   rI   rJ   r    s
   

zTask.elapsedc                 C   rk  )zCheck if the task has finished.N)r  rV   rI   rI   rJ   r     rl  zTask.finishedc                 C   s.   | j sdS | j| j  d }tdtd|}|S )zOfloat: Get progress of task as a percentage. If a None total was set, returns 0              Y@)rq   rC   minr  )rF   rC   rI   rI   rJ   
percentage  s
   zTask.percentagec                 C   s   | j du rdS | jD | j}|s	 W d   dS |d j|d j }|dkr0	 W d   dS t|}t| tdd |D }|| }|W  d   S 1 sQw   Y  dS )z=Optional[float]: Get the estimated speed in steps per second.Nr   r   c                 s       | ]}|j V  qd S rS   r   ).0samplerI   rI   rJ   	<genexpr>      zTask.speed.<locals>.<genexpr>)re  rj  ri  r   iterr   r   )rF   r>   
total_timeiter_progresstotal_completedr   rI   rI   rJ   r     s"   
$z
Task.speedc                 C   s:   | j rdS | j}|sdS | j}|du rdS t|| }|S )zJOptional[float]: Get estimated time to completion, or ``None`` if no data.rn  N)r   r   rm  r   )rF   r   rm  estimaterI   rI   rJ   r0    s   zTask.time_remainingc                 C   s   | j   d| _d| _dS )zReset progress.N)ri  clearr  r'  rV   rI   rI   rJ   _reset  s   

zTask._resetr`   )$ra   rb   rc   rd   r:   r   r   r   re   GetTimeCallabler  r_  r   r   dictra  r   r   re  rf  r'  ri  r   r]  r   rj  ru   r   r  rm  r  r   rq  r   r0  r}  rI   rI   rI   rJ   r     sZ   
 
r   c                   @   sp  e Zd ZdZddddddddddd
deeef d	ee d
e	de
de
de	de	de	dee de	de	ddfddZedeedf fddZedefddZedee fddZedee fddZede	fdd Zdmd!d"Zdmd#d$Zdnd%d&Zd'eee  d(ee d)ee ddfd*d+Z			,	-dod.eee  e!e  f d/ee
 d0ee d1ed2e
dee  fd3d4Z"	dpdd5d6d7e#d/ee$ d0ee d1ede#f
d8d9Z%e&j'	:			dqddd5d;d7eed<e(f d=e)d> d?e$d@ee dAee dBee d/ee$ d0ee d1ede#fdCdDZ*e&j'	:			dqddd5d;d7eed<e(f d=ee)dE e)dF f d?e$d@ee dAee dBee d/ee$ d0ee d1ede+fdGdDZ*	E	:			drddd5d;d7eed<e(f d=ee)d> e)dF e)dE f d?e$d@ee dAee dBee d/ee$ d0ee d1edee#e+f fdHdDZ*d0eddfdIdJZ,d0eddfdKdLZ-dddddddMd0ed/ee
 dNee
 dOee
 d1ee dPee	 dQe	dRe.ddfdSdTZ/dddUdddVd0edWe	d/ee
 dNe$dPee	 d1ee dRe.ddfdXdYZ0dsd0edOe
ddfd[d\Z1dmd]d^Z2de3fd_d`Z4dee3 fdadbZ5dcee de6fdddeZ7de3fdfdgZ8		h	U	dtd1edWe	d/ee
 dNe$dPe	dRe.defdidjZ9d0eddfdkdlZ:dS )ur?   a  Renders an auto-updating progress bar(s).

    Args:
        console (Console, optional): Optional Console instance. Default will an internal Console instance writing to stdout.
        auto_refresh (bool, optional): Enable auto refresh. If disabled, you will need to call `refresh()`.
        refresh_per_second (Optional[float], optional): Number of times per second to refresh the progress information or None to use default (10). Defaults to None.
        speed_estimate_period: (float, optional): Period (in seconds) used to calculate the speed estimate. Defaults to 30.
        transient: (bool, optional): Clear the progress on exit. Defaults to False.
        redirect_stdout: (bool, optional): Enable redirection of stdout, so ``print`` may be used. Defaults to True.
        redirect_stderr: (bool, optional): Enable redirection of stderr. Defaults to True.
        get_time: (Callable, optional): A callable that gets the current time, or None to use Console.get_time. Defaults to None.
        disable (bool, optional): Disable progress display. Defaults to False
        expand (bool, optional): Expand tasks table to fit width. Defaults to False.
    NTri   g      >@F)
rs   rr   rv   speed_estimate_periodrt   redirect_stdoutredirect_stderrru   r{   expandr   rs   rr   rv   r  rt   r  r  ru   r{   r  rK   c       
      	   G   s   |dksJ dt  | _|p|  | _|| _|	| _|
| _i | _td| _	t
|p)t |||||| jd| _|p9| jj| _| jj| _| jj| _d S )Nr   zrefresh_per_second must be > 0)rs   rr   rv   rt   r  r  get_renderable)r   rj  get_default_columnsr   r  r{   r  _tasksr:   _task_indexr2   r+   r  livers   ru   printlog)rF   rs   rr   rv   r  rt   r  r  ru   r{   r  r   rI   rI   rJ   rE   *  s(   
	
zProgress.__init__.c                 C   s   t dt t t fS )a  Get the default columns used for a new Progress instance:
           - a text column for the description (TextColumn)
           - the bar itself (BarColumn)
           - a text column showing completion percentage (TextColumn)
           - an estimated-time-remaining column (TimeRemainingColumn)
        If the Progress instance is created without passing a columns argument,
        the default columns defined here will be used.

        You can also create a Progress instance using custom columns before
        and/or after the defaults, as in this example:

            progress = Progress(
                SpinnerColumn(),
                *Progress.default_columns(),
                "Elapsed:",
                TimeElapsedColumn(),
            )

        This code shows the creation of a Progress display, containing
        a spinner to the left, the default columns, and a labeled elapsed
        time column.
        r}   )r   r   r   r   )r"  rI   rI   rJ   r  N  s
   zProgress.get_default_columnsc                 C   r   rS   )r  rs   rV   rI   rI   rJ   rs   m  r   zProgress.consolec                 C   8   | j  t| j W  d   S 1 sw   Y  dS )zGet a list of Task instances.N)rj  listr  valuesrV   rI   rI   rJ   tasksq     $zProgress.tasksc                 C   r  )zA list of task IDs.N)rj  r  r  keysrV   rI   rI   rJ   task_idsw  r  zProgress.task_idsc                 C   sZ   | j   | js	 W d   dS tdd | j D W  d   S 1 s&w   Y  dS )z'Check if all tasks have been completed.NTc                 s   rr  rS   )r   )rs  r   rI   rI   rJ   ru    rv  z$Progress.finished.<locals>.<genexpr>)rj  r  allr  rV   rI   rI   rJ   r   }  s   $zProgress.finishedc                 C   s   | j s| jjdd dS dS )zStart the progress display.T)rL   N)r{   r  rU   rV   rI   rI   rJ   rU     s   zProgress.startc                 C   s$   | j   | jjs| j  dS dS )zStop the progress display.N)r  r   rs   is_interactiver  rV   rI   rI   rJ   r     s   
zProgress.stopc                 C   rR   rS   rT   rV   rI   rI   rJ   rW     rX   zProgress.__enter__rY   rZ   r[   c                 C   r   rS   )r   r^   rI   rI   rJ   r_     r   zProgress.__exit__rh   rn   ro   rq   r@   rp   rA   c                 c   s    d}|du rt |trtt|}n|}|du r!| j||d}n| j||d | jjrTt| ||}|D ]}|V  | j	d7  _	q5W d   dS 1 sMw   Y  dS | j
}	| j}
|D ]}|V  |	|d |
  q\dS )a  Track progress by iterating over a sequence.

        Args:
            sequence (Sequence[ProgressType]): A sequence of values you want to iterate over and track progress.
            total: (float, optional): Total number of steps. Default is len(sequence).
            task_id: (TaskID): Task to track. Default is new task.
            description: (str, optional): Description of task, if new task is created.
            update_period (float, optional): Minimum time (in seconds) between calls to update(). Defaults to 0.1.

        Returns:
            Iterable[ProgressType]: An iterable of values taken from the provided sequence.
        Nrq   r)   )r   r   re   r   add_taskrO   r  rr   r=   rC   rM   rL   )rF   ro   rq   r@   rp   rA   
task_totaltrack_threadvaluerM   rL   rI   rI   rJ   r     s0   
"
zProgress.trackr   )r@   rp   r   c                C   s   d}|dur	|}n|dur&| j  | j| j}W d   n1 s!w   Y  |du r.td|du r:| j||d}n| j||d t|| |ddS )aj  Track progress file reading from a binary file.

        Args:
            file (BinaryIO): A file-like object opened in binary mode.
            total (int, optional): Total number of bytes to read. This must be provided unless a task with a total is also given.
            task_id (TaskID): Task to track. Default is new task.
            description (str, optional): Description of task, if new task is created.

        Returns:
            BinaryIO: A readable file-like object in binary mode.

        Raises:
            ValueError: When no total value can be extracted from the arguments or the task.
        Nz?unable to get the total number of bytes, please specify 'total'r  Fr   )rj  r  rq   
ValueErrorr  rO   r   )rF   r   rq   r@   rp   total_bytesrI   rI   rJ   r     s   zProgress.wrap_filer   )rq   r@   rp   r   r   r   r   r   r   r   c          
      C   r   rS   rI   
rF   r   r   r   r   r   r   rq   r@   rp   rI   rI   rJ   r        zProgress.openr   r   c          
      C   r   rS   rI   r  rI   rI   rJ   r     r  c                C   s   d t|dd}
|
dvrtd||dk}|
dkr)|dkr)tdt d	}n|
d
ks1|
dkr?|dkr9td|dkr?d	}|du rHt|j}|du rT| j	|	|d}n| j
||d tj|d|d}t|| |dd}|dkss|d
kr}tj|||||dS |S )a#  Track progress while reading from a binary file.

        Args:
            path (Union[str, PathLike[str]]): The path to the file to read.
            mode (str): The mode to use to open the file. Only supports "r", "rb" or "rt".
            buffering (int): The buffering strategy to use, see :func:`io.open`.
            encoding (str, optional): The encoding to use when reading in text mode, see :func:`io.open`.
            errors (str, optional): The error handling strategy for decoding errors, see :func:`io.open`.
            newline (str, optional): The strategy for handling newlines in text mode, see :func:`io.open`.
            total (int, optional): Total number of bytes to read. If none given, os.stat(path).st_size is used.
            task_id (TaskID): Task to track. Default is new task.
            description (str, optional): Description of task, if new task is created.

        Returns:
            BinaryIO: A readable file-like object in binary mode.

        Raises:
            ValueError: When an invalid mode is given.
        r   F)reverse)brr   r   zinvalid mode {!r}r)   r  zaline buffering (buffering=1) isn't supported in binary mode, the default buffer size will be usedr   r   r   r   zcan't have unbuffered text I/ONr  r   )r   Tr  )r   r   r   line_buffering)r]   sortedr  r  warningswarnRuntimeWarningr   st_sizer  rO   ior   r   TextIOWrapper)rF   r   r   r   r   r   r   rq   r@   rp   _moder  r   r   rI   rI   rJ   r     s>   !
c                 C   sZ   | j   | j| }|jdu r|  |_W d   dS W d   dS 1 s&w   Y  dS )zStart a task.

        Starts a task (used when calculating elapsed time). You may need to call this manually,
        if you called ``add_task`` with ``start=False``.

        Args:
            task_id (TaskID): ID of task.
        N)rj  r  re  ru   )rF   r@   r   rI   rI   rJ   
start_taska  s   	

"zProgress.start_taskc                 C   sT   | j  | j| }|  }|jdu r||_||_W d   dS 1 s#w   Y  dS )zStop a task.

        This will freeze the elapsed time on the task.

        Args:
            task_id (TaskID): ID of task.
        N)rj  r  ru   re  rf  )rF   r@   r   r   rI   rI   rJ   	stop_tasko  s   

"zProgress.stop_task)rq   rC   rM   rp   r_  rL   rC   rM   r_  rL   ra  c                K   sH  | j  | j| }	|	j}
|dur||	jkr||	_|	  |dur'|	 j|7  _|dur.||	_|dur5||	_|dur<||	_|	j| |	j|
 }| 	 }|| j
 }|	j}|j}|rk|d j|k rk|  |rk|d j|k s_|dkrw|t|| |	jdur|	j|	jkr|	jdu r|	j|	_W d   n1 sw   Y  |r|   dS dS )a  Update information associated with a task.

        Args:
            task_id (TaskID): Task id (returned by add_task).
            total (float, optional): Updates task.total if not None.
            completed (float, optional): Updates task.completed if not None.
            advance (float, optional): Add a value to task.completed if not None.
            description (str, optional): Change task description if not None.
            visible (bool, optional): Set visible flag if not None.
            refresh (bool): Force a refresh of progress information. Default is False.
            **fields (Any): Additional data fields required for rendering.
        Nr   )rj  r  rC   rq   r}  rp   r_  ra  rO   ru   r  ri  popleftr   appendr]  r  r  rL   )rF   r@   rq   rC   rM   rp   r_  rL   ra  r   completed_startupdate_completedr   old_sample_timeri  r  rI   rI   rJ   rO   ~  sD   




"zProgress.updater   )rU   rq   rC   r_  rp   rU   c          
      K   s   |   }| j8 | j| }	|	  |r|nd|	_|dur||	_||	_|dur)||	_|r.||	_|dur5||	_	d|	_
W d   n1 sBw   Y  |   dS )a  Reset a task so completed is 0 and the clock is reset.

        Args:
            task_id (TaskID): ID of task.
            start (bool, optional): Start the task after reset. Defaults to True.
            total (float, optional): New total steps in task, or None to use current total. Defaults to None.
            completed (int, optional): Number of steps completed. Defaults to 0.
            visible (bool, optional): Enable display of the task. Defaults to True.
            description (str, optional): Change task description if not None. Defaults to None.
            **fields (str): Additional data fields required for rendering.
        N)ru   rj  r  r}  re  rq   rC   r_  ra  rp   r  rL   )
rF   r@   rU   rq   rC   r_  rp   ra  r   r   rI   rI   rJ   reset  s"   
zProgress.resetr)   c           
      C   s*  |   }| j | j| }|j}| j|7  _|j| }|| j }|j}|j}	|r<|d j|k r<|	  |r<|d j|k s0t|dkrK|	  t|dksB|	t
|| |jdurs|j|jkr{|jdu r|j|_|j|_W d   dS W d   dS W d   dS W d   dS 1 sw   Y  dS )zAdvance task by a number of steps.

        Args:
            task_id (TaskID): ID of task.
            advance (float): Number of steps to advance. Default is 1.
        r   r   N)ru   rj  r  rC   r  ri  r  r   r   r  r]  rq   r  r  r   r'  )
rF   r@   rM   r   r   r  r  r  ri  r  rI   rI   rJ   rM     s8   





"zProgress.advancec                 C   s$   | j s| jjr| j  dS dS dS )z*Refresh (render) the progress information.N)r{   r  
is_startedrL   rV   rI   rI   rJ   rL      s   zProgress.refreshc                 C   s   t |   }|S )z*Get a renderable for the progress display.)r-   get_renderables)rF   r   rI   rI   rJ   r    s   zProgress.get_renderablec                 c   s    |  | j}|V  dS )z5Get a number of renderables for the progress display.N)make_tasks_tabler  )rF   tablerI   rI   rJ   r  
  s   
zProgress.get_renderablesr  c                    sR   dd | j D }tj|d| jd}|D ]  jr&|j fdd| j D   q|S )zGet a table to render the Progress display.

        Args:
            tasks (Iterable[Task]): An iterable of Task instances, one per row of the table.

        Returns:
            Table: A table instance.
        c                 s   s0    | ]}t |trtd dn|  V  qdS )Tr  N)r   r   r6   r   copy)rs  _columnrI   rI   rJ   ru    s    

z,Progress.make_tasks_table.<locals>.<genexpr>)r   r)   )paddingr  c                 3   s.    | ]}t |tr|j d n| V  qdS )r  N)r   r   r  )rs  columnr  rI   rJ   ru  %  s    
)r   r7   gridr  r_  add_row)rF   r  table_columnsr  rI   r  rJ   r    s   	

zProgress.make_tasks_tablec                 C   s2   | j  |  W  d   S 1 sw   Y  dS )z+Makes the Progress class itself renderable.N)rj  r  rV   rI   rI   rJ   __rich__0  s   $zProgress.__rich__ro  c           	      K   s   | j 2 t| j|||||| j| j d}|| j| j< |r!| | j | j}tt| jd | _W d   n1 s8w   Y  |   |S )a  Add a new 'task' to the Progress display.

        Args:
            description (str): A description of the task.
            start (bool, optional): Start the task immediately (to calculate elapsed time). If set to False,
                you will need to call `start` manually. Defaults to True.
            total (float, optional): Number of total steps in the progress if known.
                Set to None to render a pulsing animation. Defaults to 100.
            completed (int, optional): Number of steps completed so far. Defaults to 0.
            visible (bool, optional): Enable display of the task. Defaults to True.
            **fields (str): Additional data fields required for rendering.

        Returns:
            TaskID: An ID you can use when calling `update`.
        )r_  ra  r^  rj  r)   N)	rj  r   r  ru   r  r  r:   r   rL   )	rF   rp   rU   rq   rC   r_  ra  r   new_task_indexrI   rI   rJ   r  5  s&   
zProgress.add_taskc                 C   s4   | j  | j|= W d   dS 1 sw   Y  dS )z]Delete a task if it exists.

        Args:
            task_id (TaskID): A task ID.

        N)rj  r  )rF   r@   rI   rI   rJ   remove_task`  s   
"zProgress.remove_taskr`   )rK   r?   )NNrh   rn   rS   r   NNNr   r   NNN)r)   )Tro  r   T);ra   rb   rc   rd   r%   r   r   r   r,   r   re   r~  rE   r(  r"   r  r   rs   r   r   r  r:   r  r   rU   r   rW   r#   rf   r   r_   r   r;   r    r   r   r   r   typingoverloadr   r(   r   r!   r  r  r   rO   r  rM   rL   r/   r  r  r7   r  r  r  r  rI   rI   rI   rJ   r?     s    
	

$





1
*		
		
		


M	

A	

'
!
+r?   __main__)Panel)Rule)Syntax)r7   a~  def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
    """Iterate and generate a tuple with a flag for last value."""
    iter_values = iter(values)
    try:
        previous_value = next(iter_values)
    except StopIteration:
        return
    for value in iter_values:
        yield False, previous_value
        previous_value = value
    yield True, previous_valuepython)line_numbersZfoobarZbaz123z:Text may be printed while the progress bars are rendering.z(In fact, [i]any[/i] renderable will workzSuch as [magenta]tables[/]...zPretty printed structures...ZexamplezPretty printed)typer   z	Syntax...zGive it a try!)cycle)record)rs   rt   z[red]Downloadingr   r  z[green]Processingz[yellow]Thinkingr)  r   g333333?g{Gz?d   )rh   NTNFNri   rj   rk   rl   rm   rn   FTr  r  )r  sysr  r  abcr   r   collectionsr   collections.abcr   dataclassesr   r   datetimer	   r
   r   mathr   r   osr   r   	threadingr   r   r   typesr   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   version_infor(   Zpip._vendor.typing_extensionsr   r*   r+   rs   r,   r-   r.   r/   r  r0   jupyterr1   r  r2   progress_barr3   r   r4   rw   r5   r  r6   r7   r   r8   r9   r   r:   r;   re   r~  r<   r=   r   r   r   r   r   r   r  r   r   r   r   r   r   r   r  r   r   r6  r;  r<  r   r\  r]  r   r?   ra   randomtimepanelr  ruler  syntaxr  r  Zprogress_renderables	itertoolsr  Zexamplesr  r>   r  Ztask1Ztask2Ztask3r   rO   sleeprandintr  r   rI   rI   rI   rJ   <module>   s   P

*	

Fd	

A	
	
	

V*2*I0		1	}    
U


$