Viewing File: /opt/hc_python/lib/python3.12/site-packages/pip/_internal/cli/__pycache__/spinners.cpython-312.pyc

�

T�*j�����UddlmZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZddlm
Z
mZmZmZddlmZddlmZddlmZdd	lmZdd
lmZmZej8e�ZdZde d
<dZ!de d<Gd�d�Z"Gd�de"�Z#Gd�de"�Z$Gd�d�Z%ejLdd��Z'Gd�d�Z(ejLd d!d��Z)dZ*dZ+ejLd"d��Z,y)#�)�annotationsN)�	Generator)�IO�Final)�Console�ConsoleOptions�RenderableType�RenderResult)�Live)�Measurement)�Text)�WINDOWS)�get_console�get_indentationz-\|/r�
SPINNER_CHARS��SPINS_PER_SECONDc��eZdZdd�Zdd�Zy)�SpinnerInterfacec��t���N��NotImplementedError��selfs �I/opt/hc_python/lib/python3.12/site-packages/pip/_internal/cli/spinners.py�spinzSpinnerInterface.spin���!�#�#�c��t��rr�r�final_statuss  r�finishzSpinnerInterface.finish"rrN��return�None�r"�strr%r&)�__name__�
__module__�__qualname__rr#�rrrrs��$�$rrc�H�eZdZdedezf							dd�Zdd�Zd	d�Zd
d�Zy)�InteractiveSpinnerN�c� �||_|�tj}||_t	|�|_d|_tj|�|_	|jjdt�z|jzdz�d|_y)NF� � ... r)
�_message�sys�stdout�_file�RateLimiter�
_rate_limiter�	_finished�	itertools�cycle�_spin_cycle�writer�_width)r�message�file�
spin_chars�min_update_interval_secondss     r�__init__zInteractiveSpinner.__init__'su�� ��
��<��:�:�D���
�(�)D�E������$�?�?�:�6����
�
�����0�0�4�=�=�@�7�J�K���rc�X�|jrJ�d|jz}|jj|d|jzz|z�|jj|�t	|�|_|jj�|jj�y)N�r1)r9r>r6r=�len�flushr8�reset)r�status�backups   r�_writezInteractiveSpinner._write;s����>�>�!�!�����#���
�
����#����"3�3�f�<�=��
�
���� ��&�k����
�
������� � �"rc��|jry|jj�sy|jt	|j
��yr)r9r8�readyrK�nextr<rs rrzInteractiveSpinner.spinGs8���>�>���!�!�'�'�)�����D��)�)�*�+rc��|jry|j|�|jjd�|jj	�d|_y)N�
T)r9rKr6r=rGr!s  rr#zInteractiveSpinner.finishNsA���>�>�����L�!��
�
������
�
������r)r?r(r@zIO[str] | NonerAr(rB�float�rIr(r%r&r$r')	r)r*r+rrrCrKrr#r,rrr.r.&sM�� $�'�-.�1A�-A�
������	�&+�
�(
#�,�rr.c�.�eZdZddd�Zdd�Zd	d�Zd
d�Zy)�NonInteractiveSpinnerc�b�||_d|_t|�|_|j	d�y)NF�started)r3r9r7r8�_update)rr?rBs   rrCzNonInteractiveSpinner.__init__\s*����
����(�)D�E������Y�rc��|jrJ�|jj�tj	d|j
|�y)Nz%s: %s)r9r8rH�logger�infor3�rrIs  rrWzNonInteractiveSpinner._updatebs5���>�>�!�!���� � �"����H�d�m�m�V�4rc�v�|jry|jj�sy|jd�y)Nzstill running...)r9r8rMrWrs rrzNonInteractiveSpinner.spings.���>�>���!�!�'�'�)�����'�(rc�V�|jry|jd|�d��d|_y)Nzfinished with status '�'T)r9rWr!s  rr#zNonInteractiveSpinner.finishns)���>�>�����-�l�^�1�=�>���rN)gN@)r?r(rBrQr%r&rRr$r')r)r*r+rCrWrr#r,rrrTrT[s�� �5�
)�rrTc�$�eZdZdd�Zdd�Zdd�Zy)r7c� �||_d|_y)Nr)�_min_update_interval_seconds�_last_update)rrBs  rrCzRateLimiter.__init__vs��,G��)�#$��rc�f�tj�}||jz
}||jk\Sr)�timerbra)r�now�deltas   rrMzRateLimiter.readyzs.���i�i�k���d�'�'�'����9�9�9�9rc�6�tj�|_yr)rdrbrs rrHzRateLimiter.resets�� �I�I�K��rN)rBrQr%r&)r%�boolr$)r)r*r+rCrMrHr,rrr7r7us��%�:�
(rr7c#�K�tjj�r1tj	�t
jkrt|�}nt|�}	ttj�5|��ddd�|jd�y#1swY�xYw#t$r|jd��t$r|jd��wxYw�w)N�done�canceled�error)
r4r5�isattyrY�getEffectiveLevel�logging�INFOr.rT�
hidden_cursorr#�KeyboardInterrupt�	Exception)r?�spinners  r�open_spinnerru�s������z�z����v�7�7�9�W�\�\�I�$6�w�$?��'��0��
�
�3�:�:�
&��M�'�	���v��'�
&�������z�"�
������w��
��s6�AC�B"�7B�<B"�C�B�B"�"6C�Cc�P�eZdZdZdd�Z						d	d�Z						d
d�Zdd�Zdd�Zy)
�_PipRichSpinnerz�
    Custom rich spinner that matches the style of the legacy spinners.

    (*) Updates will be handled in a background thread by a rich live panel
        which will call render() automatically at the appropriate time.
    c��||_tjt�|_d|_d|_t�dz|_y)N�Fr1)	�labelr:r;rr<�
_spinner_textr9r�_indent)rrzs  rrCz_PipRichSpinner.__init__�s8����
�$�?�?�=�9���������&�(�3�.��rc#�0K�|j���y�wr)�render)r�console�optionss   r�__rich_console__z _PipRichSpinner.__rich_console__�s�����k�k�m��s�c�P�|j�}tj|||�Sr)r~r�get)rrr��texts    r�__rich_measure__z _PipRichSpinner.__rich_measure__�s"���{�{�}�����w���6�6rc��|jst|j�|_t	j
|j|jd|j�S)Nr2)r9rNr<r{r
�assembler|rzrs rr~z_PipRichSpinner.render�s?���~�~�!%�d�&6�&6�!7�D���}�}�T�\�\�4�:�:�w��@R�@R�S�Src� �||_d|_y)z-Stop spinning and set a final status message.TN)r{r9r[s  rr#z_PipRichSpinner.finish�s��#�����rN)rzr(r%r&)rrr�rr%r
)rrr�rr%r)r%r	rR)	r)r*r+�__doc__rCr�r�r~r#r,rrrwrw�sQ���/����)7��	��
7��7�)7�7�	�7�T�rrwc#�|K�tjtj�sd��y|xs
t	�}t|�}t
|t|��5	d��|jd�	ddd�y#t$r|jd��t$r|jd��wxYw#1swYyxYw�w)N)�refresh_per_secondrrjrkrl)rY�isEnabledForrorprrwrrr#rrrs)rzrrts   r�open_rich_spinnerr��s��������w�|�|�,�
���&���G��e�$�G�	
�g�*:�G�	L�		#��
�N�N�6�"�
M�	L��!�	��N�N�:�&���	��N�N�7�#��	��

M�	L�s6�AB<�B0�A7�B0�.	B<�76B-�-B0�0B9�5B<z[?25lz[?25hc#�(K�trd��y|j�r%tj�tj
kDrd��y|j
t�	d��|j
t�y#|j
t�wxYw�wr)	rrmrYrnrorpr=�HIDE_CURSOR�SHOW_CURSOR)r@s rrqrq�s\�����
��[�[�]�f�6�6�8�7�<�<�G�
��
�
�;��	$���J�J�{�#��D�J�J�{�#�s�AB�A8�"B�8B�B)r?r(r%z'Generator[SpinnerInterface, None, None]r)rzr(rzConsole | Noner%zGenerator[None])r@zIO[str]r%zGenerator[None, None, None])-�
__future__r�
contextlibr:ror4rd�collections.abcr�typingrr�pip._vendor.rich.consolerrr	r
�pip._vendor.rich.liver�pip._vendor.rich.measurer�pip._vendor.rich.textr
�pip._internal.utils.compatr�pip._internal.utils.loggingrr�	getLoggerr)rYr�__annotations__rrr.rTr7�contextmanagerrurwr�r�r�rqr,rr�<module>r�s���"����
��%����'�0�&�.�D�	��	�	�8�	$���
�u����%��$�$�.�)�.�j�,��4(�(�������.#�#�L���#��#�*�������$��$r
Back to Directory File Manager