HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //snap/certbot/5057/lib/python3.12/site-packages/pip/_vendor/rich/__pycache__/live.cpython-312.pyc
�

�F�hL;�
�d�UddlmZddlZddlmZmZmZddlmZddl	m
Z
mZmZm
Z
mZmZmZmZmZddlmZddlmZmZmZmZmZdd	lmZdd
lmZddlm Z ddl!m"Z"m#Z#dd
l$m%Z%ddl&m'Z'erddl(m)Z)Gd�de�Z*Gd�de e�Z+e,dk(�rddl-Z-ddl.Z.ddl/m0Z0ddl	m1Z1mZm2Z2ddl3m4Z4ddlmZddl5m+Z+ddl6m7Z7ddl8m9Z9ddl:m;Z;ddl<m=Z=e�Ze;ddd �!�Z:e=d"d#d$�Z<e<j}d%d&d'�d(e7d)�d*e<d+d,d-d.�d/e:e9d0�g	Z?e0e?�Z@gd1�ZAe+e�2�5ZBiZCd3eDd4<eEd5�D�]VZFeAeFeGeA�zZHeAD�]?ZIeIeHk(r�
e.j�d6�e-j�dd7�dkrej�eMe@��d8e-jZ�d9zdzzeCeHeIf<eGeC�eGeA�dz
kDr(eCj�eOeCj���d�e=d:�;�Z<e<j�d<�e<j�d=�e<j�d>�eCj��D],\\ZSZTZUe<j}eSeTe'eUd?�eUd@krdAndB�C���.eBj�e4j�e<����B��Y	ddd�yy#1swYyxYw)D�)�annotationsN)�Event�RLock�Thread)�
TracebackType)	�IO�
TYPE_CHECKING�Any�Callable�List�Optional�TextIO�Type�cast�)�get_console)�Console�ConsoleRenderable�Group�RenderableType�
RenderHook)�Control)�	FileProxy)�JupyterMixin)�
LiveRender�VerticalOverflowMethod)�Screen)�Text)�Selfc�4��eZdZdZd�fd�Zdd�Zdd�Z�xZS)�_RefreshThreadz3A thread that calls refresh() at regular intervals.c�`��||_||_t�|_t�|�d��y)NT)�daemon)�live�refresh_per_secondr�done�super�__init__)�selfr$r%�	__class__s   ���/build/snapcraft-certbot-c9aaebe726f8beb59a0eb2d8e1671bc4/parts/certbot/install/lib/python3.12/site-packages/pip/_vendor/rich/live.pyr(z_RefreshThread.__init__s+�����	�"4����G��	�
�����%�c�8�|jj�y�N)r&�set�r)s r+�stopz_RefreshThread.stops���	�	�
�
�r,c�f�|jjd|jz�s}|jj5|jj�s|jj
�ddd�|jjd|jz�s�|yy#1swY�4xYw)Nr)r&�waitr%r$�_lock�is_set�refreshr0s r+�runz_RefreshThread.run"sz���)�)�.�.��T�%<�%<�!<�=������
(��y�y�'�'�)��I�I�%�%�'�
(��)�)�.�.��T�%<�%<�!<�=�
(�
(�s�5B'�'B0)r$z'Live'r%�float�return�None�r9r:)�__name__�
__module__�__qualname__�__doc__r(r1r7�
__classcell__)r*s@r+r!r!s���=�&��(r,r!c���eZdZdZ	ddddddddddd�																						dd�Zedd	��Zdd
�Zddd�Zdd�Z	dd
�Z
								dd�Zdd�Zdd�Z
edd��Zdd�dd�Zdd�Z				d d�Zy)!�Livea�Renders an auto-updating live display of any given renderable.

    Args:
        renderable (RenderableType, optional): The renderable to live display. Defaults to displaying nothing.
        console (Console, optional): Optional Console instance. Defaults to an internal Console instance writing to stdout.
        screen (bool, optional): Enable alternate screen mode. Defaults to False.
        auto_refresh (bool, optional): Enable auto refresh. If disabled, you will need to call `refresh()` or `update()` with refresh flag. Defaults to True
        refresh_per_second (float, optional): Number of times per second to refresh the live display. Defaults to 4.
        transient (bool, optional): Clear the renderable on exit (has no effect when screen=True). 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.
        vertical_overflow (VerticalOverflowMethod, optional): How to handle renderable when it is too tall for the console. Defaults to "ellipsis".
        get_renderable (Callable[[], RenderableType], optional): Optional callable to get renderable. Defaults to None.
    NFT��ellipsis)	�console�screen�auto_refreshr%�	transient�redirect_stdout�redirect_stderr�vertical_overflow�get_renderablec	��|dkDsJd��||_|�|n	t�|_||_d|_||_||_d|_d|_t�|_
d|_||_d|_
|rdn||_d|_||_|	|_|
|_t'|j)�|	��|_d|_y)Nrzrefresh_per_second must be > 0FT)rK)�_renderablerrE�_screen�_alt_screen�_redirect_stdout�_redirect_stderr�_restore_stdout�_restore_stderrrr4�
ipy_widgetrG�_startedrH�_refresh_threadr%rK�_get_renderablerrL�_live_render�_nested)r)�
renderablerErFrGr%rHrIrJrKrLs           r+r(z
Live.__init__9s���"�A�%�G�'G�G�%�%���")�"5�w�;�=������ ��� /��� /���26���26����W��
�)-���(���#��
�!'��Y���9=���"4���!2���-���&����!�5F�
�����r,c��|jS)z'Check if live display has been started.)rVr0s r+�
is_startedzLive.is_startedbs���}�}�r,c�^�|j�|j�n|j}|xsdS)N�)rXrN)r)r[s  r+rLzLive.get_renderablegs9���#�#�/�
� � �"��!�!�	�
��R�r,c��|j5|jr
	ddd�yd|_|jj|�sd|_	ddd�y|j
r |jj
d�|_|jjd�|j�|jj|�|r	|j�|jr5t||j �|_|j"j%�ddd�y#t$r|j��wxYw#1swYyxYw)z|Start live rendering display.

        Args:
            refresh (bool, optional): Also refresh. Defaults to False.
        NTF)r4rVrE�set_liverZrO�set_alt_screenrP�show_cursor�_enable_redirect_io�push_render_hookr6�	Exceptionr1rGr!r%rW�start)r)r6s  r+rgz
Live.startos���Z�Z�	-��}�}��	-�	-�!�D�M��<�<�(�(��.�#����	-�	-��|�|�#'�<�<�#>�#>�t�#D�� ��L�L�$�$�U�+��$�$�&��L�L�)�)�$�/����L�L�N�� � �'5�d�D�<S�<S�'T��$��$�$�*�*�,�5	-�	-��"!��
�I�I�K��
��#	-�	-�s0�E�*E�A4E�D&�AE�&E�E�E
c��|j5|js
	ddd�yd|_|jj�|jr;|j
s%|jj
|j�	ddd�y|jr-|j�!|jj�d|_	d|_|j5	|js&|jjs|j�|j�|jj!�|js0|jj"r|jj%�|jj'd�|jr|jj)d�|j
r?|js3|jj+|j,j/��|j0�'|j
r|j0j3�	ddd�ddd�y#|j�|jj!�|js0|jj"r|jj%�|jj'd�|jr|jj)d�|j
r?|js3|jj+|j,j/��|j0�(|j
r|j0j3�wwwxYw#1swY��?xYw#1swYyxYw)zStop live rendering display.NF�visibleT)r4rVrE�
clear_liverZrH�printr[rGrWr1rKrP�
is_jupyterr6�_disable_redirect_io�pop_render_hook�is_terminal�linercrb�controlrY�restore_cursorrU�closer0s r+r1z	Live.stop�s���
�Z�Z�	0��=�=��	0�	0�"�D�M��L�L�#�#�%��|�|��~�~��L�L�&�&�t���7��	0�	0�� � �T�%9�%9�%E��$�$�)�)�+�'+��$�%.�D�"����
0�0��+�+�D�L�L�4K�4K������-�-�/��L�L�0�0�2��+�+����0H�0H����)�)�+��L�L�,�,�T�2��'�'����3�3�E�:��~�~�d�.>�.>����,�,�T�->�->�-M�-M�-O�P����2�t�~�~����-�-�/�
0�	0�	0��(�-�-�/��L�L�0�0�2��+�+����0H�0H����)�)�+��L�L�,�,�T�2��'�'����3�3�E�:��~�~�d�.>�.>����,�,�T�->�->�-M�-M�-O�P����2�t�~�~����-�-�/�8F�2��
0�
0��	0�	0�sJ�M<�AM<�AM<�M/�2I�D&M/�2M<�D)M,�,M/�/M9	�4M<�<Nc�B�|j|jdu��|S)N�r6)rgrNr0s r+�	__enter__zLive.__enter__�s ���
�
�4�+�+�4�7�
�8��r,c�$�|j�yr.)r1)r)�exc_type�exc_val�exc_tbs    r+�__exit__z
Live.__exit__�s
��	
�	�	�r,c�:�|jjs|jjr�|jrjt	t
jt�sLt
j|_tdt|jt
j��t
_|jrlt	t
jt�sMt
j|_tdt|jt
j��t
_yyyy)z&Enable redirecting of stdout / stderr.rN)
rErorlrQ�
isinstance�sys�stdoutrrSrrR�stderrrTr0s r+rdzLive._enable_redirect_io�s����<�<�#�#�t�|�|�'>�'>��$�$�Z��
�
�I�-N�'*�z�z��$�!�(�I�d�l�l�C�J�J�,O�P��
��$�$�Z��
�
�I�-N�'*�z�z��$�!�(�I�d�l�l�C�J�J�,O�P��
�.O�$�	(?r,c���|jr&td|j�t_d|_|jr'td|j�t_d|_yy)z'Disable redirecting of stdout / stderr.rN)rSrr~rrTr�r0s r+rmzLive._disable_redirect_io�sQ������h��(<�(<�=�C�J�#'�D� �����h��(<�(<�=�C�J�#'�D� � r,c���|jj}|r,||dur%t|D�cgc]}|j���c}�}n|j�}|jrt|�S|Scc}w)zwGet the renderable that is being displayed

        Returns:
            RenderableType: Displayed renderable.
        r)rE�_live_stackrrLrPr)r)�
live_stackr$r[s    r+r[zLive.renderable�sk���\�\�-�-�
��$�*�Q�-�/��:� N�4��!4�!4�!6� N�O�J��,�,�.�J�%)�%5�%5�v�j�!�E�:�E��!Os�A.ruc���t|t�r|jj|�}|j5||_|r|j
�ddd�y#1swYyxYw)z�Update the renderable that is being displayed

        Args:
            renderable (RenderableType): New renderable to use.
            refresh (bool, optional): Refresh the display. Defaults to False.
        N)r}�strrE�
render_strr4rNr6)r)r[r6s   r+�updatezLive.update�sR���j�#�&����0�0��<�J�
�Z�Z�	�)�D�������	�	�	�s�A�A$c��|j5|jj|j�|jrG|j
jr'|j
jdj�	ddd�y|j
jr�	ddl	m
}ddlm}|j�|�|_
||j�|j5|jjd��|j
j|jj�ddd�n�|j
j&rO|j
j(s9|j
5|j
jt+��ddd�nP|j,sD|j.s8|j
5|j
jt+��ddd�ddd�y#1swY�xYw#t $rddl}|j%d�Y�5wxYw#1swY�BxYw#1swY�NxYw#1swYyxYw)z&Update the display of the Live Render.rN)�display)�OutputT)r3z(install "ipywidgets" for Jupyter support)r4rY�set_renderabler[rZrEr�r6rl�IPython.displayr��
ipywidgetsr�rU�clear_outputrk�ImportError�warnings�warnro�is_dumb_terminalrrVrH)r)r�r�r�s    r+r6zLive.refresh�s���
�Z�Z�	2����,�,�T�_�_�=��|�|��<�<�+�+��L�L�,�,�Q�/�7�7�9��	2�	2��|�|�&�&�I�7�1����.�*0�(�������0����I����4�4�$�4�?����*�*�4�+<�+<�+G�+G�H�I�I����)�)�$�,�,�2O�2O��\�\�2��L�L�&�&�w�y�1�2�2��M�M�$�.�.��\�\�2��L�L�&�&�w�y�1�2�;	2�	2�(I�I��#�N�#��M�M�"L�M�N��2�2��
2�2��;	2�	2�s��A0H:�H:�G>�)6H:�AG2�+AH:�,$H"�-H:�=$H.�!H:�2G;	�7H:�>H�H:�H�H:�"H+	�'H:�.H7	�3H:�:Ic��|j|j_|jjrb|j5|j
rt
j�n|jj�}|g|�|j�}ddd�|S|js|jsg|�|j�}|S#1swY|SxYw)z;Process renderables to restore cursor and display progress.N)rKrYrE�is_interactiver4rPr�home�position_cursorrVrH)r)�renderables�resets   r+�process_renderableszLive.process_renderabless���/3�.D�.D����+��<�<�&�&����
G��'�'��L�L�N��*�*�:�:�<��
 %�F�{�F�D�4E�4E�F��

G���	�
�
�d�n�n�;�K�;��):�):�;�K���
G���s�AB>�>Cr.)r[zOptional[RenderableType]rEzOptional[Console]rF�boolrGr�r%r8rHr�rIr�rJr�rKrrLz&Optional[Callable[[], RenderableType]]r9r:)r9r�)r9r)F)r6r�r9r:r;)r9r)rxzOptional[Type[BaseException]]ryzOptional[BaseException]rzzOptional[TracebackType]r9r:)r[rr6r�r9r:)r��List[ConsoleRenderable]r9r�)r<r=r>r?r(�propertyr]rLrgr1rvr{rdrmr[r�r6r��r,r+rBrB)s=��
�"04�'�&*��!�$%�� $� $�4>�AE�'�,�'�#�	'�
�'��
'�"�'��'��'��'�2�'�?�'�
�'�R���� � -�D 0�D��/��)��(�	�

��Q�(��
F��
F�EJ�� 2�D�2��	 �r,rB�__main__)�cycle)�Dictr�Tuple)�Align)r)rB)�Panel)�Rule)�Syntax)�Tablea~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�pythonT)�line_numbers�foo�bar�baz�1�2�3z�You can make the terminal shorter and taller to see the live table hideText 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)�type�textz	Syntax...zGive it a try!)�SGD�MYR�EUR�USD�AUD�JPY�CNH�HKD�CAD�INR�DKK�GBP�RUB�NZD�MXN�IDR�TWD�THB�VND)rEzDict[Tuple[str, str], float]�exchange_rate_dict�dg�������?�
��i@zExchange Rates)�titlezSource CurrencyzDestination Currencyz
Exchange Ratez.4fg�?�red�green)�style)X�
__future__rr~�	threadingrrr�typesr�typingrr	r
rrr
rrrr_rrErrrrrrqr�
file_proxyr�jupyterr�live_renderrrrFrr�r�typing_extensionsrr!rBr<�random�time�	itertoolsr�r�r��alignr�r$�panelr��ruler��syntaxr��tabler��add_row�progress_renderables�examples�	exchanges�
live_tabler��__annotations__�range�index�len�select_exchange�exchange�sleep�randint�log�next�pop�list�keys�
add_column�items�source�dest�
exchange_rater��centerr�r,r+�<module>r�s���"�
�*�*��W�W�W��R�R��!�!�;����&�(�V�(�&|�<��|�~�z�����(�(�� �"������i�G�
�
	"�	���F� 
�%���&�E�	�M�M�#�s�C� �	E�
�8�9�'�
�&��$4�5����
�����)�*�H��I�*
�g�	�!7�*�;=��8�=��3�Z�	7�E�'���I��(>�?�O�%�
7����.����
�
�3��!�6�>�>�!�R�(�1�,��K�K��X��/�BE�"�V�]�]�_�s�*�a�/�C�"�O�X�#>�?��)�*�S��^�a�-?�?�&�*�*�4�0B�0G�0G�0I�+J�1�+M�N��$4�5��� � �!2�3�� � �!7�8�� � ��1�5G�5M�5M�5O��1�N�V�T�M��M�M����,�S�1�+8�3�+>�%�G�����!�!�,�%�,�,�u�"5�6�7
7�	7�!7�!7�O�N!7�!7�s
�1E*J&�&J/