HEX
Server: LiteSpeed
System: Linux srv146.niagahoster.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User: kodi1989 (1633)
PHP: 8.1.34
Disabled: symlink,shell_exec,exec,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/rich/__pycache__/_wrap.cpython-37.pyc
B

��fL
�@s�ddlmZddlZddlmZddlmZddlmZm	Z	e�
d�Zdd	d
�dd�Zdddddd�dd�Z
edkr�ddlmZedd�Ze�d�ee	dd��edd�Ze��e�d�e��e�d�dS)�)�annotationsN)�Iterable�)�	loop_last)�cell_len�
chop_cellsz	\s*\S+\s*�strzIterable[tuple[int, int, str]])�text�returnccsPd}t�||�}x:|dk	rJ|��\}}|�d�}|||fVt�||�}qWdS)z�Yields each word from the text as a tuple
    containing (start_index, end_index, word). A "word" in this context may
    include the actual word and any whitespace to the right.
    rN)�re_word�match�span�group)r	�positionZ
word_match�start�end�word�r�;/opt/alt/python37/lib/python3.7/site-packages/rich/_wrap.py�wordss

rT�int�boolz	list[int])r	�width�foldr
cCs�g}|j}d}t}x�t|�D]�\}}}	||	���}
||}||
k}|rT|||	�7}q|
|kr�|r�t|	|d�}
xPt|
�D].\}}|r�||�|r�||�}qv|t|�7}qvWq�|r�||�||	�}q|r|r||�||	�}qW|S)a�Given a string of text, and a width (measured in cells), return a list
    of cell offsets which the string should be split at in order for it to fit
    within the given width.

    Args:
        text: The text to examine.
        width: The available cell width.
        fold: If True, words longer than `width` will be folded onto a new line.

    Returns:
        A list of indices to break the line at.
    r)r)�appendrr�rstriprr�len)r	rrZbreak_positionsrZcell_offsetZ	_cell_lenrZ_endrZword_lengthZremaining_spaceZword_fits_remaining_spaceZfolded_word�last�linerrr�divide_lines4


r�__main__)�Console�
)rz@12345 abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ 12345�abcdefghijklmnopqrstuvwxyz�uRTextualはPythonの高速アプリケーション開発フレームワークですu4アプリケーションは1670万色を使用でき)T)�
__future__r�re�typingrZ_loopr�cellsrr�compilerrr�__name__�consoler!�printZrulerrrr�<module>s"
7