HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/rich/__pycache__/cells.cpython-311.pyc
�

�;f�����ddlmZddlZddlmZddlmZddlmZej	d��j
Zed��d#d
���Zefd$d�Z
ed���d%d���Zed���d&d���Zd'd�Zd(d�Zedkrdeed����edd��D]
Zee���eddd ��D]*Zeede��d!z��ed"ez���)dSdS))�)�annotationsN)�	lru_cache)�Callable�)�CELL_WIDTHSu^[ -o ˿Ͱ-҂]*$i�text�str�return�intc�L��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�|]}�|��V��dS�N���.0�	character�	_get_sizes  ��=/opt/alt/python311/lib/python3.11/site-packages/rich/cells.py�	<genexpr>z"cached_cell_len.<locals>.<genexpr>�-�����@�@�i�Y�Y�y�)�)�@�@�@�@�@�@�)�get_character_cell_size�sum)r�
total_sizers  @r�cached_cell_lenr
s2���(�I��@�@�@�@�4�@�@�@�@�@�J��r�	_cell_len�Callable[[str], int]c���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�|]}�|��V��dSrrrs  �rrzcell_len.<locals>.<genexpr>+rr)�lenrr)rrrrs   @r�cell_lenr!sO����4�y�y�3����y�����'�I��@�@�@�@�4�@�@�@�@�@�J��r)�maxsizerc�:�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�N�3�3�3r�	codepointc���t}d}t|��dz
}||zdz}	||\}}}||kr|dz
}n||kr|dz}n
|dkrdn|S||krn	||zdz}�>dS)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�T���)rr )r&�_table�lower_bound�upper_bound�index�start�end�widths        rr$r$<s����F��K��f�+�+��/�K�
�;�
&�1�,�E�
1�"�5�M���s�E��u����!�)�K�K�
��_�_��!�)�K�K�����1�1��.���$�$���{�*�q�0��
1�
�1r�totalc���t|��r*t|��}||kr|d||z
zzS|d|�S|dkrdSt|��}||kr|S||kr|d||z
zzSd}t|��}	||zdz}|d|dz�}t|��}||dzkr&t|d��dkr
|dd�dzS||kr|S||kr|}n|}�g)	z?Set the length of a string to fit within given number of cells.� Nr�Tr(rr))�_is_single_cell_widthsr r!)	rr1�size�	cell_sizer.r/�pos�before�
before_lens	         r�
set_cell_sizer;Ys8���d�#�#���4�y�y���%�<�<��#����.�.�.��F�U�F�|����z�z��r�����I��E������5����c�U�Y�.�/�/�/�
�E�

�d�)�)�C���s�{�q� ���i��a��i����f�%�%�
�����"�"�x��r�
�';�';�q�'@�'@��#�2�#�;��$�$������M������C�C��E�rr0�	list[str]c���t}gg}|j}|dj}d}|D]D}||��}||z|k}	|	r||g��|dj}|}�4||��||z
}�Ed�|D��S)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)rc�8�g|]}d�|����S)r4)�join)r�lines  r�
<listcomp>zchop_cells.<locals>.<listcomp>�s"��,�,�,�d�B�G�G�D�M�M�,�,�,r)r�append)
rr0�_get_character_cell_size�lines�append_new_line�append_to_last_line�total_widthr�
cell_width�char_doesnt_fits
          r�
chop_cellsrJ|s��� 7�� �T�E��l�O���)�*���K��
&�
&�	�-�-�i�8�8�
�%�
�2�U�:���	&��O�Y�K�(�(�(�"'��)�"2��$�K�K���	�*�*�*��:�%�K�K�,�,�e�,�,�,�,r�__main__u😽u]这是对亚洲语言支持的测试。面对模棱两可的想法,拒绝猜测的诱惑。��Pr)�|�x)rr	r
r)rr	rrr
r)rr	r
r)r&rr
r)rr	r1rr
r	)rr	r0rr
r<)�
__future__r�re�	functoolsr�typingr�_cell_widthsr�compile�matchr5rr!rr$r;rJ�__name__�printr@�range�nrrr�<module>r[s��"�"�"�"�"�"�	�	�	�	�������������%�%�%�%�%�%�$���$Q�R�R�X����4���������";J�
�
�
�
�
� ��4����	4�	4�	4���	4���4����
�
�
���
�8 � � � �F"-�"-�"-�"-�J�z���	�E�
!�
!�&�
)�
)�*�*�*��
�~�AB�C�C����
��d�����
�U�2�q�"�
�
����
��m�m��BC�D�D�GJ�J�	K�	K�	K�
��c�A�g�����
���r