Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
progress.cpython-313.pyc617 linesDownload Raw Back to __pycache__
1�

2�j����@	�SSKJr SSKrSSKrSSKrSSKJrJr SSKJ	r	 SSK3JrJr SSK
Jr SSKJrJr SSKJr SS	KJr SS4KJr SSKJrJr SSKJrJrJr SS
KJr SSKJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1 \(aSSK2J3r3 SSK4J5r5J6r6 SSK7J8r8J9r9J:r:J;r; SSK<J=r= SSK>J?r? SSK@JArA SSKBJCrC SSKDJErE SSKFJGrG SSKHJIrIJJrJ SSKKJLrLJMrM \+"S\N5rO\0"S5rP\"/\Q4rR\R`"S\-\!5rS"SS\5rTSwSxS'jjrU"S(S)\\!5rV"S*S+\#\S\&\S5rWS,S SS!SS"S#S$S%S&S!S-.SyS.jjrX\R�SzSS,S SS!SS"S#S$S%S&S!S/.S{S0jjj5rZ\R�SzSS,S SS!SS"S#S$S%S&S!S/.S|S1jjj5rZS}SS,S SS!SS"S#S$S%S&S!S/.S~S2jjjrZ"S3S4\5r["S5S6\[5r\"S7S8\[5r]"S9S:\[5r^"S;S<\[5r_"S=S>\[5r`"S?S@\^5ra"SASB\[5rb"SCSD\[5rc"SESF\[5rd"SGSH\[5re"SISJ\[5rf"SKSL\[5rg"SMSN\*5rh\"SOSP55ri"SQSR\?5rj\kSS:XGa]SSKlrlSSKmrmSSTKnJoro SSUKpJqrq SSVKrJsrs SSWKHJJrJ \s"SXSYS SZ9rr\J"S[S\S]5rH\HR�S^S_S`5 Sa\o"Sb5Sc\HSdSeSfSg.Sh\r\q"Si5/	ruSSjKvJwrw \w"\u5rx\8"S Sk9r7\j"\]"5/\jR�5Q\`"5P7\7S!Sl.6rz\zR�SmSnSo9r|\zR�SpSnSo9r}\zR�SqSSo9r~\zR�(dx\zGR\|SrSs9 \zGR\}StSs9 \mGR"Su5 \lGR"SSv5S:a\zGR\�"\x55 \zR�(dMxSSS5 gg!,(df   g=f)�)�annotationsN)�ABC�abstractmethod��deque)�	dataclass�field)�	timedelta)�	RawIOBase�UnsupportedOperation)�ceil)�mmap)�length_hint)�PathLike�stat)�Event�RLock�Thread)�
TracebackType)�
TYPE_CHECKING�Any�BinaryIO�Callable�ContextManager�Deque�Dict�Generic�Iterable�List�Literal�5NamedTuple�NewType�Optional�TextIO�Tuple�Type�TypeVar�Union)�Self�)�filesize�get_console)�Console�Group�
JustifyMethod�RenderableType)�Highlighter)�JupyterMixin)�Live)�ProgressBar)�Spinner)�	StyleType)�Column�Table)�Text�TextType�TaskID�ProgressType�_Ic�^^�\rSrSrSrSU4SjjrS	SjrS6SjrSSjrSr	U=r7$)�_TrackThread�@z)A thread to periodically update progress.c�p>�XlX lX0l[5UlSUl[TU]SS9 g)NrT)�daemon)�progress�task_id�
update_periodr�done�	completed�super�__init__)�selfrCrDrE�	__class__s    ��SD:\code\apps\devtools\python\user_packages\Python313\site-packages\rich/progress.pyrI�_TrackThread.__init__Cs3��� �
���*���G��	����
�����%�c���URnURRnURnSnURR8nU"U5(dwURRR(aRURnXF:wa
U"XU-95 UnU"U5(d'URRR(aMRURRURURSS9 g)NrT)rG�refresh)10rDrC�advancerErF�wait�live�11is_startedrG�update)rJrDrQrE�last_completedrRrGs       rL�run�_TrackThread.runLs����,�,���-�-�'�'���*�*�
����y�y�~�~���}�%�%�$�-�-�*<�*<�*G�*G����I��*���^�!;�<�!*��	�}�%�%�$�-�-�*<�*<�*G�*G�*G�	
�
�
���T�\�\�T�^�^�T��RrNc�&�UR5 U$�N��start�rJs rL�	__enter__�_TrackThread.__enter__Z����12�13���rNc�X�URR5 UR5 grZ)rF�set�join�rJ�exc_type�exc_val�exc_tbs    rL�__exit__�_TrackThread.__exit__^s��	
�	�	�
�
���	�	�rN)rGrFrCrDrE)rC�14'Progress'rDz'TaskID'rE�float��return�None)rmz'_TrackThread'�rezOptional[Type[BaseException]]rfzOptional[BaseException]rgzOptional[TracebackType]rmrn)�__name__�15__module__�__qualname__�__firstlineno__�__doc__rIrWr^rh�__static_attributes__�
__classcell__�rKs@rLr?r?@sF���3�&�S���/��)��(�	�1617��rNr?TF�18�bar.back�bar.complete�bar.finished�	bar.pulsec19#�2# �U(a[S5/O/nUR[U	U20UUS9[US9[	SS945 [UUUUUU=(d SUS.6nU UR
UUUUU
S9S	hv�N S	S	S	5 g	N
!,(df   g	=f7f)21aUTrack progress by iterating over a sequence.22 23You can also track progress of an iterable, which might require that you additionally specify ``total``.24 25Args:26    sequence (Iterable[ProgressType]): Values you wish to iterate over and track progress.27    description (str, optional): Description of task show next to progress bar. Defaults to "Working".28    total: (float, optional): Total number of steps. Default is len(sequence).29    completed (int, optional): Number of steps completed so far. Defaults to 0.30    auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.31    transient: (bool, optional): Clear the progress on exit. Defaults to False.32    console (Console, optional): Console to write to. Default creates internal Console instance.33    refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.34    style (StyleType, optional): Style for the bar background. Defaults to "bar.back".35    complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".36    finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".37    pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".38    update_period (float, optional): Minimum time (in seconds) between calls to update(). Defaults to 0.1.39    disable (bool, optional): Disable display of progress.40    show_speed (bool, optional): Show speed if total isn't known. Defaults to True.41Returns:42    Iterable[ProgressType]: An iterable of the values in the sequence.43 44�([progress.description]{task.description}��style�complete_style�finished_style�pulse_style)�45show_speedT)�elapsed_when_finishedrx��auto_refresh�console�	transient�get_time�refresh_per_second�disable)�totalrG�descriptionrEN)�46TextColumn�extend�	BarColumn�TaskProgressColumn�TimeRemainingColumn�Progress�track)�sequencer�r�rGr�r�r�r�r�r�r�r�r�rEr�r��columnsrCs                  rLr�r�hs����XEP��>�	?�@�UW���N�N���-�-�'�	
�
�*�5��d�;�		47���	�!����-�3����H�48��>�>����#�'�"�49�	50�	51�52��	53�54��s0�AB�B�6B�7B�;	B�B�55B�Bc�J�\rSrSrSrSSSjjrSSjrSSjrSSjrS Sjr	\56S!Sj5rS"S	jrS!S57jr
\58S#Sj5r\59S#Sj5rS!S
jrS!SjrS!SjrS$S%SjjrS&SjrS$S%SjjrS$S'SjjrS(SjrS)S*SjjrS"SjrS+SjrS,SjrSrg)-�_Reader�z9A reader that tracks progress while it's being read from.c�B�XlX lX0lX@lSUlg�NF)�handlerC�task�close_handle�_closed)rJr�rCr�r�s     rLrI�_Reader.__init__�s ���� �
��	�(����rNc�:�URR5 U$rZ)r�r^r]s rLr^�_Reader.__enter__�s���������rNc�$�UR5 grZ)�closerds    rLrh�_Reader.__exit__�s
��	
�60�61�rNc��U$rZ�r]s rL�__iter__�_Reader.__iter__�s���rNc��[UR5nURRUR[U5S9 U$�N�rQ)�nextr�rCrQr��len)rJ�lines  rL�__next__�_Reader.__next__�s4���D�K�K� ���
�
���d�i�i��T���;��rNc��UR$rZ)r�r]s rL�closed�_Reader.closed�s���|�|�rNc�6�URR5$rZ)r��filenor]s rLr��_Reader.fileno�����{�{�!�!�#�#rNc�6�URR5$rZ)r��isattyr]s rLr��_Reader.isatty�r�rNc�.�URR$rZ)r��moder]s rLr��_Reader.mode�����{�{���rNc�.�URR$rZ)r��namer]s rLr��_Reader.name�r�rNc�6�URR5$rZ)r��readabler]s rLr��_Reader.readable�����{�{�#�#�%�%rNc�6�URR5$rZ)r��seekabler]s rLr��_Reader.seekable�r�rNc��gr�r�r]s rL�writable�_Reader.writable�s��rNc��URRU5nURRUR[U5S9 U$r�)r��readrCrQr�r�)rJ�size�blocks   rLr��_Reader.read�s:����� � ��&���
�
���d�i�i��U���<��rNc��URRU5nURRURUS9 U$r�)r��readintorCrQr�)rJ�b�ns   rLr��_Reader.readinto�s6���K�K� � ��#���
�
���d�i�i���3��rNc��URRU5nURRUR[U5S9 U$r�)r��readlinerCrQr�r�)rJr�r�s   rLr��_Reader.readline�s:���{�{�#�#�D�)���
�
���d�i�i��T���;��rNc	��URRU5nURRUR[[
[U55S9 U$r�)r��	readlinesrCrQr��sum�mapr�)rJ�hint�liness   rLr��_Reader.readlinessA�����%�%�d�+���
�
���d�i�i��S��e�_�1E��F��rNc�h�UR(aURR5 SUlg)NT)r�r�r�r�r]s rLr��
_Reader.close	s"������K�K������rNc��URRX5nURRURUS9 U$)N�rG)r��seekrCrUr�)rJ�offset�whence�poss    rLr��_Reader.seeks6���k�k���v�.���
�
���T�Y�Y�#��6��62rNc�6�URR5$rZ)r��tellr]s rLr��_Reader.tells���{�{���!�!rNc��[S5e)N�write�r)rJ�ss  rLr��
_Reader.writes
��"�7�+�+rNc��[S5e)N�63writelinesr�)rJr�s  rLr��_Reader.writeliness
��"�<�0�0rN)r�r�r�rCr�N)T)64r�rrCrjr�r;r��boolrmrn)rmz	'_Reader'ro)rmr)rm�bytes�rmr�)rm�int)rm�str)�����)r�r�rmr�)r�z"Union[bytearray, memoryview, mmap])r�r�rmzList[bytes]rl)r)r�r�r�r�rmr�)r�rrmr�)r�z
Iterable[Any]rmrn)rprqrrrsrtrIr^rhr�r��propertyr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rur�rNrLr�r��s���C�"�������	�65��66�
���/��)��(�	�6768����69����$�$�� �� �� �� �&�&���70�71�72�73�74�75"�,�1rNr�c�F�\rSrSrSrSSjrS	SjrS76SjrSrg)�_ReadContextizEA utility class to handle a context for both a reader and a progress.c��XlX lgrZ�rC�reader)rJrCrs   rLrI�_ReadContext.__init__ s�� �
� �rNc�j�URR5 URR5$rZ)rCr\rr^r]s rLr^�_ReadContext.__enter__$s%���
�
�����{�{�$�$�&�&rNc�p�URR5 URRXU5 grZ)rC�stoprrhrds    rLrh�_ReadContext.__exit__(s(��	
�
�
���������X��7rNrN)rCrjrr=rmrn)rmr=ro)	rprqrrrsrtrIr^rhrur�rNrLr�r�s:��O�!�'�8�/�8�)�8�(�	8�7778�8rNr��79Reading...)r�r�r�r�r�r�r�r�r�r�r�c80���U(a[S5/O/n
U
R[UU	U81US9[5[	545 [U
UUUUU=(d SUS.6nUR
XUS9n[X�5$)a�Read bytes from a file while tracking progress.82 83Args:84    file (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.85    total (int): Total number of bytes to read.86    description (str, optional): Description of task show next to progress bar. Defaults to "Reading".87    auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.88    transient: (bool, optional): Clear the progress on exit. Defaults to False.89    console (Console, optional): Console to write to. Default creates internal Console instance.90    refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.91    style (StyleType, optional): Style for the bar background. Defaults to "bar.back".92    complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".93    finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".94    pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".95    disable (bool, optional): Disable display of progress.96Returns:97    ContextManager[BinaryIO]: A context manager yielding a progress reader.98 99r~rrxr�)r�r�)r�r�r��DownloadColumnr�r��	wrap_filer�)�filer�r�r�r�r�r�r�r�r�r�r�r�r�rCrs                rLrr2s���JEP��>�	?�@�UW���N�N���-�-�'�	
�
���!�		100���	�!����-�3����H��
�
��{�
�
K�F���)�)rN)r�r�r�r�r�r�r�r�r�r�r�r�c��grZr��rr��	buffering�encoding�errors�newliner�r�r�r�r�r�r�r�r�r�r�r�s                  rL�openrs���,	rNc��grZr�rs                  rLrr�rrNc���U(a[S5/O/nUR[U
UUUS9[5[	545 [UUU	U101UU=(d SUS.6nUR
UUUUUUUUS9n[UU5$)aVRead bytes from a file while tracking progress.102 103Args:104    path (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.105    mode (str): The mode to use to open the file. Only supports "r", "rb" or "rt".106    buffering (int): The buffering strategy to use, see :func:`io.open`.107    encoding (str, optional): The encoding to use when reading in text mode, see :func:`io.open`.108    errors (str, optional): The error handling strategy for decoding errors, see :func:`io.open`.109    newline (str, optional): The strategy for handling newlines in text mode, see :func:`io.open`110    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.111    description (str, optional): Description of task show next to progress bar. Defaults to "Reading".112    auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.113    transient: (bool, optional): Clear the progress on exit. Defaults to False.114    console (Console, optional): Console to write to. Default creates internal Console instance.115    refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.116    style (StyleType, optional): Style for the bar background. Defaults to "bar.back".117    complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".118    finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".119    pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".120    disable (bool, optional): Disable display of progress.121    encoding (str, optional): The encoding to use when reading in text mode.122 123Returns:124    ContextManager[BinaryIO]: A context manager yielding a progress reader.125 126r~rrxr�)r�rrrrr�r�)r�r�r�r127r�r�rr�)rr�rrrrr�r�r�r�r�r�r�r�r�r�r�r�r�rCrs                     rLrr�s���bEP��>�	?�@�UW���N�N���-�-�'�	
�
���!�		128���	�!����-�3����H��]�]��
��������	�F���&�)�)rNc�^�\rSrSr%SrSrS\S'SSSjjrS
SjrSSjr	\129SS	j5rS130rg)�ProgressColumni�z3Base class for a widget to use in progress display.N�Optional[float]�max_refreshc�,�Xl0UlSUlgrZ)�
_table_column�_renderable_cache�_update_time)rJ�table_columns  rLrI�ProgressColumn.__init__s��)��MO���-1��rNc�<�UR=(d131 [5$)z.Get a table column, used to build tasks table.)rr7r]s rL�get_table_column�ProgressColumn.get_table_columns���!�!�-�V�X�-rNc�:�UR5nURbBUR(d1URURup4X0R-U:�aU$UR
U5nX$4URUR'U$![132a N9f=f)z�Called by the Progress object to return a renderable for the given task.133 134Args:135    task (Task): An object containing information regarding the task.136 137Returns:138    RenderableType: Anything renderable (including str).139)r�rrGr�id�KeyError�render)rJr��current_time�	timestamp�140renderables     rL�__call__�ProgressColumn.__call__	s����}�}������'����
&�(,�(>�(>�t�w�w�(G�%�	��/�/�/�,�>�%�%�?��[�[��&�141�+7�*D����t�w�w�'�����
��
�s�B
�
142B�Bc��g)z"Should return a renderable object.Nr��rJr�s  rLr'�ProgressColumn.render s�rN)rrrrZ)r�Optional[Column]rmrn)rmr7�r��'Task'rmr0)
rprqrrrsrtr�__annotations__rIr"r+rr'rur�rNrLrr�s2��=�#'�K��'�2�143.��.�1��1rNrc�N^�\rSrSrSrSSS.S	U4SjjjjrS144SjrSrU=r$)�RenderableColumni%z�A column to insert an arbitrary column.145 146Args:147    renderable (RenderableType, optional): Any renderable. Defaults to empty string.148N�rc�,>�Xl[TU]	US9 g�Nr6)r*rHrI)rJr*rrKs   �rLrI�RenderableColumn.__init__,s���%��
���l��3rNc��UR$rZ�r*r.s  rLr'�RenderableColumn.render2s�����rNr;)�)r*r0rr0r1�	rprqrrrsrtrIr'rurvrws@rLr5r5%s9����,.�4�SW�4�(�4�@P�4�4��rNr5c�z^�\rSrSrSrSSU4SjjjrS	S149SjjrSSjrSrU=r	$)�
SpinnerColumni6aqA column with a 'spinner' animation.150 151Args:152    spinner_name (str, optional): Name of spinner animation. Defaults to "dots".153    style (StyleType, optional): Style of spinner. Defaults to "progress.spinner".154    speed (float, optional): Speed factor of spinner. Defaults to 1.0.155    finished_text (TextType, optional): Text used when task is finished. Defaults to " ".156c�>�[XUS9Ul[U[5(a[R157"U5OUUl[TU]!US9 g)N�r��speedr6)	r5�spinner�158isinstancer�r9�from_markup�
finished_textrHrI)rJ�spinner_namer�rCrGrrKs      �rLrI�SpinnerColumn.__init__@sO����|��F����-��-�-�
���]�+��	
��159	���l��3rNc�"�[XUS9Ulg)aSet a new spinner.160 161Args:162    spinner_name (str): Spinner name, see python -m rich.spinner.163    spinner_style (Optional[StyleType], optional): Spinner style. Defaults to "progress.spinner".164    speed (float, optional): Speed factor of spinner. Defaults to 1.0.165rBN)r5rD)rJrH�
spinner_stylerCs    rL�set_spinner�SpinnerColumn.set_spinnerPs���|��N��rNc��UR(aURnU$URRUR	55nU$rZ)�finishedrGrDr'r�)rJr��texts   rLr'�SpinnerColumn.render_sH���}�}�
���	
�166�����$�$�T�]�]�_�5�	
�167�rN)rGrD)�dots�progress.spinner��?� N)168rHr�r��Optional[StyleType]rCrkrGr:rr0)rSrT)rHr�rKrVrCrkrmrnr1)169rprqrrrsrtrIrLr'rurvrws@rLr@r@6s�����#�%7��"%�)-�
4��4�#�4��	4�170 �4�'�
4�4�&.@��	
O��
O�+�
O��	
O�171172�
O��rNr@c�b^�\rSrSrSrSSU4SjjjrSSjrSrU=r$)	r�ihzA column containing text.c�|>�XlX0lX lX@lXPl[173TU]U=(d	 [SS9S9 g)NT��no_wrapr6)�text_format�justifyr��markup�highlighterrHrIr7)rJr[r�r\r]r^rrKs       �rLrI�TextColumn.__init__ks:���'��&-���174���&��
���l�&J�f�T�6J��KrNc�B�URRUS9nUR(a*[R"X R175URS9nO[X R176URS9nUR(aURRU5 U$�N�r�)r�r\)	r[�formatr]r9rFr�r\r^�	highlight)rJr��_textrPs    rLr'�TextColumn.render{sr��� � �'�'�T�'�2���;�;��#�#�E���T�\�\�R�D���Z�Z����F�D�������&�&�t�,��rN)r^r\r]r�r[)�none�leftTNN)r[r�r�r6r\r/r]r�r^�Optional[Highlighter]rr0rmrn�r�r2rmr9r>rws@rLr�r�hsx���#�177"�!'��-1�)-�L��L��L��	L�178�L�+�
L�'�L�179�L�L� �rNr�c�d^�\rSrSrSrSSU4SjjjrSSjrSrU=r$)	r�i�a�Renders a visual progress bar.180 181Args:182    bar_width (Optional[int], optional): Width of bar or None for full width. Defaults to 40.183    style (StyleType, optional): Style for the bar background. Defaults to "bar.back".184    complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".185    finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".186    pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".187c�\>�XlX lX0lX@lXPl[188TU]US9 gr8)�	bar_widthr�r�r�r�rHrI)rJrmr�r�r�r�rrKs       �rLrI�BarColumn.__init__�s1���#���189�,��,��&��
���l��3rNc�b�[URb[SUR5OS[SUR5URcSO[SUR5UR190(+UR
5URURURURS9	$)z&Gets a progress bar widget for a task.Nrr*)	r�rG�width�pulse�animation_timer�r�r�r�)r4r��maxrGrm�startedr�r�r�r�r�r.s  rLr'�BarColumn.render�s����(,�191�192�(>�#�a����$�D��!�T�^�^�,��.�.�0�$�c�!�T�^�^�6L��l�l�"��=�=�?��*�*��.�.��.�.��(�(�193194�195	196rN)rmr�r�r�r�)�(ryrzr{r|N)rm�
Optional[int]r�r6r�r6r�r6r�r6rr0rmrn)r�r2rmr4r>rws@rLr�r��st����$&�%�$2�$2�!,�)-�4� �4��4�"�	4�197"�4��
4�'�4�198�4�4� 199�200rNr�c�"�\rSrSrSrSSjrSrg)�TimeElapsedColumni�zRenders time elapsed.c���UR(aUROURnUc201[SSS9$[	[S[
U55S9n[[U5SS9$)zShow time elapsed.�-:--:--�progress.elapsed�r�r)�seconds)rO�
finished_time�elapsedr9r202rsr�r�)rJr�r��deltas    rLr'�TimeElapsedColumn.render�sS��(,�
�
�$�$�$�4�<�<���?��	�);�<�<��#�a��W��"6�7���C��J�&8�9�9rNr�Nrj�rprqrrrsrtr'rur�rNrLryry�s203���:rNryc�^�\rSrSrSrSSU4Sjjjr\S	Sj5rS204SjrSr	U=r205$)r�i�a�Show task progress as a percentage.206 207Args:208    text_format (str, optional): Format for percentage display. Defaults to "[progress.percentage]{task.percentage:>3.0f}%".209    text_format_no_percentage (str, optional): Format if percentage is unknown. Defaults to "".210    style (StyleType, optional): Style of output. Defaults to "none".211    justify (JustifyMethod, optional): Text justification. Defaults to "left".212    markup (bool, optional): Enable markup. Defaults to True.213    highlighter (Optional[Highlighter], optional): Highlighter to apply to output. Defaults to None.214    table_column (Optional[Column], optional): Table Column to use. Defaults to None.215    show_speed (bool, optional): Show speed if total is unknown. Defaults to False.216c		�B>�X lX�l[T	U]
UUUUUUS9 g)N)r[r�r\r]r^r)�text_format_no_percentager�rHrI)217rJr[r�r�r\r]r^rr�rKs218         �rLrI�TaskProgressColumn.__init__�s5���*C�&�$��
���#����#�%�
	�	219rNc��Uc220[SSS9$[R"[U5/SQS5up#X-n[USUS3SS9$)z�Render the speed in iterations per second.221 222Args:223    task (Task): A Task object.224 225Returns:226    Text: Text object containing the task speed.227r=zprogress.percentager})r=u×10³u×10⁶u×10⁹u×10¹²��z.1fz it/s)r9r+�pick_unit_and_suffixr�)�clsrC�unit�suffix�228data_speeds     rL�render_speed�TaskProgressColumn.render_speed�s[���=���"7�8�8��4�4���J�<��229���230�\�231��z�#�&�v�h�e�4�<Q�R�RrNc��URc?UR(a.URUR=(d UR5$URcUR232OURnURUS9nUR(a*[R"X0RURS9nO[X0RURS9nUR(aURRU5 U$ra)r�r�r��finished_speedrCr�r[rcr]r9rFr�r\r^rd)rJr�r[rerPs     rLr'�TaskProgressColumn.render�s����:�:��$�/�/��$�$�T�%8�%8�%F�D�J�J�G�G�.2�j�j�.@�D�*�*�d�FV�FV�	��"�"��"�-���;�;��#�#�E���T�\�\�R�D���Z�Z����F�D�������&�&�t�,��rN)r�r�)z-[progress.percentage]{task.percentage:>3.0f}%r=rgrhTNNF)r[r�r�r�r�r6r\r/r]r�r^rirr0r�r�rmrn)rCrrmr9rj)rprqrrrsrtrI�classmethodr�r'rurvrws@rLr�r��s�����K�)+�!�!'��-1�)-� �233��234�$'�235��	236�237�238��
239�+�240�'�241��242�243�244�245�,�S��S�&
�
rNr�c�R^�\rSrSrSrSrSSU4SjjjrS	SjrSrU=r	$)246r�iz�Renders estimated time remaining.247 248Args:249    compact (bool, optional): Render MM:SS when time remaining is less than an hour. Defaults to False.250    elapsed_when_finished (bool, optional): Render time elapsed when the task is finished. Defaults to False.251��?c�8>�XlX l[TU]
US9 gr8)�compactr�rHrI)rJr�r�rrKs    �rLrI�TimeRemainingColumn.__init__s �����%:�"�
���l��3rNc��UR(a UR(aURnSnOURnSnURc252[SUS9$Uc [UR(aSUS9$SUS9$[[U5S5upE[US5updUR(aU(d253USS	US3nO
US254S	USS	US3n[XsS9$)zShow time remaining.r|zprogress.remainingr=r}z--:--r{�<�02d�:�d)	r�rOr�time_remainingr�r9r��divmodr�)rJr��	task_timer��minutesr~�hours�	formatteds        rLr'�TimeRemainingColumn.renders����%�%�$�-�-��*�*�I�&�E��+�+�I�(�E��:�:����%�(�(����4�<�<��e�L�L�Y�e�L�L�"�#�i�.�"�5������,����<�<��"�3�-�q���
�6�I� ��)�1�W�S�M��7�3�-�@�I��I�+�+rN)r�r�)FFN)r�r�r�r�rr0rj)255rprqrrrsrtrrIr'rurvrws@rLr�r�sJ�����K��&+�)-�	4��4� $�4�'�	4�4�,�,rNr�c�"�\rSrSrSrSSjrSrg)�FileSizeColumni4zRenders completed filesize.c�h�[R"[UR55n[	USS9$)�Show data completed.zprogress.filesizer})r+�decimalr�rGr9�rJr��	data_sizes   rLr'�FileSizeColumn.render7s)���$�$�S����%8�9�	��I�%8�9�9rNr�Nrjr�r�rNrLr�r�4s256��%�:rNr�c�"�\rSrSrSrSSjrSrg)�TotalFileSizeColumni=zRenders total filesize.c��URb)[R"[UR55OSn[	USS9$)r�r=zprogress.filesize.totalr})r�r+r�r�r9r�s   rLr'�TotalFileSizeColumn.render@s4��9=���9O�H�$�$�S����_�5�UW�	��I�%>�?�?rNr�Nrjr�r�rNrLr�r�=s��!�@rNr�c�>^�\rSrSrSrSSU4SjjjrSSjrSrU=r$)	�MofNCompleteColumniFa0Renders completed count/total, e.g. '  10/1000'.257 258Best for bounded tasks with int quantities.259 260Space pads the completed count so that progress length does not change as task progresses261past powers of 10.262 263Args:264    separator (str, optional): Text to separate completed and total values. Defaults to "/".265c�,>�Xl[TU]	US9 gr8)�	separatorrHrI)rJr�rrKs   �rLrI�MofNCompleteColumn.__init__Rs���"��
���l��3rNc���[UR5nURb[UR5OSn[[	U55n[X$S3URU3SS9$)zShow completed/total.�?r��progress.downloadr})r�rGr�r�r�r9r�)rJr�rGr��total_widths     rLr'�MofNCompleteColumn.renderVsa������'�	�#'�:�:�#9��D�J�J��s���#�e�*�o�����a��(����(8���@�%�266�	267rN)r�)�/N)r�r�rr0rjr>rws@rLr�r�Fs���	�4�4�268�269rNr�c�J^�\rSrSrSrSSU4SjjjrSSjrSrU=r$)	r270iaz�Renders file size downloaded and total, e.g. '0.5/2.3 GB'.271 272Args:273    binary_units (bool, optional): Use binary units, KiB, MiB etc. Defaults to False.274c�,>�Xl[TU]	US9 gr8)�binary_unitsrHrI)rJr�rrKs   �rLrI�DownloadColumn.__init__hs���)��
���l��3rNc���[UR5nURb[UR5OUnUR(a[R275"U/SQS5upEO[R276"U/SQS5upEUS:XaSOSnX$-nUSUS3nURb"[UR5n	X�-n277U278SUS3nOS	nUS279USU3n[
USS
9n
U
$)z.Calculate common unit for completed and total.)	r��KiB�MiB�GiB�TiB�PiB�EiB�ZiB�YiBi)	r��kB�MB�GB�TB�PB�EB�ZB�YBr�r*rz,.�fr�r�rUr�r})r�rGr�r�r+r�r9)rJr�rG� unit_and_suffix_calculation_baser�r��	precision�completed_ratio�
completed_strr��total_ratio�	total_str�download_status�
download_texts              rLr'�DownloadColumn.renderns�������'�	� $�z�z�5�C��280�281�O�9�	)����#�8�8�0�Q���L�D�&�$�8�8�0�I���L�D�282���A��	�#�*��*�2�i�[��/�:�
��:�:�!���283�284�O�E��,�K�&�r�)��A�o�6�I��I�*�O�1�Y�K�q���A���_�4G�H�
��rN)r�)FN)r�r�rr0rmrnrjr>rws@rLr285r286as;����LP�4� �4�8H�4�	
�4�4�!�!rNr287c�"�\rSrSrSrSSjrSrg)�TransferSpeedColumni�z&Renders human readable transfer speed.c��UR=(d URnUc288[SSS9$[R"[U55n[US3SS9$)zShow data transfer speed.r�zprogress.data.speedr}z/s)r�rCr9r+r�r�)rJr�rCr�s    rLr'�TransferSpeedColumn.render�sR���#�#�1�t�z�z���=���#8�9�9��%�%�c�%�j�1�289��z�l�"�%�-B�C�CrNr�Nrjr�r�rNrLr�r��s��0�DrNr�c�0�\rSrSr%SrS\S'S\S'Srg)�ProgressSamplei�z$Sample of progress for a given time.rkr)rGr�N)rprqrrrsrtr3rur�rNrLr�r��s��.������$rNr�c��\rSrSr%SrS\S'S\S'S\S'S	\S290'S\S'S
rS\S'SrS\S'\"\	S9r291S\S'\"S
SSS9rS\S'\"S
SSS9rS\S'S
r
S\S'\"SSSS9rS\S'\"S\S9rS\S 'S+S!jr\S,S"j5r\S-S#j5r\S-S$j5r\S,S%j5r\S+S&j5r\S-S'j5r\S-S(j5rS.S)jrS*rg
)/�Taski�z}Information regarding a progress task.292 293This object should be considered read-only outside of the :class:`~Progress` class.294 295r;r%r�r�rr�rkrG�GetTimeCallable�	_get_timeNrTr��visible)�default_factoryzDict[str, Any]�fieldsF)�default�init�repr�296start_time�	stop_timer�c��[SS9$)Nr�)�maxlenrr�rNrL�<lambda>�
Task.<lambda>�s	���T� 2rN)r�r�r�zDeque[ProgressSample]�	_progress)r�r�r�_lockc�"�UR5$)z(float: Get the current time, in seconds.)r�r]s rLr��
Task.get_time�s���~�~��rNc��URSL$)z#bool: Check if the task as started.N)r�r]s rLrt�Task.started�s�����d�*�*rNc�P�URcgURUR-297$)zPOptional[float]: Get the number of steps remaining, if a non-None total was set.N�r�rGr]s rL�	remaining�Task.remaining�s$���:�:����z�z�D�N�N�*�*rNc��URcgURbURUR-298$UR5UR-299$)z]Optional[float]: Time elapsed since task was started, or ``None`` if the task hasn't started.N)r�r�r�r]s rLr��Task.elapsed�sC���?�?�"���>�>�%��>�>�D�O�O�3�3��}�}�����0�0rNc��URSL$)zCheck if the task has finished.N)rr]s rLrO�
Task.finished�s���!�!��-�-rNc��UR(dgURUR-S-n[S[SU55nU$)zOfloat: Get progress of task as a percentage. If a None total was set, returns 0��Y@)r�rG�minrs)rJrGs  rL�300percentage�Task.percentage�s>���z�z���^�^�d�j�j�0�E�9�	���s�3�	�2�3�	��rNc�`�URcgUR URnU(d301SSS5 gUSRUSR-302nUS:Xa303SSS5 g[	U5n[U5 [
SU55nXB-nUsSSS5 $!,(df   g=f)z=Optional[float]: Get the estimated speed in steps per second.Nr�rc3�8# �UHoRv� M g7frZr�)�.0�samples  rL�	<genexpr>�Task.speed.<locals>.<genexpr>s���!O��v�"2�"2����)r�r�r�r)�iterr�r�)rJrC�304total_time�
iter_progress�total_completedrCs      rLrC�305Task.speed�s����?�?�"��
�Z�Z��~�~�H����Z�"�"��/�/�(�1�+�2G�2G�G�J��Q���
�Z�!��N�M����!�!O��!O�O�O�#�0�E���Z�Z�s�B�&B�(-B�306B-c��UR(agURnU(dgURnUcg[X!-5nU$)zJOptional[float]: Get estimated time to completion, or ``None`` if no data.rN)rOrCr�r
)rJrCr��estimates    rLr��Task.time_remainingsA���=�=���307�308�����N�N�	�����	�)�*���rNc�T�URR5 SUlSUlg)zReset progress.N)r��clearrr�r]s rL�_reset�Task._resets"��������!���"��rN)r�r)rmrkr�)rmrrl)rprqrrrsrtr3rr�r	�dictr�r�r�r�r�rr�r�r�rtr�r�rOrrCr�rrur�rNrLr�r��s_���	�J�G���'���>���*���+�%)�M�?�)�(��G�T��J�"�4�8�F�N�8�?�"'��5�u�"M�J��M�N�!&�t�%�e�!L�I��L�N�&*�N�O�*�>�',�2��U�(�I�$���e�U�;�E�5�;�� ��+��+��+��+��1��1��.��.���������"����#rNr�c�~�\rSrSrSrSSSSSSSSSSS.309S+S	jjr\S,S310j5r\S-Sj5r	\S.Sj5r311\S/S
j5r\S0Sj5rS1Sjr
S1SjrS2SjrS3SjrS4S5SjjrS6SSS.S7Sjjjr\R(S8SSSS.S9Sjjj5r\R(S8SSSS.S:Sjjj5rS;SSSS.S<SjjjrS=SjrS=SjrSSSSSSS.S>SjjrSSSSSS .S?S!jjrS@SAS"jjrS1S#jrSBS$jrSCS%jrSDS&jrSBS'jrSESFS(jjr S=S)jr!S*r"g)Gr�i%a4Renders an auto-updating progress bar(s).312 313Args:314    console (Console, optional): Optional Console instance. Defaults to an internal Console instance writing to stdout.315    auto_refresh (bool, optional): Enable auto refresh. If disabled, you will need to call `refresh()`.316    refresh_per_second (float, optional): Number of times per second to refresh the progress information. Defaults to 10.317    speed_estimate_period: (float, optional): Period (in seconds) used to calculate the speed estimate. Defaults to 30.318    transient: (bool, optional): Clear the progress on exit. Defaults to False.319    redirect_stdout: (bool, optional): Enable redirection of stdout, so ``print`` may be used. Defaults to True.320    redirect_stderr: (bool, optional): Enable redirection of stderr. Defaults to True.321    get_time: (Callable, optional): A callable that gets the current time, or None to use Console.get_time. Defaults to None.322    disable (bool, optional): Disable progress display. Defaults to False323    expand (bool, optional): Expand tasks table to fit width. Defaults to False.324NTrxg>@F)325r�r�r��speed_estimate_periodr��redirect_stdout�redirect_stderrr�r��expandc326327���US:�dS5e[5UlU=(d UR5UlX@lX�lX�l0Ul[S5Ul	[U=(d328 [5UUUUUURS9Ul
U=(d URRUlURR UlURR"Ulg)Nrzrefresh_per_second must be > 0)r�r�r�r�rr�get_renderable)rr��get_default_columnsr�rr�r�_tasksr;�_task_indexr3r,r rSr�r��print�log)rJr�r�r�rr�rrr�r�rr�s            rLrI�Progress.__init__5s���"�A�%�G�'G�G�%��W��329��<�$�":�":�"<���%:�"�����*,���#)�!�9�����,�{�}�%�1��+�+��.�.�330��	�!�9�D�L�L�$9�$9��
��\�\�'�'��331��<�<�#�#��rNc�P�[S5[5[5[54$)aGet the default columns used for a new Progress instance:332   - a text column for the description (TextColumn)333   - the bar itself (BarColumn)334   - a text column showing completion percentage (TextColumn)335   - an estimated-time-remaining column (TimeRemainingColumn)336If the Progress instance is created without passing a columns argument,337the default columns defined here will be used.338 339You can also create a Progress instance using custom columns before340and/or after the defaults, as in this example:341 342    progress = Progress(343        SpinnerColumn(),344        *Progress.get_default_columns(),345        "Elapsed:",346        TimeElapsedColumn(),347    )348 349This code shows the creation of a Progress display, containing350a spinner to the left, the default columns, and a labeled elapsed351time column.352r~)r�r�r�r�)r�s rLr!�Progress.get_default_columnsYs(��2
�A�B��K�� ��!�	353�	354rNc�.�URR$rZ)rSr�r]s rLr��Progress.consolexs���y�y� � � rNc��UR [URR55sSSS5 $!,(df   g=f)zGet a list of Task instances.N)r��listr"�valuesr]s rL�tasks�Progress.tasks|s*���Z�Z�����*�*�,�-��Z�Z��	�#:�355Ac��UR [URR55sSSS5 $!,(df   g=f)zA list of task IDs.N)r�r,r"�keysr]s rL�task_ids�Progress.task_ids�s*���Z�Z�����(�(�*�+��Z�Z�r0c���UR UR(d356SSS5 g[SURR555sSSS5 $!,(df   g=f)z'Check if all tasks have been completed.NTc3�8# �UHoRv� M g7frZ)rO)rr�s  rLr357�$Progress.finished.<locals>.<genexpr>�s���F�1E��}�}�1E�r)r�r"�allr-r]s rLrO�Progress.finished�sC���Z�Z��;�;���Z��F����1C�1C�1E�F�F��Z�Z�s�A�)A�358A*c�Z�UR(dURRSS9 gg)zStart the progress display.T)rPN)r�rSr\r]s rLr\�Progress.start�s ���|�|��I�I�O�O�D�O�)�rNc��UR(dmURR5 URR(d7URR359(dURR
5 gggg)zStop the progress display.N)r�rSrr��is_interactive�360is_jupyterr$r]s rLr�
Progress.stop�sN���|�|��I�I�N�N���<�<�.�.�t�|�|�7N�7N����"�"�$�8O�.�rNc�&�UR5 U$rZr[r]s rLr^�Progress.__enter__�r`rNc�$�UR5 grZ)rrds    rLrh�Progress.__exit__�s
��	
�	�	�rNrc#��# �Uc[[U55=(d SnUcURXRUS9nOURXBUS9 URR361(a8[
XU5nUHnUv� U=RS-
slM SSS5 gURn	URn362UHnUv� U	"US5 U363"5 M g!,(df   g=f7f)a�Track progress by iterating over a sequence.364 365You can also track progress of an iterable, which might require that you additionally specify ``total``.366 367Args:368    sequence (Iterable[ProgressType]): Values you want to iterate over and track progress.369    total: (float, optional): Total number of steps. Default is len(sequence).370    completed (int, optional): Number of steps completed so far. Defaults to 0.371    task_id: (TaskID): Task to track. Default is new task.372    description: (str, optional): Description of task, if new task is created.373    update_period (float, optional): Minimum time (in seconds) between calls to update(). Defaults to 0.1.374 375Returns:376    Iterable[ProgressType]: An iterable of values taken from the provided sequence.377Nr�r*)378rkr�add_taskrUrSr�r?rGrQrP)rJr�r�rGrDr�rE�track_thread�valuerQrPs           rLr��Progress.track�s����0�=��+�h�/�0�8�D�E��?��m�m�K�	�m�R�G��K�K��	�K�B��9�9�!�!��d�]�;�|�%�E��K� �*�*�a�/�*�&�<�;�379�l�l�G��l�l�G�!�������#��	�"�<�;�s�A,C!�.#C�?C!�380C�C!r)rDr�c��SnUbUnO1Ub.UR URURnSSS5 Uc[S5eUcUR	XES9nOURX5S9 [
XUSS9$!,(df   NI=f)aTrack progress file reading from a binary file.381 382Args:383    file (BinaryIO): A file-like object opened in binary mode.384    total (int, optional): Total number of bytes to read. This must be provided unless a task with a total is also given.385    task_id (TaskID): Task to track. Default is new task.386    description (str, optional): Description of task, if new task is created.387 388Returns:389    BinaryIO: A readable file-like object in binary mode.390 391Raises:392    ValueError: When no total value can be extracted from the arguments or the task.393Nz?unable to get the total number of bytes, please specify 'total'�r�F�r�)r�r"r��394ValueErrorrErUr�)rJrr�rDr��total_bytess      rLr�Progress.wrap_file�s���.(,�����K�
�
 ����"�k�k�'�2�8�8������Q��
�395�?��m�m�K�m�C�G��K�K��K�3��t�7��?�?���s�A5�5396B)r�rDr�c��grZr��397rJrr�rrrrr�rDr�s398          rLr�
Progress.open����	
rNc��grZr�rPs399          rLrrQrRrNc���SR[USS95n400U401S;a[SU<35eUS:HnU402S:Xa$US:Xa[R"S[4035 S	nOU404S405;aUS:Xa[S5eUS:XaS	nUc[
U5RnUcURX�S
9nOURX�S
9 [R"USUS9n[X�USS9n
US;a[R"U
UUUUS9$U
$)a�Track progress while reading from a binary file.406 407Args:408    path (Union[str, PathLike[str]]): The path to the file to read.409    mode (str): The mode to use to open the file. Only supports "r", "rb" or "rt".410    buffering (int): The buffering strategy to use, see :func:`io.open`.411    encoding (str, optional): The encoding to use when reading in text mode, see :func:`io.open`.412    errors (str, optional): The error handling strategy for decoding errors, see :func:`io.open`.413    newline (str, optional): The strategy for handling newlines in text mode, see :func:`io.open`.414    total (int, optional): Total number of bytes to read. If none given, os.stat(path).st_size is used.415    task_id (TaskID): Task to track. Default is new task.416    description (str, optional): Description of task, if new task is created.417 418Returns:419    BinaryIO: A readable file-like object in binary mode.420 421Raises:422    ValueError: When an invalid mode is given.423r=F)�reverse)�br�rt�rz
invalid mode r*rVzaline buffering (buffering=1) isn't supported in binary mode, the default buffer size will be usedr�)rWrXrzcan't have unbuffered text I/OrJ�rb)rTrK)rXrW)rrr�line_buffering)rc�sortedrL�warnings�warn�RuntimeWarningr�st_sizerErU�iorr��
TextIOWrapper)rJrr�rrrrr�rDr��_moderZr�rs              rLrrQs��B����t�U�3�4���)�)��}�T�H�5�6�6�#�a����D�=�Y�!�^��M�M�s��
��I�
�k�
!��A�~� �!A�B�B��a���	��=���J�&�&�E��?��m�m�K�m�=�G��K�K��K�-�����t�y�9����w�T�B���;���#�#��!���-��
��
rNc��UR URUnURcUR5UlSSS5 g!,(df   g=f)z�Start a task.424 425Starts a task (used when calculating elapsed time). You may need to call this manually,426if you called ``add_task`` with ``start=False``.427 428Args:429    task_id (TaskID): ID of task.430N)r�r"r�r�)rJrDr�s   rL�431start_task�Progress.start_taskls:���Z�Z��;�;�w�'�D����&�"&�-�-�/����Z�Z�s�2A�432Ac���UR URUnUR5nURcX2lX2lSSS5 g!,(df   g=f)zfStop a task.433 434This will freeze the elapsed time on the task.435 436Args:437    task_id (TaskID): ID of task.438N)r�r"r�r�r�)rJrDr�r(s    rL�	stop_task�Progress.stop_taskzsB���Z�Z��;�;�w�'�D��=�=�?�L����&�".��)�N��Z�Z�s�9A�439A)r�rGrQr�r�rPc�p�UR URUn	U	Rn440Ub%X)R:waX)lU	R	5 UbU	=RU-
slUbX9lUbXYlUbXilU	RRU5 U	RU441-442nUR5nX�R-443n
U	RnURnU(a6USRU
:a#U"5 U(aUSRU
:aM#US:�aUR[X�55 U	Rb8U	RU	R:�aU	R cU	R"U	lSSS5 U(aUR%5 gg!,(df   N'=f)aHUpdate information associated with a task.444 445Args:446    task_id (TaskID): Task id (returned by add_task).447    total (float, optional): Updates task.total if not None.448    completed (float, optional): Updates task.completed if not None.449    advance (float, optional): Add a value to task.completed if not None.450    description (str, optional): Change task description if not None.451    visible (bool, optional): Set visible flag if not None.452    refresh (bool): Force a refresh of progress information. Default is False.453    **fields (Any): Additional data fields required for rendering.454Nr)r�r"rGr�rr�r�r�rUr�rr��popleftr)�appendr�rr�rP)rJrDr�rGrQr�r�rPr�r��completed_start�update_completedr(�old_sample_timer�rjs                rLrU�Progress.update�sb��0�Z�Z��;�;�w�'�D�"�n�n�O�� �U�j�j�%8�"�455����
��"����'�)���$�!*���&�#.� ��"�&���K�K���v�&�#�~�~��?���=�=�?�L�*�-G�-G�G�O����I��'�'�G��	�!�� 6� 6�� H��	��	�!�� 6� 6�� H��!�#�� � ���!O�P��456�457�&��N�N�d�j�j�0��&�&�.�%)�\�\��"�A�D��L�L�N��E�Z�s�DF'�!A%F'�'458F5)r\r�rGr�r�c�X�UR5nUR URUn	U	R5 U(aUOSU	lUbX9lXIlUbXYlU(aXylUbXil	SU	l459SSS5 UR5 g!,(df   N=f)a0Reset a task so completed is 0 and the clock is reset.460 461Args:462    task_id (TaskID): ID of task.463    start (bool, optional): Start the task after reset. Defaults to True.464    total (float, optional): New total steps in task, or None to use current total. Defaults to None.465    completed (int, optional): Number of steps completed. Defaults to 0.466    visible (bool, optional): Set visible flag if not None.467    description (str, optional): Change task description if not None. Defaults to None.468    **fields (str): Additional data fields required for rendering.469N)r�r�r"rr�r�rGr�r�r�rrP)470rJrDr\r�rGr�r�r�r(r�s471          rL�reset�Progress.reset�s���,�}�}���
�Z�Z��;�;�w�'�D��K�K�M�.3�l��D�O�� �"�472�&�N��"�&���$���&�#.� �!%�D���	
�����Z�s�A%B�473B)c���UR5nUR URUnURnU=RU-
slURU-474nX0R-475nUR476nURn	U(a6USRU:a#U	"5 U(aUSRU:aM#[U5S:�aU	"5 [U5S:�aMUR[X655 URbIURUR:�a/URc"URUlURUlSSS5 g!,(df   g=f)z�Advance task by a number of steps.477 478Args:479    task_id (TaskID): ID of task.480    advance (float): Number of steps to advance. Default is 1.481rr�N)r�r�r"rGrr�rjr)r�rkr�r�rr�rCr�)482rJrDrQr(r�rlrmrnr�rjs483          rLrQ�Progress.advance�s���}�}���
�Z�Z��;�;�w�'�D�"�n�n�O��N�N�g�%�N�#�~�~��?��*�-G�-G�G�O����I��'�'�G��	�!�� 6� 6�� H��	��	�!�� 6� 6�� H��i�.�4�'��	��i�.�4�'����^�L�K�L��484�485�&��N�N�d�j�j�0��&�&�.�%)�\�\��"�&*�j�j��#�)�Z�Z�s�B!E �%E �'A0E � 486E.c��UR(d7URR(aURR5 ggg)z*Refresh (render) the progress information.N)r�rSrTrPr]s rLrP�Progress.refreshs,���|�|��	�	� 4� 4��I�I����!5�|rNc�2�[UR56nU$)z*Get a renderable for the progress display.)r.�get_renderables)rJr*s  rLr �Progress.get_renderables���D�0�0�2�3�487��rNc#�J# �URUR5nUv� g7f)z5Get a number of renderables for the progress display.N)�make_tasks_tabler.)rJ�tables  rLrx�Progress.get_renderabless����%�%�d�j�j�1����s�!#c��^�SUR5n[R"USURS.6nUH9mTR(dMUR488"U4SjUR56 M; U$)z�Get a table to render the Progress display.489 490Args:491    tasks (Iterable[Task]): An iterable of Task instances, one per row of the table.492 493Returns:494    Table: A table instance.495c3�# �UHAn[U[5(a	[SS9OUR5R	5v� MC g7f)TrYN)rEr�r7r"�copy)r�_columns  rLr496�,Progress.make_tasks_table.<locals>.<genexpr>#sI���497�(���g�s�+�+��t�$��-�-�/�4�4�6�7�(�s�A	A)rr*)�paddingrc3�|># �UH1n[U[5(aURTS9OU"T5v� M3 g7f)rbN)rEr�rc)r�columnr�s  �rLr498r�0sB�����'3�F� *�&�#�6�6�#�M�M�t�M�4�!'���.�'3�s�9<)r�r8�gridrr��add_row)rJr.�
table_columnsr|r�s    @rLr{�Progress.make_tasks_tablesi���499� �<�<�
500�
��501�502�M�6�$�+�+�N���D��|�|�|��
�
��'+�l�l�
�	���rNc�p�UR UR5sSSS5 $!,(df   g=f)z+Makes the Progress class itself renderable.N)r�r r]s rL�__rich__�Progress.__rich__;s��
�Z�Z��&�&�(��Z�Z�s�'�5035c��UR [URUUUUUURURS9nXpRUR'U(aURUR5 URn[
[UR5S-5UlSSS5 UR5 W$!,(df   N =f)a�Add a new 'task' to the Progress display.504 505Args:506    description (str): A description of the task.507    start (bool, optional): Start the task immediately (to calculate elapsed time). If set to False,508        you will need to call `start` manually. Defaults to True.509    total (float, optional): Number of total steps in the progress if known.510        Set to None to render a pulsing animation. Defaults to 100.511    completed (int, optional): Number of steps completed so far. Defaults to 0.512    visible (bool, optional): Enable display of the task. Defaults to True.513    **fields (str): Additional data fields required for rendering.514 515Returns:516    TaskID: An ID you can use when calling `update`.517)r�r�r�r�r*N)	r�r�r#r�r"rdr;r�rP)	rJr�r\r�rGr�r�r��new_task_indexs	         rLrE�Progress.add_task@s���0�Z�Z��� � �������-�-��j�j�	�D�-1�K�K��(�(�)������ 0� 0�1�!�-�-�N�%�c�$�*:�*:�&;�a�&?�@�D��� 	
������#�Z�s�BC�518Cc�j�UR URU	SSS5 g!,(df   g=f)zEDelete a task if it exists.519 520Args:521    task_id (TaskID): A task ID.522 523N)r�r")rJrDs  rL�remove_task�Progress.remove_taskks!���Z�Z����G�$��Z�Z�s�$�5242)r�r#r"r�r�rr�rSr%r$r)r�zUnion[str, ProgressColumn]r��Optional[Console]r�r�r�rkrrkr�r�rr�rr�r�zOptional[GetTimeCallable]r�r�rr�rmrn)rmzTuple[ProgressColumn, ...])rmr-)rmz525List[Task])rmzList[TaskID]r�rl)rmr)ro)NrN�526Working...皙�����?)r��Iterable[ProgressType]r�rrGr�rD�Optional[TaskID]r�r�rErkrmr�rZ)527rrr�rwrDr�r�r�rmr�r�NNN)r�"Union[str, 'PathLike[str]', bytes]r��
Literal['rb']rr�r�
Optional[str]rr�rr�r�rwrDr�r�r�rmr)rr�r�z"Union[Literal['r'], Literal['rt']]rr�rr�rr�rr�r�rwrDr�r�r�rmr$�rXr�NNN)rr�r��1Union[Literal['rb'], Literal['rt'], Literal['r']]rr�rr�rr�rr�r�rwrDr�r�r�rmzUnion[BinaryIO, TextIO])rDr;rmrn)rDr;r�rrGrrQrr�r�r��Optional[bool]rPr�r�rrmrn)rDr;r\r�r�rrGr�r�r�r�r�r�rrmrn)r*)rDr;rQrkrmrn)rmr0)rmzIterable[RenderableType])r.zIterable[Task]rmr8)TrrT)r�r�r\r�r�rrGr�r�r�r�rrmr;)#rprqrrrsrtrIr�r!r�r�r.r3rOr\rr^rhr�r�typing�overloadrrdrgrUrqrQrPr rxr{r�rEr�rur�rNrLr�r�%s��
�$&*�!�$&�'+�� $� $�.2���"$�,�"$�#�"$��	"$�528"�"$� %�
"$��"$��"$��"$�,�"$��"$��"$�529�"$�H�530��531�<�!��!��.��.�532�,��,�533�G��G�*�534%���/��)��(�	�535536��"&��$(�'�"�+�(�+��+��	+�537"�+��
+��+�538 �+�` $�(@�539%)�'�
(@��(@��(@�540"�(@��
(@�541�(@�T�_�_�542�"&� $�!%�

� $�$(�'�

�0�

��

��	

�543 �

��


��

��

�"�

��

�544�

��

��_�_�545�"&� $�!%�

� $�$(�'�

�0�

�1�

��	

�546 �

��


��

��

�"�

��

�547�

��

�$CF��"&� $�!%�K� $�$(�'�K�0�K�@�K��	K�548 �K��
K��K��K�"�K��K�549!�K�Z2�
*�&"&�%)�#'�%)�"&��;��;��	;�550#�;�!�
;�#�;� �;��;��;�551�;�B�!%��"&�%)�%��%��	%�552�%��
%� �%�#�%��%�553�%�N1�< �554�555�556�B)��!&���
)��)��)��	)�557�)��
)��)�558�)�V%rNr��__main__)�Panel)�Rule)�Syntax)r8a~def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:559    """Iterate and generate a tuple with a flag for last value."""560    iter_values = iter(values)561    try:562        previous_value = next(iter_values)563    except StopIteration:564        return565    for value in iter_values:566        yield False, previous_value567        previous_value = value568    yield True, previous_value�python)�line_numbers�foo�bar�baz�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...�examplezPretty printed)�typerPz	Syntax...zGive it a try!)�cycle)�record)r�r�z[red]Downloadingr�rJz[green]Processingz[yellow]Thinkingr�r�g333333�?g{�G�z�?�d)r�NrTNFNrxryrzr{r|r�FT)"r�r�r�r�r�rrGr�r�r�r�r�r�r�r��Optional[Callable[[], float]]r�rkr�r6r�r6r�r6r�r6rErkr�r�r�r�rmr�)rrr�r�r�r�r�r�r�r�r�r�r�r�r�rkr�r6r�r6r�r6r�r6r�r�rm�ContextManager[BinaryIO]r�)&rr�r�z"Union[Literal['rt'], Literal['r']]rr�rr�rr�rr�r�rwr�r�r�r�r�r�r�r�r�r�r�rkr�r6r�r6r�r6r�r6r�r�rmzContextManager[TextIO])&rr�r�r�rr�rr�rr�rr�r�rwr�r�r�r�r�r�r�r�r�r�r�rkr�r6r�r6r�r6r�r6r�r�rmr�r�)&rr�r�r�rr�rr�rr�rr�r�rwr�r�r�r�r�r�r�r�r�r�r�rkr�r6r�r6r�r6r�r6r�r�rmz7Union[ContextManager[BinaryIO], ContextManager[TextIO]])��569__future__rr`r�r\�abcrr�collectionsr�dataclassesrr	�datetimer570rr�mathr
r�operatorr�osrr�	threadingrrr�typesrrrrrrrrrrrr r!r"r#r$r%r&r'r(�typing_extensionsr)r=r+r,r�r-r.r/r0r^r1�jupyterr2rSr3�progress_barr4rDr5r�r6r|r7r8rPr9r:r�r;r<rkr�r=r?r�r�r�rr�rrr5r@r�r�ryr�r�r�r�r�r571r�r�r�r�rp�random�time�panelr��ruler��syntaxr�r��progress_renderables�	itertoolsr��examplesr!rCrE�task1�task2�task3rOrU�sleep�randintr%r�r�rNrL�<module>r�s5��"�	�
��#��(��.��� ��*�*��������,�&�#�B�B�$�!��%��� � �	��3�	���~�&���2�u�9�%���^�^�D�&�(�+��%�6�%�T$�!���!%��.2� "�!� .� .�(����!K572�$�K573��K574��K575��	K576�577�K578��
K579��K580�,�K581��K582��K583��K584��K585��K586��K587��K588� �!K589�"�#K590�\d1�i��d1�N8�>�"�%�w�r�{�8�2$��!%��.2� "�!� .� .�(��>*�591�>*��>*��	>*�592�>*��
>*��>*�,�>*��>*��>*��>*��>*��>*��>*��>*�B����"� �!�
	� �#��!%��.2� "�!� .� .�(��'	�593,�	�594,�	��	��		�595
�	��
	��	��	��	��	��	�,�	��	��	� �!	�"�#	�$�%	�&�'	�(�)	��	�0����"� �!�
	� �#��!%��.2� "�!� .� .�(��'	�596,�	�597�	��	��		�598
�	��
	��	��	��	��	��	�,�	��	��	� �!	�"�#	�$�%	�&�'	�(�)	��	�4?B��"� �!�
S*� �#��!%��.2� "�!� .� .�(��'S*�599,�S*�600;�S*��S*��	S*�601
�S*��
S*��S*��S*��S*��S*��S*�,�S*��S*��S*� �!S*�"�#S*�$�%S*�&�'S*�(=�)S*�l'1�S�'1�T�~��"/�N�/�d���<'602��'603�T	:��	:�E��E�P-,�.�-,�`:�^�:�@�.�@�604��605�6.�^�.�b	D�.�	D�%�Z�%��z#�z#��z#�zN	%�|�N	%�b�z��������
�606	"�	���F� 
�%���&�E�	�M�M�#�s�C� �	E�
�8�9�'�
�&��$4�5����
��607�� ��)�*�H��T�"�G�	���608�	�	%�	%�	'�609�	��610���611�612��!�!�"4�D�!�A���!�!�"5�T�!�B���!�!�"4�D�!�A���#�#��O�O�E�3�O�/��O�O�E�3�O�/��J�J�t���~�~�a��%��)����T�(�^�,��#�#�#�613�614�]�\615�616�s
�B8R�617R
codekingpro/portable-devtools · Team Ai