403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.9/site-packages/pip/_vendor/rich/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/pip/_vendor/rich/__pycache__/progress.cpython-39.pyc
a

X��e:��@sddlZddlZddlZddlZddlmZmZddlmZddl	m
Z
mZddlm
Z
ddlmZmZddlmZddlmZdd	lmZdd
lmZmZddlmZmZmZddlmZdd
lmZmZm 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/ej0dk�r&ddlm1Z1nddl2m1Z1ddl3m4Z4m5Z5ddl6m7Z7m8Z8m9Z9m:Z:ddl;m<Z<ddl=m>Z>ddl?m@Z@ddlAmBZBddlCmDZDddlEmFZFddlGmHZHmIZIddlJmKZKmLZLe(deM�ZNe.d�ZOe gePfZQe�.de+e�ZRGdd�de�ZSd�e/e*eOe%eOfeTe)ePeUe)e7eUe)e gePfePeFeFeFeFePeUeUe%eOd)�d*d+�ZVGd,d-�d-ee�ZWGd.d/�d/e!eRe$eR�ZXd0d!dd"dd#d$d%d&d'd"d1�eeMeTeUe)e7eUe)e gePfePeFeFeFeFeUe!ed2�d3d4�ZYejZd�dd0d!dd"dd#d$d%d&d'd"d6�e/eTd7e[fe/e1d8e1d9feMe)eTe)eTe)eTe)eMeTeUe)e7eUe)e gePfePeFeFeFeFeUe!e+d:�d;d<��Z\ejZd�dd0d!dd"dd#d$d%d&d'd"d6�e/eTd7e[fe1d=eMe)eTe)eTe)eTe)eMeTeUe)e7eUe)e gePfePeFeFeFeFeUe!ed:�d>d<��Z\d�dd0d!dd"dd#d$d%d&d'd"d6�e/eTd7e[fe/e1d=e1d8e1d9feMe)eTe)eTe)eTe)eMeTeUe)e7eUe)e gePfePeFeFeFeFeUe/e!ee!e+fd:�d?d<�Z\Gd@dA�dAe�Z]GdBdC�dCe]�Z^GdDdE�dEe]�Z_GdFdG�dGe]�Z`GdHdI�dIe]�ZaGdJdK�dKe]�ZbGdLdM�dMe`�ZcGdNdO�dOe]�ZdGdPdQ�dQe]�ZeGdRdS�dSe]�ZfGdTdU�dUe]�ZgGdVdW�dWe]�ZhGdXdY�dYe]�ZiGdZd[�d[e'�Zje
Gd\d]�d]��ZkGd^d_�d_e>�Zlemd`k�r
ddlnZnddloZoddalpmqZqddblrmsZsddcltmuZudddlGmIZIeudedfd!dg�ZteIdhdidj�ZGeG�vdkdldm�dneqdo�dpeGdqdrdsdt�duetesdv�g	ZwddwlxmyZyeyew�Zze7d!dx�Z6ele_�gel�{��eb��Re6d"dy����Z|e|j}dzd{d|�Z~e|j}d}d{d|�Ze|j}d~dd|�Z�e|j��s�e|j�e~dd��e|j�ed�d��eo��d��en��dd��dk�r�e|��e�ez���q�Wd�n1�s0YdS)��N)�ABC�abstractmethod��deque)�	dataclass�field)�	timedelta)�	RawIOBase�UnsupportedOperation)�ceil)�mmap)�length_hint)�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�_IcsjeZdZdZdded��fdd�Zdd�d	d
�Zdd�dd�Zee	e
ee
eedd
�dd�Z�Z
S)�_TrackThreadz)A thread to periodically update progress.�Progressr:)�progress�task_id�
update_periodcs.||_||_||_t�|_d|_t���dS)Nr)r?r@rAr�done�	completed�super�__init__)�selfr?r@rA��	__class__��=/usr/lib/python3.9/site-packages/pip/_vendor/rich/progress.pyrEBsz_TrackThread.__init__N��returncCsd|j}|jj}|j}d}|jj}||�sJ|j}||kr ||||�|}q |jj|j|jdd�dS)NrT)rC�refresh)r@r?�advancerArB�waitrC�update)rFr@rNrAZlast_completedrOrCrIrIrJ�runKsz_TrackThread.runcCs|��|S�N��start�rFrIrIrJ�	__enter__Ysz_TrackThread.__enter__��exc_type�exc_val�exc_tbrLcCs|j��|��dSrR)rB�set�join�rFrXrYrZrIrIrJ�__exit__]s
z_TrackThread.__exit__)�__name__�
__module__�__qualname__�__doc__�floatrErQrVrr#�
BaseExceptionrr^�
__classcell__rIrIrGrJr=?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_speedrLc	cs�|rtd�gng}|�t||	|
|d�t|d�tdd�f�t||||||pLd|
d��}|�(|j||||d�Ed	HWd	�n1s�0Yd	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}�rurvrwrx)rzT)�elapsed_when_finishedrg�rprqrrrsrtry)rornrAN)�
TextColumn�extend�	BarColumn�TaskProgressColumn�TimeRemainingColumnr>�track)rmrnrorprqrrrsrtrurvrwrxrAryrz�columnsr?rIrIrJr�gs4(�����
�r�c@s�eZdZdZd9edeedd�dd�Zdd�d	d
�Ze	e
ee	ee	edd�dd
�Z
ed�dd�Zed�dd�Zeed�dd��Zed�dd�Zed�dd�Zeed�dd��Zeed�dd��Zed�dd�Zed�dd�Zed�d d!�Zd:eed#�d$d%�Zeeee fd&�d'd(�Z!d;eed#�d)d*�Z"d<ee#ed+�d,d-�Z$dd�d.d/�Z%d=eeed1�d2d3�Z&ed�d4d5�Z'e(ed6�d7d8�Z)dS)>�_Readerz9A reader that tracks progress while it's being read from.Tr>N)�handler?�task�close_handlerLcCs"||_||_||_||_d|_dS�NF)r�r?r�r��_closed)rFr�r?r�r�rIrIrJrE�s
z_Reader.__init__rKcCs|j��|SrR)r�rVrUrIrIrJrV�s
z_Reader.__enter__rWcCs|��dSrR)�closer]rIrIrJr^�sz_Reader.__exit__cCs|SrRrIrUrIrIrJ�__iter__�sz_Reader.__iter__cCs$t|j�}|jj|jt|�d�|S�N�rN)�nextr�r?rNr��len)rF�linerIrIrJ�__next__�s
z_Reader.__next__cCs|jSrR)r�rUrIrIrJ�closed�sz_Reader.closedcCs
|j��SrR)r��filenorUrIrIrJr��sz_Reader.filenocCs
|j��SrR)r��isattyrUrIrIrJr��sz_Reader.isattycCs|jjSrR)r��moderUrIrIrJr��sz_Reader.modecCs|jjSrR)r��namerUrIrIrJr��sz_Reader.namecCs
|j��SrR)r��readablerUrIrIrJr��sz_Reader.readablecCs
|j��SrR)r��seekablerUrIrIrJr��sz_Reader.seekablecCsdSr�rIrUrIrIrJ�writable�sz_Reader.writable���)�sizerLcCs&|j�|�}|jj|jt|�d�|Sr�)r��readr?rNr�r�)rFr��blockrIrIrJr��sz_Reader.read)�bcCs"|j�|�}|jj|j|d�|Sr�)r��readintor?rNr�)rFr��nrIrIrJr��sz_Reader.readintocCs&|j�|�}|jj|jt|�d�|Sr�)r��readliner?rNr�r�)rFr�r�rIrIrJr��sz_Reader.readline)�hintrLcCs,|j�|�}|jj|jttt|��d�|Sr�)r��	readlinesr?rNr��sum�mapr�)rFr��linesrIrIrJr��sz_Reader.readlinescCs|jr|j��d|_dS)NT)r�r�r�r�rUrIrIrJr�s
z
_Reader.closer)�offset�whencerLcCs$|j�||�}|jj|j|d�|S)N�rC)r��seekr?rPr�)rFr�r��posrIrIrJr�sz_Reader.seekcCs
|j��SrR)r��tellrUrIrIrJr�
sz_Reader.tell)�srLcCstd��dS)N�write)r
)rFr�rIrIrJr�
sz
_Reader.write)T)r�)r�)r�)r)*r_r`rarbrr:�boolrErVrr#rdrr^r��bytesr��propertyr��intr�r��strr�r�r�r�r�r�r%�	bytearray�
memoryviewrr�r�rr�r�r�r�rr�rIrIrIrJr��sH��

�r�c@sTeZdZdZdedd�dd�Zed�dd	�Zeee	ee	ee
dd
�dd�ZdS)
�_ReadContextzEA utility class to handle a context for both a reader and a progress.r>N)r?�readerrLcCs||_||_dSrR)r?r�)rFr?r�rIrIrJrEsz_ReadContext.__init__rKcCs|j��|j��SrR)r?rTr�rVrUrIrIrJrVs
z_ReadContext.__enter__rWcCs|j��|j�|||�dSrR)r?�stopr�r^r]rIrIrJr^s
z_ReadContext.__exit__)r_r`rarbr<rErVrr#rdrr^rIrIrIrJr�s
�r��
Reading...)rnrprqrrrsrtrurvrwrxry)�filerornrprqrrrsrtrurvrwrxryrLc	Csh|rtd�gng}
|
�t||	|
|d�t�t�f�t|
|||||pDd|d��}|j|||d�}t||�S)aRead 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|rgr~)rorn)rr�r��DownloadColumnr�r>�	wrap_filer�)r�rornrprqrrrsrtrurvrwrxryr�r?r�rIrIrJr�&s0%�����
r�r�)rornrprqrrrsrtrurvrwrxry�
PathLike[str]�rt�r)r�r��	buffering�encoding�errors�newlinerornrprqrrrsrtrurvrwrxryrLcCsdSrRrI�r�r�r�r�r�r�rornrprqrrrsrtrurvrwrxryrIrIrJ�opengsr��rbcCsdSrRrIr�rIrIrJr��sc
Csr|rtd�gng}|�t|
|||d�t�t�f�t|||	|
||pDd|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|rgr~)r�r�r�r�r�rorn)rr�r�r�r�r>r�r�)r�r�r�r�r�r�rornrprqrrrsrtrurvrwrxryr�r?r�rIrIrJr��sB1�����
�
c@sjeZdZUdZdZeeed<deedd�dd�Z	ed�dd	�Z
d
ed�dd
�Ze
d
ed�dd��ZdS)�ProgressColumnz3Base class for a widget to use in progress display.N�max_refresh)�table_columnrLcCs||_i|_d|_dSrR)�
_table_column�_renderable_cacheZ_update_time)rFr�rIrIrJrE�szProgressColumn.__init__rKcCs|jp
t�S)z.Get a table column, used to build tasks table.)r�r6rUrIrIrJ�get_table_column�szProgressColumn.get_table_column�Task�r�rLcCsp|��}|jdurR|jsRz|j|j\}}Wnty>Yn0||j|krR|S|�|�}||f|j|j<|S)aCalled 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)rsr�rCr��id�KeyError�render)rFr��current_time�	timestamp�
renderablerIrIrJ�__call__�s	
zProgressColumn.__call__cCsdS)z"Should return a renderable object.NrI�rFr�rIrIrJr�szProgressColumn.render)N)r_r`rarbr�rrc�__annotations__r6rEr�r/r�rr�rIrIrIrJr��s
r�csDeZdZdZddd�eeed��fdd�Zded	�d
d�Z�Z	S)
�RenderableColumnz�A column to insert an arbitrary column.

    Args:
        renderable (RenderableType, optional): Any renderable. Defaults to empty string.
    �N�r�)r�r�cs||_t�j|d�dS�Nr�)r�rDrE)rFr�r�rGrIrJrE szRenderableColumn.__init__r�r�cCs|jSrR)r�r�rIrIrJr�&szRenderableColumn.render)r�)
r_r`rarbr/rr6rEr�rerIrIrGrJr�s���r�csbeZdZdZdeeeeeee	d��fdd	�
Z
deeeedd
�dd�Zd
ed�dd�Z
�ZS)�
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_nameru�speed�
finished_textr�cs<t|||d�|_t|t�r$t�|�n||_t�j|d�dS)N�rur�r�)	r4�spinner�
isinstancer�r8�from_markupr�rDrE)rFr�rur�r�r�rGrIrJrE4s��zSpinnerColumn.__init__)r��
spinner_styler�rLcCst|||d�|_dS)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)r4r�)rFr�r�r�rIrIrJ�set_spinnerDs
zSpinnerColumn.set_spinnerr�r�cCs |jr|jn|j�|���}|SrR)�finishedr�r�r�rs)rFr��textrIrIrJr�Ss
��zSpinnerColumn.render)r�r�r�r�N)r�r�)r_r`rarbr�rr5rcr9r6rEr�r/r�rerIrIrGrJr�*s,����r�c	sLeZdZdZd
eeeeee	ee
dd��fdd�
Zd	ed
�dd�Z
�ZS)rzA column containing text.�none�leftTN)�text_formatru�justify�markup�highlighterr�rLcs:||_||_||_||_||_t�j|p0tdd�d�dS)NT�Zno_wrapr�)r�r�rur�r�rDrEr6)rFr�rur�r�r�r�rGrIrJrE_s	zTextColumn.__init__r�r�cCsR|jj|d�}|jr*tj||j|jd�}nt||j|jd�}|jrN|j�|�|S�N�r�)rur�)	r��formatr�r8r�rur�r��	highlight)rFr��_textr�rIrIrJr�oszTextColumn.render)r�r�TNN)r_r`rarbr�r5r.r�rr0r6rEr8r�rerIrIrGrJr\s ��rc	sLeZdZdZdeeeeeeeedd��fd	d
�
Zde	d�d
d�Z
�ZS)r�aRenders 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".
    �(rhrirjrkN)�	bar_widthrurvrwrxr�rLcs0||_||_||_||_||_t�j|d�dSr�)r�rurvrwrxrDrE)rFr�rurvrwrxr�rGrIrJrE�s	zBarColumn.__init__r�r�cCs^t|jdurtd|j�ndtd|j�|jdur2dn
td|j�|j|��|j|j|j	|j
d�	S)z&Gets a progress bar widget for a task.Nrr))	rorC�widthZpulseZanimation_timerurvrwrx)r3ro�maxrCr��startedrsrurvrwrxr�rIrIrJr��s
�zBarColumn.render)r�rhrirjrkN)r_r`rarbrr�r5r6rEr3r�rerIrIrGrJr�zs"��r�c@s eZdZdZded�dd�ZdS)�TimeElapsedColumnzRenders time elapsed.r�r�cCsD|jr|jn|j}|dur&tddd�Stt|�d�}tt|�dd�S)zShow time elapsed.N�-:--:--�progress.elapsed�ru)�seconds)r��
finished_time�elapsedr8rr�r�)rFr�rZdeltarIrIrJr��s
zTimeElapsedColumn.renderN�r_r`rarbr8r�rIrIrIrJr��sr�csheZdZdZdeeeeeee	ee
edd	�	�fd
d�
Zeee
ed�d
d��Zded�dd�Z�ZS)r�aShow 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�TNF)	r��text_format_no_percentagerur�r�r�r�rzrLc		s(||_||_t�j||||||d�dS)N)r�rur�r�r�r�)rrzrDrE)	rFr�rrur�r�r�r�rzrGrIrJrE�s�zTaskProgressColumn.__init__)r�rLcCsN|durtddd�St�t|�gd�d�\}}||}t|d�|�d�dd�S)	z�Render the speed in iterations per second.

        Args:
            task (Task): A Task object.

        Returns:
            Text: Text object containing the task speed.
        Nr�zprogress.percentager)r�u×10³u×10⁶u×10⁹u×10¹²��z.1fz it/s)r8r*�pick_unit_and_suffixr�)�clsr��unit�suffix�
data_speedrIrIrJ�render_speed�s
�zTaskProgressColumn.render_speedr�r�cCs�|jdur"|jr"|�|jp|j�S|jdur2|jn|j}|j|d�}|jr`t	j
||j|jd�}nt	||j|jd�}|j
r�|j
�|�|Sr�)rorzr�finished_speedr�rr�r�r�r8r�rur�r�r�)rFr�r�r�r�rIrIrJr��s�zTaskProgressColumn.render)rr�r�r�TNNF)r_r`rarbr�r5r.r�rr0r6rE�classmethodrcr8rr�rerIrIrGrJr��s.��r�csDeZdZdZdZdeeeed��fdd�
Zde	d	�d
d�Z
�ZS)
r�aRenders 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)�compactr}r�cs||_||_t�j|d�dSr�)rr}rDrE)rFrr}r�rGrIrJrEszTimeRemainingColumn.__init__r�r�cCs�|jr|jr|j}d}n
|j}d}|jdur8td|d�S|durVt|jrLdnd|d�Stt|�d�\}}t|d�\}}|jr�|s�|d	�d
|d	��}n|d�d
|d	�d
|d	��}t||d�S)zShow time remaining.rzprogress.remainingNr�rz--:--r�<Z02d�:�d)	r}r�r�time_remainingror8r�divmodr�)rFr�Z	task_timeruZminutesrZhours�	formattedrIrIrJr�s

zTimeRemainingColumn.render)FFN)r_r`rarbr�r�rr6rEr8r�rerIrIrGrJr��s��
r�c@s eZdZdZded�dd�ZdS)�FileSizeColumnzRenders completed filesize.r�r�cCst�t|j��}t|dd�S)�Show data completed.zprogress.filesizer)r*�decimalr�rCr8�rFr��	data_sizerIrIrJr�,szFileSizeColumn.renderNrrIrIrIrJr)src@s eZdZdZded�dd�ZdS)�TotalFileSizeColumnzRenders total filesize.r�r�cCs*|jdurt�t|j��nd}t|dd�S)rNr�zprogress.filesize.totalr)ror*rr�r8rrIrIrJr�5szTotalFileSizeColumn.renderNrrIrIrIrJr2srcs>eZdZdZdeeed��fdd�
Zded�d	d
�Z	�Z
S)�MofNCompleteColumnaHRenders 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�cs||_t�j|d�dSr�)r"rDrE)rFr"r�rGrIrJrEGszMofNCompleteColumn.__init__r�r�cCsPt|j�}|jdurt|j�nd}tt|��}t||�d��|j�|��dd�S)zShow completed/total.N�?r�progress.downloadr)r�rCror�r�r8r")rFr�rCroZtotal_widthrIrIrJr�Ks
�zMofNCompleteColumn.render)r!N)r_r`rarbr�rr6rEr8r�rerIrIrGrJr ;sr cs@eZdZdZdeeedd��fdd�
Zded�d	d
�Z	�Z
S)r�z�Renders 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�rLcs||_t�j|d�dSr�)r%rDrE)rFr%r�rGrIrJrE]szDownloadColumn.__init__r�r�cCs�t|j�}|jdurt|j�n|}|jr@t�|gd�d�\}}nt�|gd�d�\}}|dkrbdnd}||}|d|�d	��}|jdur�t|j�}	|	|}
|
d|�d	��}nd
}|�d|�d|��}t|d
d�}
|
S)z.Calculate common unit for completed and total.N)	r�ZKiBZMiBZGiBZTiBZPiBZEiBZZiBZYiBi)	r�ZkBZMBZGBZTBZPBZEBZZBZYBr	r)rz,.�fr#r!r�r$r)r�rCror%r*r
r8)rFr�rCZ unit_and_suffix_calculation_baserr
Z	precisionZcompleted_ratioZ
completed_strroZtotal_ratioZ	total_strZdownload_statusZ
download_textrIrIrJr�cs2
��
�

zDownloadColumn.render)FN)r_r`rarbr�rr6rEr8r�rerIrIrGrJr�Vs��r�c@s eZdZdZded�dd�ZdS)�TransferSpeedColumnz&Renders human readable transfer speed.r�r�cCs@|jp
|j}|dur tddd�St�t|��}t|�d�dd�S)zShow data transfer speed.Nr#zprogress.data.speedrz/s)rr�r8r*rr�)rFr�r�rrIrIrJr��s
zTransferSpeedColumn.renderNrrIrIrIrJr'�sr'c@s"eZdZUdZeed<eed<dS)�ProgressSamplez$Sample of progress for a given time.r�rCN)r_r`rarbrcr�rIrIrIrJr(�s
r(c@s�eZdZUdZeed<eed<eeed<eed<e	ed<dZ
eeed<d	Zeed
<e
ed�Zeeefed<e
dd
d
d�Zeeed<e
dd
d
d�Zeeed<dZeeed<e
dd�d
d
d�Zeeed<e
d
ed�Zeed<ed�dd�Zeed�dd��Zeeed�dd��Zeeed�dd ��Zeed�d!d"��Zeed�d#d$��Z eeed�d%d&��Z!eeed�d'd(��Z"dd�d)d*�Z#dS)+r�z�Information regarding a progress task.

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

    r�rnrorC�	_get_timeNrT�visible)�default_factory�fieldsF)�default�init�repr�
start_time�	stop_timercCs
tdd�S)Nr	)�maxlenrrIrIrIrJ�<lambda>��z
Task.<lambda>)r+r.r/�	_progress)r/r+�_lockrKcCs|��S)z(float: Get the current time, in seconds.)r)rUrIrIrJrs�sz
Task.get_timecCs
|jduS)z#bool: Check if the task as started.N)r0rUrIrIrJr��szTask.startedcCs|jdurdS|j|jS)zPOptional[float]: Get the number of steps remaining, if a non-None total was set.N)rorCrUrIrIrJ�	remaining�s
zTask.remainingcCs2|jdurdS|jdur$|j|jS|��|jS)z]Optional[float]: Time elapsed since task was started, or ``None`` if the task hasn't started.N)r0r1rsrUrIrIrJr�s


zTask.elapsedcCs
|jduS)zCheck if the task has finished.N)rrUrIrIrJr��sz
Task.finishedcCs.|js
dS|j|jd}tdtd|��}|S)zOfloat: Get progress of task as a percentage. If a None total was set, returns 0��Y@)rorC�minr�)rFrCrIrIrJ�
percentage�s
zTask.percentagecCs�|jdurdS|j��|j}|s0Wd�dS|dj|dj}|dkr\Wd�dSt|�}t|�tdd�|D��}||}|Wd�S1s�0YdS)z=Optional[float]: Get the estimated speed in steps per second.Nr�rcss|]}|jVqdSrRr�)�.0ZsamplerIrIrJ�	<genexpr>r4zTask.speed.<locals>.<genexpr>)r0r6r5r��iterr�r�)rFr?Z
total_timeZ
iter_progressZtotal_completedr�rIrIrJr��s
z
Task.speedcCs:|jr
dS|j}|sdS|j}|dur*dSt||�}|S)zJOptional[float]: Get estimated time to completion, or ``None`` if no data.r8N)r�r�r7r)rFr�r7ZestimaterIrIrJrszTask.time_remainingcCs|j��d|_d|_dS)zReset progress.N)r5�clearrrrUrIrIrJ�_resets
zTask._reset)$r_r`rarbr:r�r�rrc�GetTimeCallablerr*r�r�dictr,rrr0r1rr5rr(rr6rsr�r�r7rr�r;r�rr@rIrIrIrJr��s@

�
r�c@s�eZdZdZddddddddddd�
eeefeee	e
e
e	e	e	eee	e	dd�d	d
�Ze
eedfd�d
d��Zeed�dd��Zeeed�dd��Zeeed�dd��Zee	d�dd��Zdd�dd�Zdd�dd�Zdd�dd�Zeeeeeeedd�dd�ZdXeee e!e fee
eeee
ee d"�d#d$�Z"dYdd%d&�e#ee$eeee#d'�d(d)�Z%e&j'dZddd%d+�eed,e(fe)d-e$eeeeeeee$eeee#d.�
d/d0��Z*e&j'd[ddd%d+�eed,e(fee)d1e)d2fe$eeeeeeee$eeee+d.�
d3d0��Z*d\ddd%d+�eed,e(fee)d-e)d2e)d1fe$eeeeeeee$eeeee#e+fd.�
d4d0�Z*edd5�d6d7�Z,edd5�d8d9�Z-ddddddd:�eee
ee
ee
eeee	e	e.dd;�	d<d=�Z/ddd>ddd?�ee	ee
e$ee	eee.dd@�dAdB�Z0d]ee
ddD�dEdF�Z1dd�dGdH�Z2e3d�dIdJ�Z4ee3d�dKdL�Z5eee6dM�dNdO�Z7e3d�dPdQ�Z8d^ee	ee
e$e	e.edS�dTdU�Z9edd5�dVdW�Z:dS)_r>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.
    NTrgg>@F)
rqrprt�speed_estimate_periodrr�redirect_stdout�redirect_stderrrsry�expand)r�rqrprtrCrrrDrErsryrFrLc
	Gs�|dksJd��t�|_|p"|��|_||_|	|_|
|_i|_td�|_	t
|pRt�||||||jd�|_
|pr|jj|_|jj|_|jj|_dS)Nrzrefresh_per_second must be > 0)rqrprtrrrDrE�get_renderable)rr6�get_default_columnsr�rCryrF�_tasksr:�_task_indexr2r+rG�liverqrs�print�log)rFrqrprtrCrrrDrErsryrFr�rIrIrJrE*s(
�	
zProgress.__init__.rKcCstd�t�t�t�fS)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{)rr�r�r�)rrIrIrJrHNs
�zProgress.get_default_columnscCs|jjSrR)rKrqrUrIrIrJrqmszProgress.consolecCs8|j�t|j���Wd�S1s*0YdS)zGet a list of Task instances.N)r6�listrI�valuesrUrIrIrJ�tasksqszProgress.taskscCs8|j�t|j���Wd�S1s*0YdS)zA list of task IDs.N)r6rNrI�keysrUrIrIrJ�task_idswszProgress.task_idscCsX|j�>|jsWd�dStdd�|j��D��Wd�S1sJ0YdS)z'Check if all tasks have been completed.NTcss|]}|jVqdSrR)r�)r<r�rIrIrJr=�r4z$Progress.finished.<locals>.<genexpr>)r6rI�allrOrUrIrIrJr�}szProgress.finishedcCs|js|jjdd�dS)zStart the progress display.T)rMN)ryrKrTrUrIrIrJrT�szProgress.startcCs |j��|jjs|j��dS)zStop the progress display.N)rKr�rqZis_interactiverLrUrIrIrJr��s
z
Progress.stopcCs|��|SrRrSrUrIrIrJrV�szProgress.__enter__rWcCs|��dSrR)r�r]rIrIrJr^�szProgress.__exit__rfrl)rmror@rnrArLc
cs�|durtt|��pd}|dur0|j||d�}n|j||d�|jjr�t|||��.}|D]}|V|jd7_qXWd�q�1s�0Yn,|j}|j	}	|D]}|V||d�|	�q�dS)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�ror))
rcr
�add_taskrPrKrpr=rCrNrM)
rFrmror@rnrAZtrack_thread�valuerNrMrIrIrJr��s 0
zProgress.trackr�)r@rn)r�ror@rnrLcCs�d}|dur|}n:|durL|j�|j|j}Wd�n1sB0Y|dur\td��|durt|j||d�}n|j||d�t|||dd�S)ajTrack 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'rTF�r�)r6rIro�
ValueErrorrUrPr�)rFr�ror@rnZtotal_bytesrIrIrJr��s*�zProgress.wrap_filer�)ror@rnr�r�)
r�r�r�r�r�r�ror@rnrLc
CsdSrRrI�
rFr�r�r�r�r�r�ror@rnrIrIrJr��sz
Progress.openr�r�c
CsdSrRrIrYrIrIrJr��scCs�d�t|dd��}
|
dvr(td�|���|dk}|
dkrR|dkrRt�dt�d	}n&|
d
vrx|dkrltd��n|dkrxd	}|d
ur�t|�j}|d
ur�|j	|	|d�}n|j
||d�tj|d|d�}t
|||dd�}
|dvr�tj|
||||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�zinvalid mode {!r}r)r[zaline buffering (buffering=1) isn't supported in binary mode, the default buffer size will be usedr�)r�r�rzcan't have unbuffered text I/ONrTr�)r�TrW)r�r�)r�r�r��line_buffering)r\�sortedrXr��warnings�warn�RuntimeWarningr�st_sizerUrP�ior�r��
TextIOWrapper)rFr�r�r�r�r�r�ror@rn�_moder\r�r�rIrIrJr�s>!�

�)r@rLcCsH|j�.|j|}|jdur&|��|_Wd�n1s:0YdS)z�Start 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)r6rIr0rs)rFr@r�rIrIrJ�
start_task\s	

zProgress.start_taskcCsR|j�8|j|}|��}|jdur*||_||_Wd�n1sD0YdS)z�Stop a task.

        This will freeze the elapsed time on the task.

        Args:
            task_id (TaskID): ID of task.
        N)r6rIrsr0r1)rFr@r�r�rIrIrJ�	stop_taskjs

zProgress.stop_task)rorCrNrnr*rM)	r@rorCrNrnr*rMr,rLcKs@|j��|j|}	|	j}
|dur:||	jkr:||	_|	��|durP|	j|7_|dur^||	_|durl||	_|durz||	_|	j�|�|	j|
}|�	�}||j
}
|	j}|j}|r�|dj
|
kr�|�q�|dkr�|�t||��|	jdu�r|	j|	jk�r|	jdu�r|	j|	_Wd�n1�s$0Y|�r<|��dS)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)r6rIrCror@rnr*r,rPrsrCr5�popleftr��appendr(rrrM)rFr@rorCrNrnr*rMr,r��completed_start�update_completedr��old_sample_timer5rgrIrIrJrPysB



�
��(zProgress.updater)rTrorCr*rn)r@rTrorCr*rnr,rLc
Ks�|��}|j�p|j|}	|	��|r*|nd|	_|dur>||	_||	_|durR||	_|r\||	_|durj||	_	d|	_
Wd�n1s�0Y|��dS)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)rsr6rIr@r0rorCr*r,rnrrM)
rFr@rTrorCr*rnr,r�r�rIrIrJ�reset�s 
$zProgress.resetr))r@rNrLc
Cs�|��}|j��|j|}|j}|j|7_|j|}||j}|j}|j}	|rh|dj|krh|	�qNt|�dkr||	�qh|�	t
||��|jdur�|j|jkr�|jdur�|j
|_|j|_Wd�n1s�0YdS)z�Advance task by a number of steps.

        Args:
            task_id (TaskID): ID of task.
            advance (float): Number of steps to advance. Default is 1.
        rr	N)rsr6rIrCrCr5rgr�r�rhr(rorrr�r)
rFr@rNr�r�rirjrkr5rgrIrIrJrN�s,


�
��zProgress.advancecCs|js|jjr|j��dS)z*Refresh (render) the progress information.N)ryrKZ
is_startedrMrUrIrIrJrM�szProgress.refreshcCst|���}|S)z*Get a renderable for the progress display.)r-�get_renderables)rFr�rIrIrJrGszProgress.get_renderableccs|�|j�}|VdS)z5Get a number of renderables for the progress display.N)�make_tasks_tablerP)rF�tablerIrIrJrmszProgress.get_renderables)rPrLcsRdd�|jD�}tj|d|jd��}|D]$��jr(|j�fdd�|jD��q(|S)z�Get 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.
        css.|]&}t|t�rtdd�n
|����VqdS)Tr�N)r�r�r6r��copy)r<Z_columnrIrIrJr=s��z,Progress.make_tasks_table.<locals>.<genexpr>)rr))ZpaddingrFc3s,|]$}t|t�r|j�d�n|��VqdS)r�N)r�r�r�)r<�columnr�rIrJr= s��)r�r7ZgridrFr*�add_row)rFrPZ
table_columnsrorIr�rJrn
s	�
��
zProgress.make_tasks_tablecCs2|j�|��Wd�S1s$0YdS)z+Makes the Progress class itself renderable.N)r6rGrUrIrIrJ�__rich__+szProgress.__rich__r9)rnrTrorCr*r,rLc	Ks�|j�dt|j||||||j|jd�}||j|j<|rB|�|j�|j}tt|j�d�|_Wd�n1sp0Y|��|S)aAdd 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*r,r)r6r)N)	r6r�rJrsrIrer:r�rM)	rFrnrTrorCr*r,r�Znew_task_indexrIrIrJrU0s$�
2zProgress.add_taskcCs2|j�|j|=Wd�n1s$0YdS)z]Delete a task if it exists.

        Args:
            task_id (TaskID): A task ID.

        N)r6rI)rFr@rIrIrJ�remove_task[szProgress.remove_task)NNrfrl)N)r�NNN)r�NNN)r�r�NNN)r))Tr9rT);r_r`rarbr%r�r�rr,r�rcrArErr"rHr�rqrr�rPr:rRr�rTr�rVr#rdrr^rr;r r�rr�r��typing�overloadr�r(r�r!rerfrrPrlrNrMr/rGrmr7rnrsrUrtrIrIrIrJr>sn�
�$
���,���*�	���	���	�
�M��A��'!��+r>�__main__)�Panel)�Rule)�Syntax)r7a~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_valueZpython)Zline_numbersZfooZbarZbaz�1�2�3z:Text may be printed while the progress bars are rendering.z(In fact, [i]any[/i] renderable will workzSuch as [magenta]tables[/]...zPretty printed structures...ZexamplezPretty printed)�typer�z	Syntax...zGive it a try!)�cycle)�record)rqrrz[red]Downloadingr	rTz[green]Processingz[yellow]Thinkingrr�g333333�?g{�G�z�?�d)rfNTNFNrgrhrirjrkrlFT)r�NNN)r�NNN)r�r�NNN)�rb�sysrur^�abcrr�collectionsrZdataclassesrrZdatetimerr	r
Zmathrr�operatorr
�osrr�	threadingrrr�typesrrrrrrrrrrrrrr r!r"r#r$r%�version_infor(Zpip._vendor.typing_extensionsr�r*r+rqr,r-r.r/r�r0Zjupyterr1rKr2Zprogress_barr3r�r4rur5ror6r7r�r8r9r�r:r;rcrAr<r=r�r�r�r�r�r�rvr�r�r�r�r�rr�r�r�r�rrr r�r'r(r�r>r_Zrandom�timeZpanelrxZruleryZsyntaxrzrrZprogress_renderables�	itertoolsrZexamplesrHr?rUZtask1Ztask2Ztask3r�rP�sleepZrandintrMr�rIrIrIrJ�<module>s.P
*��Fd��A���������V*2*I0		1	}P
��
����


Youez - 2016 - github.com/yon3zu
LinuXploit