%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/rich/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/rich/__pycache__/cells.cpython-312.pyc

�

"T�e����ddlmZddlZddlmZddlmZddlmZejd�jZed�dd	��Zefdd
�Z
ed��dd��Zed��dd
��Zdd�Z						dd�Zedk(rQeed��edd�D]
Zee��eddd�D]Zeede�dz�edez��!yy)�)�annotationsN)�	lru_cache)�Callable�)�CELL_WIDTHSu^[ -o ˿Ͱ-҂]*$ic�<��t�t�fd�|D��}|S)a/Get the number of cells required to display text.

    This method always caches, which may use up a lot of memory. It is recommended to use
    `cell_len` over this method.

    Args:
        text (str): Text to display.

    Returns:
        int: Get the number of cells required to display text.
    c3�.�K�|]}�|����y�w�N���.0�	character�	_get_sizes  ��,/usr/lib/python3/dist-packages/rich/cells.py�	<genexpr>z"cached_cell_len.<locals>.<genexpr>������@�i�Y�y�)�@���)�get_character_cell_size�sum)�text�
total_sizers  @r�cached_cell_lenr
s ���(�I��@�4�@�@�J���c�h��t|�dkr||�St�t�fd�|D��}|S)z�Get the number of cells required to display text.

    Args:
        text (str): Text to display.

    Returns:
        int: Get the number of cells required to display text.
    ic3�.�K�|]}�|����y�wr
rrs  �rrzcell_len.<locals>.<genexpr>+rr)�lenrr)r�	_cell_lenrrs   @r�cell_lenrs5����4�y�3������'�I��@�4�@�@�J��r)�maxsizec�*�tt|��S)z�Get the cell size of a character.

    Args:
        character (str): A single character.

    Returns:
        int: Number of cells (0, 1 or 2) occupied by that character.
    )�_get_codepoint_cell_size�ord)rs rrr/s��$�C�	�N�3�3rc��t}d}t|�dz
}||zdz}	||\}}}||kr|dz
}n||kDr|dz}n	|dk(rdS|S||kr	y||zdz}�8)z�Get the cell size of a character.

    Args:
        codepoint (int): Codepoint of a character.

    Returns:
        int: Number of cells (0, 1 or 2) occupied by that character.
    rr����)rr)�	codepoint�_table�lower_bound�upper_bound�index�start�end�widths        rr!r!<s����F��K��f�+��/�K�
�;�
&�1�,�E�
�"�5�M���s�E��u���!�)�K�
��_��!�)�K����1�.��.���$����{�*�q�0��rc�`�t|�r t|�}||kr|d||z
zzS|d|S|dkryt|�}||k(r|S||kr|d||z
zzSd}t|�}	||zdz}|d|dz}t|�}||dzk(rt|d�dk(r|dddzS||k(r|S||kDr|}n|}�N)z?Set the length of a string to fit within given number of cells.� Nr�r$rr%)�_is_single_cell_widthsrr)	r�total�size�	cell_sizer+r,�pos�before�
before_lens	         r�
set_cell_sizer8Ys���d�#��4�y���%�<��#����.�.�.��F�U�|����z�����I��E�����5���c�U�Y�.�/�/�/�
�E�

�d�)�C���s�{�q� ���i��a�����f�%�
�����"�x��r�
�';�q�'@��#�2�;��$�$�����M�����C��E�rc��t}gg}|j}|dj}d}|D]<}||�}||z|kD}	|	r||g�|dj}|}�0||�||z
}�>|D�
cgc]}
dj|
���c}
Scc}
w)ahSplit text into lines such that each line fits within the available (cell) width.

    Args:
        text: The text to fold such that it fits in the given width.
        width: The width available (number of cells).

    Returns:
        A list of strings such that each string in the list has cell width
        less than or equal to the available width.
    r%rr0)r�append�join)rr-�_get_character_cell_size�lines�append_new_line�append_to_last_line�total_widthr�
cell_width�char_doesnt_fit�lines           r�
chop_cellsrD|s��� 7�� �T�E��l�l�O���)�*�*���K��
&�	�-�i�8�
�%�
�2�U�:����Y�K�(�"'��)�"2�"2��$�K��	�*��:�%�K�
&�',�,�d�B�G�G�D�M�,�,��,s�,B�__main__u😽u]这是对亚洲语言支持的测试。面对模棱两可的想法,拒绝猜测的诱惑。��Pr%�|�x)r�str�return�int)rrJrzCallable[[str], int]rKrL)rrJrKrL)r&rLrKrL)rrJr2rLrKrJ)rrJr-rLrKz	list[str])�
__future__r�re�	functoolsr�typingr�_cell_widthsr�compile�matchr1rrrr!r8rD�__name__�printrC�range�nrrr�<module>rXs7��"�	���%�$����$Q�R�X�X���4�����";J�
� �4��	4��	4��4��
��
�8 �F"-�

�"-��"-��"-�J�z��	�
!�&�
)�*��~�AB�C���
�d���
�2�q�"�
���
�m��BC�D�GJ�J�	K�
�c�A�g���	r

Zerion Mini Shell 1.0