$78 GRAYBYTE WORDPRESS FILE MANAGER $65

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.162.162 | ADMIN IP 216.73.217.100
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/rich/__pycache__/

HOME
Current File : /opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/rich/__pycache__//text.cpython-38.pyc
U

ʗRez��@sBUddlZddlmZmZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZddlmZddlmZdd	lmZdd
lmZddlmZmZddlmZdd
l m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+m,Z,e	�rddl-m.Z.m/Z/m0Z0m1Z1dZ2de3d<dZ4de3d<e�5d�Z6ee7dfZ8ee7gee,fZ9Gdd�de�Z:Gdd�de%�Z;e<dk�r>dd l=m.Z.e;d!�Z>e>�?d"gd#�e>�?d$gd%�e.�Z-e-�@d&�e-jAe>d'd(�e-�A�e-�@d)�e-jAe>d*d+d,�e-�A�e-�@d-�e-jAe>d.d/d,�e-�A�e-�@d0�e-jAe>d1d2d,�e-�A�dS)3�N)�partial�reduce)�gcd)�
itemgetter)
�
TYPE_CHECKING�Any�Callable�Dict�Iterable�List�
NamedTuple�Optional�Tuple�Union�)�	loop_last)�	pick_bool)�divide_line)�AlignMethod)�cell_len�
set_cell_size)�Lines)�strip_control_codes)�EmojiVariant)�JupyterMixin)�Measurement)�Segment)�Style�	StyleType)�Console�ConsoleOptions�
JustifyMethod�OverflowMethod�defaultr!�DEFAULT_JUSTIFY�foldr"�DEFAULT_OVERFLOWz\s+$�Textc@s�eZdZUdZeed<eed<eeefed<ed�dd�Z	e
d�dd	�Zeede
dfd
�dd�Zedd
�d
d�Zedd
�dd�ZdS)�Spanz A marked up region in some text.�start�end�style��returncCsTt|jt�r2|jjr2d|j�d|j�d|j�d�Sd|j�d|j�dt|j��d�S)NzSpan(z, �))�
isinstancer+r�_metar)r*�repr��self�r4��/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/rich/text.py�__repr__7s
��  �z
Span.__repr__cCs|j|jkS�N)r*r)r2r4r4r5�__bool__>sz
Span.__bool__��offsetr-cCsV||jkr|dfS||jkr$|dfS|\}}}t|t||�|�}t|j||�}||fS)z)Split a span in to 2 from a given offset.N)r)r*r(�min)r3r:r)r*r+�span1�span2r4r4r5�splitAs


z
Span.splitcCs|\}}}t|||||�S)z�Move start and end by a given offset.

        Args:
            offset (int): Number of characters to add to start and end.

        Returns:
            TextSpan: A new TextSpan with adjusted position.
        )r(�r3r:r)r*r+r4r4r5�moveNs	
z	Span.movecCs(|\}}}||kr|St|t||�|�S)z�Crop the span at the given offset.

        Args:
            offset (int): A value between start and end.

        Returns:
            Span: A new (possibly smaller) span.
        )r(r;r?r4r4r5�
right_cropZs	
zSpan.right_cropN)�__name__�
__module__�__qualname__�__doc__�int�__annotations__r�strrr6�boolr8rr
r>r@rAr4r4r4r5r(-s

r(c
@s�eZdZdZdddddddd	d
g	Zd�dddd
ddd�eeeefededee	eee
eeedd�	dd�Z
e
d�dd�Ze	d�dd�Zed�dd�Zed�dd�Zedd�dd �Zee	d�d!d"�Zee	d�d#d$�Zee
efdd%�d&d'�Zee
d�d(d)��Zeed�d*d+��Zedd,dddd
d-�eeeefe	eeedededd.�d/d0��Zeddddd
dd1�eeeefededee	eee
dd2�d3d4��Zed�ddd5�ee ededdd6�d7d8��Z!eddddd
ddd9�eede"ee ffeeefededee	ee
ee#eefdd:�	d;d<��Z$eed�d=d>��Z%e%j&edd?�d@d>��Z%eeed�dAdB��Z'e'j&eeddC�dDdB��Z'd�eddE�dFdG�Z(dd�dHdI�Z)d�eeefe
ee
ddK�dLdM�Z*d�e#eefe
ee
ddN�dOdP�Z+d�ee#eefeddQ�dRdS�Z,eddT�dUdV�Z-dWe
edX�dYdZ�Z.d�dd[�eeee/e fee
d\�d]d^�Z0d,d_�e1eeeefe	e
d`�dadb�Z2dd�dcdd�Z3e
dde�dfdg�Z4e
ddh�didj�Z5dWdke1e6dl�dmdn�Z7dWdke8dl�dodp�Z9d�dWee1dqdr�dsdt�Z:e1dddu�dvdw�Z;d�ee
ddx�dydz�Z<dd{d|�e
ede	dd}�d~d�Z=dd�d�d��Z>d�e
edd��d�d��Z?d�e
edd��d�d��Z@d�e
edd��d�d��ZAd�eBe
edd��d�d��ZCd�edefeeed�fdd��d�d��ZDddd��d�d��ZEe1e"eee fdd��d�d��ZFddd��d�d��ZGd�d{d{d��ee	e	eHd��d�d��ZIe1e
eHd��d�d��ZJd�e
dd��d�d��ZKddddd��dWe
edede
ee	eHd��d�d��ZLe
eHd��d�d��ZMe
d�d�d��ZNd�d�d�d��ee
ee dd��d�d��ZOdS)�r'a�Text with color / style.

    Args:
        text (str, optional): Default unstyled text. Defaults to "".
        style (Union[str, Style], optional): Base style for text. Defaults to "".
        justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
        overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.
        no_wrap (bool, optional): Disable text wrapping, or None for default. Defaults to None.
        end (str, optional): Character to end text with. Defaults to "\\n".
        tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to 8.
        spans (List[Span], optional). A list of predefined style spans. Defaults to None.
    �_textr+�justify�overflow�no_wrapr*�tab_size�_spans�_length�N�
�)rKrLrMr*rN�spansr!r")	�textr+rKrLrMr*rNrTr-c
CsLt|�}	|	g|_||_||_||_||_||_||_|p:g|_t	|	�|_
dSr7)rrJr+rKrLrMr*rNrO�lenrP)
r3rUr+rKrLrMr*rNrT�sanitized_textr4r4r5�__init__�s
z
Text.__init__r,cCs|jSr7)rPr2r4r4r5�__len__�szText.__len__cCs
t|j�Sr7)rIrPr2r4r4r5r8�sz
Text.__bool__cCs|jSr7��plainr2r4r4r5�__str__�szText.__str__cCsd|j�d|j�d�S)Nz<text � �>)r[rOr2r4r4r5r6�sz
Text.__repr__)�otherr-cCs(t|ttf�r$|��}|�|�|StSr7)r/rHr'�copy�append�NotImplemented)r3r_�resultr4r4r5�__add__�s

zText.__add__cCs&t|t�stS|j|jko$|j|jkSr7)r/r'rbr[rO�r3r_r4r4r5�__eq__�s
zText.__eq__cCs.t|t�r||jkSt|t�r*|j|jkSdS)NF)r/rHr[r'rer4r4r5�__contains__�s



zText.__contains__)�slicer-csftdd��fdd�}t|t�r&||�S|�t�j��\}}}|dkrZ��||g�}|dStd��dS)Nr'r9cs.t�t�j���fdd��jD�dd�}|S)Ncs6g|].\}}}|�kr"|krnq�dd|��qS)rrr4��.0r)r*r+��_Spanr:r4r5�
<listcomp>�s

�z9Text.__getitem__.<locals>.get_text_at.<locals>.<listcomp>rQ)rTr*)r(r'r[rO)r:rUr2rkr5�get_text_at�s��	z%Text.__getitem__.<locals>.get_text_atrz%slices with step!=1 are not supported)rFr/�indicesrVr[�divide�	TypeError)r3rhrnr)�stop�step�linesr4r2r5�__getitem__�s
zText.__getitem__cCs
t|j�S)z5Get the number of cells required to render this text.)rr[r2r4r4r5r�sz
Text.cell_lencCs�ddlm}g}|j}dd|jffdd�|jD�dd�|jD�t|�d|jff�}|jtdd�d	�d}|j}|D]N\}}}	||kr�|||||���|}|	rr||r�d
|	�d�n
d|	�d��qrd
�	|�}
|
S)z~Get console markup to render this Text.

        Returns:
            str: A string potentially creating markup tags.
        r)�escaperFcss|]}|jd|jfVqdS�FN)r)r+�rj�spanr4r4r5�	<genexpr>�szText.markup.<locals>.<genexpr>css|]}|jd|jfVqdS�TN)r*r+rxr4r4r5rz�sT��keyz[/�]�[rQ)
�markuprvr[r+rOrV�sortrra�join)r3rv�outputr[�markup_spans�positionrar:�closingr+r�r4r4r5r��s(
��"
zText.markupT)r+�emoji�
emoji_variantrKrLr*)rUr+r�r�rKrLr*r-c
Cs2ddlm}|||||d�}	||	_||	_||	_|	S)a,Create Text instance from markup.

        Args:
            text (str): A string containing console markup.
            emoji (bool, optional): Also render emoji code. Defaults to True.
            justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
            overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.
            end (str, optional): Character to end text with. Defaults to "\\n".

        Returns:
            Text: A Text instance with markup rendered.
        r)�render)r�r�)r�r�rKrLr*)
�clsrUr+r�r�rKrLr*r��
rendered_textr4r4r5�from_markup�szText.from_markup�r+rKrLrMr*rN)rUr+rKrLrMr*rNr-c	CsFddlm}td||||||d�}	|�}
|	�dd�|
�|�D��}|S)a�Create a Text object from a string containing ANSI escape codes.

        Args:
            text (str): A string containing escape codes.
            style (Union[str, Style], optional): Base style for text. Defaults to "".
            justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
            overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.
            no_wrap (bool, optional): Disable text wrapping, or None for default. Defaults to None.
            end (str, optional): Character to end text with. Defaults to "\\n".
            tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to 8.
        r)�AnsiDecoderrR)rKrLrMr*rNr+css|]
}|VqdSr7r4�rj�liner4r4r5rz9sz!Text.from_ansi.<locals>.<genexpr>)�ansir�r'r��decode)r�rUr+rKrLrMr*rNr��joiner�decoderrcr4r4r5�	from_ansis�	zText.from_ansi�rKrL)rUr+rKrLr-cCs||||d�}|�|�|S)aaConstruct a Text instance with a pre-applied styled. A style applied in this way won't be used
        to pad the text when it is justified.

        Args:
            text (str): A string containing console markup.
            style (Union[str, Style]): Style to apply to the text. Defaults to "".
            justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
            overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.

        Returns:
            Text: A text instance with a style applied to the entire string.
        r�)�stylize)r�rUr+rKrL�styled_textr4r4r5�styled<s
zText.styled)r+rKrLrMr*rN�meta)	�partsr+rKrLrMr*rNr�r-c
GsZ|||||||d�}	|	j}
t}|D]$}t||tf�r>|
|�q"|
|�q"|rV|	�|�|	S)aRConstruct a text instance by combining a sequence of strings with optional styles.
        The positional arguments should be either strings, or a tuple of string + style.

        Args:
            style (Union[str, Style], optional): Base style for text. Defaults to "".
            justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
            overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.
            end (str, optional): Character to end text with. Defaults to "\\n".
            tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to 8.
            meta (Dict[str, Any], optional). Meta data to apply to text, or None for no meta data. Default to None

        Returns:
            Text: A new text instance.
        r�)rar'r/rH�
apply_meta)
r�r+rKrLrMr*rNr�r�rUra�_Text�partr4r4r5�assembleUs"�


z
Text.assemblecCs0t|j�dkr&d�|j�g|jdd�<|jdS)z Get the text as a single string.rrQNr)rVrJr�r2r4r4r5r[�sz
Text.plain)�new_textr-cCsH||jkrDt|�}|g|jdd�<|j}t|�|_||jkrD|��dS)zSet the text to a new value.N)r[rrJrPrV�_trim_spans)r3r�rW�
old_lengthr4r4r5r[�s


cCs|jS)z.Get a reference to the internal list of spans.�rOr2r4r4r5rT�sz
Text.spans)rTr-cCs|dd�|_dS)z
Set spans.Nr�)r3rTr4r4r5rT�s)r[r-c	Cs&t||j|j|j|j|j|jd�}|S)zOReturn a new Text instance with copied meta data (but not the string or spans).r�)r'r+rKrLrMr*rN)r3r[�	copy_selfr4r4r5�
blank_copy�s�	zText.blank_copyc	Cs8t|j|j|j|j|j|j|jd�}|j|jdd�<|S)zReturn a copy of this instance.r�N)	r'r[r+rKrLrMr*rNrO)r3r�r4r4r5r`�s�	z	Text.copyr)r+r)r*r-cCsj|rft|�}|dkr||}|dkr(|}|dkr8||}||ksH||krLdS|j�t|t||�|��dS)a{Apply a style to the text, or a portion of the text.

        Args:
            style (Union[str, Style]): Style instance or style definition to apply.
            start (int): Start offset (negative indexing is supported). Defaults to 0.
            end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None.

        rN)rVrOrar(r;)r3r+r)r*�lengthr4r4r5r��szText.stylize)r�r)r*r-cCst�|�}|j|||d�dS)ahApply meta data to the text, or a portion of the text.

        Args:
            meta (Dict[str, Any]): A dict of meta information.
            start (int): Start offset (negative indexing is supported). Defaults to 0.
            end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None.

        )r)r*N)r�	from_metar�)r3r�r)r*r+r4r4r5r��s
zText.apply_meta)r��handlersr-cKs<|dkrin|}|�dd�|��D��|�t�|��|S)a�Apply event handlers (used by Textual project).

        Example:
            >>> from rich.text import Text
            >>> text = Text("hello world")
            >>> text.on(click="view.toggle('world')")

        Args:
            meta (Dict[str, Any]): Mapping of meta information.
            **handlers: Keyword args are prefixed with "@" to defined handlers.

        Returns:
            Text: Self is returned to method may be chained.
        NcSsi|]\}}d|��|�qS)�@r4)rjr}�valuer4r4r5�
<dictcomp>�szText.on.<locals>.<dictcomp>)�update�itemsr�rr�)r3r�r�r4r4r5�on�szText.on)�suffixr-cCs|j�|�r|�t|��dS)zaRemove a suffix if it exists.

        Args:
            suffix (str): Suffix to remove.
        N)r[�endswithrArV)r3r�r4r4r5�
remove_suffix�szText.remove_suffixr)�consoler:r-cCsf|dkrt|�|}|j}||j���}|jD]2\}}}||krL|kr.nq.|||dd�7}q.|S)a
Get the style of a character at give offset.

        Args:
            console (~Console): Console where text will be rendered.
            offset (int): Offset in to text (negative indexing supported)

        Returns:
            Style: A Style instance.
        rrQ�r#)rV�	get_styler+r`rO)r3r�r:r�r+r)r*�
span_styler4r4r5�get_style_at_offset�szText.get_style_at_offset)�style_prefix)�re_highlightr+r�r-cCs�d}|jj}t}|j}t�||�D]�}|j}	|rv|	�\}
}t|�rR|||
|��n|}|dk	rv||
krv|||
||��|d7}|���	�D]8}
|	|
�\}
}|
dkr�||
kr�|||
||�|
����q�q"|S)aHighlight text with a regular expression, where group names are
        translated to styles.

        Args:
            re_highlight (str): A regular expression.
            style (Union[GetStyleCallable, StyleType]): Optional style to apply to whole match, or a callable
                which accepts the matched text and returns a style. Defaults to None.
            style_prefix (str, optional): Optional prefix to add to style group names.

        Returns:
            int: Number of regex matches
        rNr���)
rOrar(r[�re�finditerry�callable�	groupdict�keys)r3r�r+r��count�append_spanrlr[�match�get_spanr)r*�match_style�namer4r4r5�highlight_regexs"
zText.highlight_regex)�case_sensitive)�wordsr+r�r-cCspd�dd�|D��}|jj}d}t}tj||j|r6dntjd�D]*}|�d�\}	}
|||	|
|��|d7}q@|S)aDHighlight words with a style.

        Args:
            words (Iterable[str]): Worlds to highlight.
            style (Union[str, Style]): Style to apply.
            case_sensitive (bool, optional): Enable case sensitive matchings. Defaults to True.

        Returns:
            int: Number of words highlighted.
        �|css|]}t�|�VqdSr7)r�rv�rj�wordr4r4r5rzJsz'Text.highlight_words.<locals>.<genexpr>r��flagsr)	r�rOrar(r�r�r[�
IGNORECASEry)r3r�r+r��re_words�add_spanr�rlr�r)r*r4r4r5�highlight_words9s�

zText.highlight_wordscCs|j��|_dS)z"Strip whitespace from end of text.N)r[�rstripr2r4r4r5r�VszText.rstrip)�sizer-cCsNt|�}||krJ||}t�|j�}|dk	rJt|�d��}|�t||��dS)z�Remove whitespace beyond a certain width at the end of the text.

        Args:
            size (int): The desired size of the text.
        Nr)rV�_re_whitespace�searchr[�grouprAr;)r3r��text_length�excess�whitespace_match�whitespace_countr4r4r5�
rstrip_endZszText.rstrip_end)�
new_lengthr-cCs:t|�}||kr6||kr(|�||�n|�||�dS)z<Set new length of the text, clipping or padding is required.N)rV�	pad_rightrA)r3r�r�r4r4r5�
set_lengthhs
zText.set_lengthr )r��optionsr-c
cs�|jp|jpd}|jp|jpt}|jp.|jp.t}|j||j|||pDdt|j|jd�d�}t	d��
|�}|j||jd�EdHdS)NrSF�rKrLrNrMrR�r*)
rNrKr$rLr&�wrap�	max_widthrrMr'r�r�r*)r3r�r�rNrKrLrt�	all_linesr4r4r5�__rich_console__qs�zText.__rich_console__cCsT|j}|��}|r$tdd�|D��nd}|��}|rFtdd�|D��n|}t||�S)Ncss|]}t|�VqdSr7�rr�r4r4r5rz�sz(Text.__rich_measure__.<locals>.<genexpr>rcss|]}t|�VqdSr7r�r�r4r4r5rz�s)r[�
splitlines�maxr>r)r3r�r�rUrt�max_text_widthr��min_text_widthr4r4r5�__rich_measure__�s�zText.__rich_measure__r)r�r*r-c#sXt}|j}|js,t|�V|r(||�VdSt|jt��d��tt|jd��}�fdd�|D���|j	��d<ddd	�|D�d
d	�|D�t
|�ddff�}|jtdd�d�g��j
}�j}i��j�tj�td
������fdd�}	t||dd��D]J\\}
}}\}
}}|�r||�n||�|
|
kr�|||
|
�|	��Vq�|�rT||�VdS)aRender the text as Segments.

        Args:
            console (Console): Console instance.
            end (Optional[str], optional): Optional end character.

        Returns:
            Iterable[Segment]: Result of render that may be written to the console.
        Nr�rcsi|]\}}|�|j��qSr4�r+�rj�indexry)r�r4r5r��szText.render.<locals>.<dictcomp>r�rFrcss|]\}}|jd|fVqdSrw)r)r�r4r4r5rz�szText.render.<locals>.<genexpr>css|]\}}|jd|fVqdSr{r�r�r4r4r5rz�sTr|r,csBt�fdd�t��D��}�|�}|dk	r.|S�|�}|�|<|S)z#Construct current style from stack.c3s|]}�|VqdSr7r4)rj�	_style_id)�	style_mapr4r5rz�sz9Text.render.<locals>.get_current_style.<locals>.<genexpr>N)�tuple�sorted)�styles�cached_style�
current_style)�combine�stack�style_cache�style_cache_getr�r4r5�get_current_style�sz&Text.render.<locals>.get_current_style)r�)rr[rOrr�r�null�list�	enumerater+rVr�rra�remove�getr��zip)r3r�r*�_SegmentrU�enumerated_spansrT�stack_append�	stack_popr�r:�leaving�style_id�next_offset�_r4)r�r�r�r�r�r�r5r��sB


��
&
zText.render)rtr-cs����}tdd���fdd�}|jj}|jj}|jj}d�t�|�D]T}||j�|jrt|���t|�|j��|��fdd�|jD���t|�7�qF�|_	|S)z�Join text together with this instance as the separator.

        Args:
            lines (Iterable[Text]): An iterable of Text instances to join.

        Returns:
            Text: A new text instance containing join text.
        r'r,c3s8�jr*t��D]\}}|V|s�Vqn
�EdHdSr7)r[r)�lastr�)rtr3r4r5�	iter_text�s
zText.join.<locals>.iter_textrc3s(|] \}}}��|�||�VqdSr7r4rirkr4r5rz�s�zText.join.<locals>.<genexpr>)
r�r
rJ�extendrOrar(r+rVrP)r3rtr�r
�extend_textr��extend_spansrUr4)rlrtr:r3r5r��s"
	

�z	Text.join)rNr-c
Csd|jkrdSd}|dkr |j}|dk	s,t�|��}|j}|j}|jddd�D]�}|jddd�}|D]r}|j�d�r�|jdd�dg|_||�|t	|�7}||d	|d	}	|	r�|d|	|�||	7}qd||�qdqN|jg|_t	|j�|_
|j|jdd�<dS)
ztConverts tabs to spaces.

        Args:
            tab_size (int, optional): Size of tabs. Defaults to 8.

        �	NrrRT)�include_separatorr�r]r)r[rN�AssertionErrorr�rar+r>r�rJrVrPrO)
r3rN�posrcra�_styler�r�r��spacesr4r4r5�expand_tabs�s0


zText.expand_tabsF)rL�pad)r�rLrr-cCs�|p|jpt}|dkr�t|j�}||krV|dkrHt|j|d�d|_nt|j|�|_|r�||kr�||}|j�d|��g|_t|j�|_dS)auTruncate text if it is longer that a given width.

        Args:
            max_width (int): Maximum number of characters in text.
            overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to None, to use self.overflow.
            pad (bool, optional): Pad with spaces if the length is less than max_width. Defaults to False.
        �ignore�ellipsisru…r]N)rLr&rr[rrJrVrP)r3r�rLr�	_overflowr�rr4r4r5�truncates
z
Text.truncatecs2t|j��t���fdd�|jD�|jdd�<dS)z=Remove or modify any spans that are over the end of the text.cs<g|]4}|j�kr|j�kr |n�|jt�|j�|j��qSr4�r)r*r;r+rx�rl�
max_offsetr4r5rm3s

��z$Text._trim_spans.<locals>.<listcomp>N)rVr[r(rOr2r4rr5r�/s

�zText._trim_spansr])r��	characterr-cs\t|�dkstd���rX|�}|�|j�|��|_t���fdd�|jD�|jdd�<dS)zxPad left and right with a given number of characters.

        Args:
            count (int): Width of padding.
        r�&Character must be a string of length 1cs&g|]\}}}�|�|�|��qSr4r4ri�rlr�r4r5rmHs�zText.pad.<locals>.<listcomp>N�rVrr[r(rO)r3r�r�pad_charactersr4rr5r=s�zText.padcsTt|�dkstd���rP|��|j��|_t���fdd�|jD�|jdd�<dS)z�Pad the left with a given character.

        Args:
            count (int): Number of characters to pad.
            character (str, optional): Character to pad with. Defaults to " ".
        rrcs&g|]\}}}�|�|�|��qSr4r4rirr4r5rmXs�z!Text.pad_left.<locals>.<listcomp>Nr �r3r�rr4rr5�pad_leftMs�z
Text.pad_leftcCs0t|�dkstd��|r,|j�||��|_dS)z�Pad the right with a given character.

        Args:
            count (int): Number of characters to pad.
            character (str, optional): Character to pad with. Defaults to " ".
        rrN)rVrr[r"r4r4r5r�]szText.pad_right)�align�widthrr-cCsp|�|�|t|j�}|rl|dkr2|�||�n:|dkr`|d}|�||�|�|||�n|�||�dS)z�Align text to a given width.

        Args:
            align (AlignMethod): One of "left", "center", or "right".
            width (int): Desired width.
            character (str, optional): Character to pad with. Defaults to " ".
        �left�center�N)rrr[r�r#)r3r$r%r�excess_spacer&r4r4r5r$hs
z
Text.alignr)rUr+r-cst|ttf�std��t|��r
t|t�r~t|�}|j�|�t|�}t|��|dk	rn|j�t	||�|��|j
�7_
n�t|t��r
t	�|dk	r�td��|j
�|jdk	r�|j����t|�|j��|j�|j
�|j���fdd�|jD��|j
t|�7_
|S)z�Add text with an optional style.

        Args:
            text (Union[Text, str]): A str or Text to append.
            style (str, optional): A style name. Defaults to None.

        Returns:
            Text: Returns self for chaining.
        z(Only str or Text can be appended to TextNz2style must not be set when appending Text instancec3s(|] \}}}�|�|�|�VqdSr7r4ri�rlr�r4r5rz�s�zText.append.<locals>.<genexpr>)r/rHr'rqrVrrJrarOr(rP�
ValueErrorr+r[r)r3rUr+rWr:r4r*r5ra|s8


�
��zText.append)rUr-cstt�|j�|jdk	r2|j����t|�|j��|j�|j�|j���fdd�|jD��|jt|�7_|S)z�Append another Text instance. This method is more performant that Text.append, but
        only works for Text.

        Returns:
            Text: Returns self for chaining.
        Nc3s(|] \}}}�|�|�|�VqdSr7r4rir*r4r5rz�s�z#Text.append_text.<locals>.<genexpr>)	r(rPr+rOrarVrJr[r�r3rUr4r*r5�append_text�s
�zText.append_text)�tokensr-cCsh|jj}|jj}t}t|�}|D]<\}}||�|dk	rP||||t|�|��|t|�7}q ||_|S)a(Append iterable of str and style. Style may be a Style instance or a str style definition.

        Args:
            pairs (Iterable[Tuple[str, Optional[StyleType]]]): An iterable of tuples containing str content and style.

        Returns:
            Text: Returns self for chaining.
        N)rJrarOr(rVrP)r3r.r-r�rlr:�contentr+r4r4r5�
append_tokens�szText.append_tokenscCs|j�|j�dS)z�Copy styles from another Text instance.

        Args:
            text (Text): A Text instance to copy styles from, must be the same length.
        N)rOrr,r4r4r5�copy_styles�szText.copy_styles)r�allow_blank)�	separatorrr2r-cs��std��|j���kr(t|��g�S|rP|�dd�t�t�����D��}n6tt	d���fdd�}t�fdd�|�|��D��}|s���
��r�|��|S)a�Split rich text in to lines, preserving styles.

        Args:
            separator (str, optional): String to split on. Defaults to "\\n".
            include_separator (bool, optional): Include the separator in the lines. Defaults to False.
            allow_blank (bool, optional): Return a blank line if the text ends with a separator. Defaults to False.

        Returns:
            List[RichText]: A list of rich text, one per line of the original.
        zseparator must not be emptycss|]}|��VqdSr7r��rjr�r4r4r5rz�szText.split.<locals>.<genexpr>r,c3s4t�t�����D]}|��\}}|V|VqdSr7)r�r�rvry)r�r)r*�r3rUr4r5�
flatten_spans�sz!Text.split.<locals>.flatten_spansc3s|]}|j�kr|VqdSr7rZr�)r3r4r5rz�s
)rr[rr`rpr�r�rvr
rFr��pop)r3r3rr2rtr6r4r5r5r>�s
�

�z
Text.split)�offsetsr-cs�t|�}|st|��g�S|j�t��}d	||f�}tt||dd���}|j�|j�|j�t	�t�����fdd�|D��}|j
s�|Sdd�|jD�}t|�}t}	|j
D�]$\}
}�d}|}
||
d}||\}}|
|kr�|d}
n|
|kr�|d}n�q||
d}q�||k�r|}nT|}}|}
||\}}||k�rH|d}
n||k�rp|d}n�qp||
d}�q(t
||d�D]P}||\}}td|
|�}t||||�}||k�r~|||	||����q~q�|S)
z�Divide text in to a number of lines at given offsets.

        Args:
            offsets (Iterable[int]): Offsets used to divide text.

        Returns:
            Lines: New RichText instances between offsets.
        rrNc3s*|]"\}}��||����d�VqdS))r+rKrLNr4)rjr)r*�r�rKrLr+rUr4r5rzs�
�zText.divide.<locals>.<genexpr>cSsg|]}|jj�qSr4)rOrar�r4r4r5rm)szText.divide.<locals>.<listcomp>r()r)r�rr`r[rVrr+rKrLr'rO�_linesr(�ranger�r;)r3r8�_offsetsr��divide_offsets�line_ranges�	new_lines�
_line_appends�
line_countrl�
span_start�span_end�lower_bound�upper_bound�
start_line_no�
line_start�line_end�end_line_no�line_no�	new_start�new_endr4r9r5rps`	�	







zText.divider)�amountr-csXt|j�|�t���fdd�|jD�|jdd�<|jd|�g|_|j|8_dS)z7Remove a number of characters from the end of the text.cs<g|]4}|j�kr|j�kr |n�|jt�|j�|j��qSr4rrxrr4r5rmZs

��z#Text.right_crop.<locals>.<listcomp>N)rVr[r(rOrJrP)r3rMr4rr5rAVs�	zText.right_cropr�)r�r%rKrLrNrMr-c
Cs�|p|jpt}|p|jpt}t||jd�p0|dk}t�}	|jdd�D]�}
d|
krZ|
�|�|rjt|
g�}n t	t
|
�||dkd�}|
�|�}|D]}
|
�|�q�|r�|j||||d�|D]}
|
j
||d	�q�|	�|�qD|	S)
a�Word wrap the text.

        Args:
            console (Console): Console instance.
            width (int): Number of characters per line.
            emoji (bool, optional): Also render emoji code. Defaults to True.
            justify (str, optional): Justify method: "default", "left", "center", "full", "right". Defaults to "default".
            overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to None.
            tab_size (int, optional): Default tab size. Defaults to 8.
            no_wrap (bool, optional): Disable wrapping, Defaults to False.

        Returns:
            Lines: Number of lines.
        FrT�r2rr%)r%r�)rL)rKr$rLr&rrMrr>rrrHrpr�rr)
r3r�r%rKrLrNrM�wrap_justify�
wrap_overflowrtr�r?r8r4r4r5r�fs0

�z	Text.wrap)r%r-cCs0t�}|j}|��D]}|�|�||�q|S)z�Fit the text in to given width by chopping in to lines.

        Args:
            width (int): Maximum characters in a line.

        Returns:
            Lines: List of lines.
        )rrar>r�)r3r%rtrar�r4r4r5�fit�s	

zText.fitcCsXdd�tjd|jtjd�D�}zttdd�|D��p6d}Wntk
rRd}YnX|S)zrAuto-detect indentation of code.

        Returns:
            int: Number of spaces used to indent code.
        cSsh|]}t|�d���qS)r)rVr�r4r4r4r5�	<setcomp>�s�z*Text.detect_indentation.<locals>.<setcomp>�
^( *)(.*)$r�cSsg|]}|ds|�qS)r(r4)rj�indentr4r4r5rm�sz+Text.detect_indentation.<locals>.<listcomp>r)r�r�r[�	MULTILINErrrq)r3�
_indentations�indentationr4r4r5�detect_indentation�s��
zText.detect_indentationu│z	dim green)rr+)�indent_sizerr+r-cCs:|dkr|��n|}|��}|��|�d|d��}t�d�}g}|j}	d}
|jdd�D]�}|�|j�}|rz|�	d�s�|
d7}
q\|�	d�}
t
t|
�|�\}}||�d|��}||jt|�d�|_|�|dt|��|
r�|�
t||d	�g|
�d}
|	|�q\|
�r&|�
td
|d	�g|
�|�d��|�}|S)u�Adds indent guide lines to text.

        Args:
            indent_size (Optional[int]): Size of indentation, or None to auto detect. Defaults to None.
            character (str, optional): Character to use for indentation. Defaults to "│".
            style (Union[Style, str], optional): Style of indent guides.

        Returns:
            Text: New text with indentation guides.
        Nr]rrSrTrNr(r�rQrR)rXr`rr��compilerar>r�r[r��divmodrVr�rr'r�r�)r3rYrr+�_indent_sizerU�indent_line�	re_indentr?�add_line�blank_linesr�r�rT�full_indents�remaining_space�
new_indentr�r4r4r5�with_indent_guides�s4


zText.with_indent_guides)rQrQ)rQ)rQ)rN)rN)N)N)rQ)N)r])r])r])r])N)rR)r)N)PrBrCrDrE�	__slots__rHrrr
rIrFrr(rXrYr8r\r6rrd�objectrfrgrhru�propertyrr��classmethodrr�r�rr�rr	r�r[�setterrTr�r`r�r�r�r�r��GetStyleCallabler�r
r�r�r�r�rr�rr�r�r�rrr�rr#r�rr$rar-r0r1rr>rprAr�rQrXrdr4r4r4r5r'is����

��
��
�%����
�,

�
��
� 	���+�
�
��;'&���
�,�
���,P��1����__main__)ra�
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
ZLorem�boldZipsum�italiczjustify='left'�redr�zjustify='center'�greenr')r+rKzjustify='right'�blue�rightzjustify='full'�magenta�full)Br��	functoolsrr�mathr�operatorr�typingrrrr	r
rrr
rr�_loopr�_pickr�_wraprr$r�cellsrr�
containersr�controlrr�r�jupyterr�measurer�segmentrr+rrr�rr r!r"r$rGr&rZr�rH�TextTyperjr(r'rB�pip._vendor.rich.consolerUr��rule�printr4r4r4r5�<module>sn0

<
�






Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.49 PM
root / linksafe
0755
__init__.cpython-38.pyc
5.761 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
__main__.cpython-38.pyc
7.134 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_cell_widths.cpython-38.pyc
9.792 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_emoji_codes.cpython-38.pyc
129.629 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_emoji_replace.cpython-38.pyc
1.2 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_export_format.cpython-38.pyc
2.295 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_extension.cpython-38.pyc
0.521 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_inspect.cpython-38.pyc
8.549 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_log_render.cpython-38.pyc
2.558 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_loop.cpython-38.pyc
1.282 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_palettes.cpython-38.pyc
6.115 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_pick.cpython-38.pyc
0.677 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_ratio.cpython-38.pyc
5.087 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_spinners.cpython-38.pyc
12.177 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_stack.cpython-38.pyc
0.861 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_timer.cpython-38.pyc
0.712 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_win32_console.cpython-38.pyc
18.853 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_windows.cpython-38.pyc
1.775 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_windows_renderer.cpython-38.pyc
2.045 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
_wrap.cpython-38.pyc
1.533 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
abc.cpython-38.pyc
1.312 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
align.cpython-38.pyc
7.721 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
ansi.cpython-38.pyc
5.478 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
bar.cpython-38.pyc
2.905 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
box.cpython-38.pyc
8.338 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
cells.cpython-38.pyc
3.959 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
color.cpython-38.pyc
14.918 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
color_triplet.cpython-38.pyc
1.43 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
columns.cpython-38.pyc
6.033 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
console.cpython-38.pyc
78.365 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
constrain.cpython-38.pyc
1.666 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
containers.cpython-38.pyc
6.333 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
control.cpython-38.pyc
8.061 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
default_styles.cpython-38.pyc
5.201 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
diagnose.cpython-38.pyc
1.227 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
emoji.cpython-38.pyc
3.177 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
errors.cpython-38.pyc
1.668 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
file_proxy.cpython-38.pyc
2.213 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
filesize.cpython-38.pyc
2.589 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
highlighter.cpython-38.pyc
7.917 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
json.cpython-38.pyc
4.607 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
jupyter.cpython-38.pyc
4.01 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
layout.cpython-38.pyc
14.361 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
live.cpython-38.pyc
10.808 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
live_render.cpython-38.pyc
3.347 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
logging.cpython-38.pyc
9.56 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
markup.cpython-38.pyc
5.843 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
measure.cpython-38.pyc
4.93 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
padding.cpython-38.pyc
4.351 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
pager.cpython-38.pyc
1.438 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
palette.cpython-38.pyc
3.642 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
panel.cpython-38.pyc
6.322 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
pretty.cpython-38.pyc
26.772 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
progress.cpython-38.pyc
51.866 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
progress_bar.cpython-38.pyc
6.715 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
prompt.cpython-38.pyc
11.145 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
protocol.cpython-38.pyc
1.346 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
region.cpython-38.pyc
0.551 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
repr.cpython-38.pyc
4.056 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
rule.cpython-38.pyc
4.212 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
scope.cpython-38.pyc
2.941 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
screen.cpython-38.pyc
1.825 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
segment.cpython-38.pyc
20.098 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
spinner.cpython-38.pyc
4.283 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
status.cpython-38.pyc
4.494 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
style.cpython-38.pyc
20.424 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
styled.cpython-38.pyc
1.69 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
syntax.cpython-38.pyc
24.72 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
table.cpython-38.pyc
28.824 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
terminal_theme.cpython-38.pyc
3.159 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
text.cpython-38.pyc
38.852 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
theme.cpython-38.pyc
4.612 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
themes.cpython-38.pyc
0.324 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
traceback.cpython-38.pyc
19.046 KB
13 Nov 2023 9.40 PM
root / linksafe
0644
tree.cpython-38.pyc
7.117 KB
13 Nov 2023 9.40 PM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF