Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
segment.cpython-313.pyc318 linesDownload Raw Back to __pycache__
1�

2�j�d��r�SSKJr SSKJr SSKJr SSKJr SSKJ	r	J3r4JrJrJ
r
JrJrJrJrJr SSKJrJrJrJrJr SSKJrJr SS	KJr \	(a5SS6KJrJ r J!r! "SS\5r"\\\"\\"\\#\$44\\"\#\#44r%\"5"S
S\
55r&"SS5r'"SS5r(\)S:XGaSSK*Jr SSK+J,r, SSK-J.r. Sr/\.R`"S5r1\"5r\ReS5 \RgS5 \RgS5 \Rg\,"\/SSS95 \Rg5 \RgS5 \4"\Rk\155r6\Rg\65 \Rg5 \RgS 5 \Rg\15 \RgS!5 g"g")#�)�IntEnum)�	lru_cache)�filterfalse)�7attrgetter)8�
TYPE_CHECKING�Dict�Iterable�List�9NamedTuple�Optional�Sequence�Tuple�Type�Union�)�_is_single_cell_widths�cached_cell_len�cell_len�get_character_cell_size�
set_cell_size)�Result�	rich_repr)�Style)�Console�ConsoleOptions�RenderResultc�X�\rSrSrSrSrSrSrSrSr	Sr10S	rS11rSr
SrS
rSrSrSrSrSrSrg)�ControlType� zDNon-printable control codes which typically translate to ANSI codes.r��������	�12���
����N)�__name__�13__module__�__qualname__�__firstlineno__�__doc__�BELL�CARRIAGE_RETURN�HOME�CLEAR�SHOW_CURSOR�HIDE_CURSOR�ENABLE_ALT_SCREEN�DISABLE_ALT_SCREEN�	CURSOR_UP�CURSOR_DOWN�CURSOR_FORWARD�CURSOR_BACKWARD�CURSOR_MOVE_TO_COLUMN�CURSOR_MOVE_TO�
ERASE_IN_LINE�SET_WINDOW_TITLE�__static_attributes__r/��RD:\code\apps\devtools\python\user_packages\Python313\site-packages\rich/segment.pyrr sY��N��D��O��D�
�E��K��K������I��K��N��O����N��M��rFrc���\rSrSr%Sr\\S'Sr\\	\S'Sr14\\\\S'\
S\4Sj5rS\4S	jrS\4S15jr\
S\4Sj5r\\"S5S
SS\S\S4Sj55rS\S\S4Sjr\S2Sj5r\S3S\SS\\	S\\	S\S4Sjj5r\S4S\SS\S\S4Sjj5r\S\SS\\S4Sj5r\S\SS\\\S\44Sj5r \S5S\SS\S\\	S\S\S\\S4Sjj5r!\S6S\SS\S\\	S\S\S416Sjj5r"\S\SS\4S j5r#\S!\\SS\\\44S"j5r$\S7S!\\SS#\S$\\S\\	S%\S\\S4S&jj5r%\S4S'\&SS!\\SS#\S$\S\	S%\S\\S4S(jj5r'\S4S'\&SS!\\SS#\S$\S\	S%\S\\S4S)jj5r(\S4S'\&SS!\\SS#\S$\S\	S%\S\\S4S*jj5r)\S\SS\S4S+j5r*\S\SS\S4S,j5r+\S\SS\S4S-j5r,\S\SS\S4S.j5r-\S\SS/\\S\\S4S0j5r.S1r/g)8�Segment�<a�A piece of text with associated style. Segments are produced by the Console render process and17are ultimately converted in to strings to be written to the terminal.18 19Args:20    text (str): A piece of text.21    style (:class:`~rich.style.Style`, optional): An optional style to apply to the text.22    control (Tuple[ControlCode], optional): Optional sequence of control codes.23 24Attributes:25    cell_length (int): The cell length of this Segment.26�textN�style�control�returnc�4�UupnU(aS$[U5$)zbThe number of terminal cells required to display self.text.27 28Returns:29    int: A number of cells.30r)r)�selfrK�_stylerMs    rG�cell_length�Segment.cell_lengthNs��!%���g��q�/��$��/rFc#�# �URv� URcURbURv� ggURv� URv� g7f�N)rKrMrL�rPs rG�
__rich_repr__�Segment.__rich_repr__XsG����i�i���<�<���z�z�%��j�j� �&��*�*���,�,����AAc�,�[UR5$)z#Check if the segment contains text.)�boolrKrVs rG�__bool__�Segment.__bool__as���D�I�I��rFc��URSL$)z,Check if the segment contains control codes.N)rMrVs rG�31is_control�Segment.is_controles���|�|�4�'�'rFi@�segment�cut)rIrIc���Uup4n[nURnX':�a32X"SXE54$[n[X'-[	U5-5n	USU	n33[U345nX�-35nU(dU"X�U5U"X9SXE54$US:Xa.U"X95S:Xa U"USU	S-XE5U"SX9S-S-XE54$US:Xa1U"X9S-365S:Xa U"USU	S-37S-XE5U"SX9S-XE54$X�:aU	S-
n	OU	S-n	M�)aSplit a segment in to two at a given cell position.38 39Note that splitting a double-width character, may result in that character turning40into two spaces.41 42Args:43    segment (Segment): A segment to split.44    cut (int): A cell position to cut on.45 46Returns:47    A tuple of two segments.48�N�����r � r)rIrRr�int�lenr)
�clsrarbrKrLrM�_SegmentrR�	cell_size�pos�before�cell_pos�out_bys
             rG�_split_cells�Segment._split_cellsjsQ�� '���W����)�)�����H�R��8�8�8�+�	��3�$��D�	�1�2����$�3�Z�F���'�H��^�F���V�G�4��T�$�Z��8�����|�	�$�)� 4�� 9��T�$�3�Z�#�-�u�>��S�4�a��	�?�2�E�C�����|�	�$�Q�w�-� 8�A� =��T�)�C�!�G�_�s�2�E�C��S�4��:�-�u�>����~��q����q���-rFc���Uup#nUS:�de[U5(a:U[U5:�aU[SX454$[USUX45[X!SX454$URX5$)a@Split segment in to two segments at the specified column.49 50If the cut point falls in the middle of a 2-cell wide character then it is replaced51by two spaces, to preserve the display width of the parent segment.52 53Args:54    cut (int): Offset within the segment to cut.55 56Returns:57    Tuple[Segment, Segment]: Two segments.58rrdN)rrhrIrp)rPrbrKrLrMs     rG�split_cells�Segment.split_cells�s}�� $���W��a�x��x�!�$�'�'��c�$�i���W�R��8�8�8���T�c�59�E�3���T�60�E�3��
�61� � ��+�+rFc��U"S5$)zMake a new line segment.�62r/)ris rG�line�Segment.line�s���4�y�rF�segments�63post_stylec�x^^^�UnU(aURmUU4SjU5nT(a
UU4SjU5nU$)a�Apply style(s) to an iterable of segments.64 65Returns an iterable of segments where the style is replaced by ``style + segment.style + post_style``.66 67Args:68    segments (Iterable[Segment]): Segments to process.69    style (Style, optional): Base style. Defaults to None.70    post_style (Style, optional): Style to apply on top of segment style. Defaults to None.71 72Returns:73    Iterable[Segments]: A new iterable of segments (possibly the same iterable).74c3�Z># �UH upnT"X(aSOT"U5U5v� M" g7frUr/)�.0rKrQrM�applyris    ��rG�	<genexpr>�&Segment.apply_style.<locals>.<genexpr>�s1�����-<�)�D�'��D�'�$�u�V�}�g�F�F�-<�s�(+c3�h># �UH'upnT"UU(aSO
U(aUT-OTU5v� M) g7frUr/)r}rKrQrMrirzs    ��rGrr��sG�����.=�)�D�'���#��5;�f�z�1�����.=�s�/2)�__add__)riryrLrz�result_segmentsr~s`  ` @rG�apply_style�Segment.apply_style�sC���&#����M�M�E��-<��O���.=��O��rFr_c�d�U(a[[S5U5$[[S5U5$)aFilter segments by ``is_control`` attribute.75 76Args:77    segments (Iterable[Segment]): An iterable of Segment instances.78    is_control (bool, optional): is_control flag to match in search.79 80Returns:81    Iterable[Segment]: And iterable of Segment instances.82 83rM)�filterrr)riryr_s   rG�filter_control�Segment.filter_control�s+����*�Y�/��:�:��z�)�4�h�?�?rFc#�Z# �/nURnUH�nSUR;alUR(d[UupVnU(aMURS5up�nU(aU"U"X�55 U	(aUv� /nURnU(aMKM}MU"U5 M� U(aUv� gg7f)z�Split a sequence of segments in to a list of lines.84 85Args:86    segments (Iterable[Segment]): Segments potentially containing line feeds.87 88Yields:89    Iterable[List[Segment]]: Iterable of segment lists, one per line.90rvN��appendrKrM�	partition�91riryrwr�rarKrL�_�_text�new_lines92          rG�split_lines�Segment.split_lines�s����!�������G��w�|�|�#�G�O�O�!(���Q��,0�N�N�4�,@�)�E�T���s�5�0�1��"�93�!��!%�����d��w�� ���J��s�B94B+�B+c#�b# �/nURnUH�nSUR;anUR(d]UupVnU(aOURS5up�nU(aU"U"X�55 U	(aUS4v� /nURnU(aMMMM�U"U5 M� U(aUS4v� gg7f)a95Split a sequence of segments in to a list of lines and a boolean to indicate if there was a new line.96 97Args:98    segments (Iterable[Segment]): Segments potentially containing line feeds.99 100Yields:101    Iterable[List[Segment]]: Iterable of segment lists, one per line.102rvTFNr�r�s103          rG�split_lines_terminator�Segment.split_lines_terminators����!�������G��w�|�|�#�G�O�O�!(���Q��,0�N�N�4�,@�)�E�T���s�5�0�1��#�T�l�*�!��!%�����d��w�� ����-���s�BB/�B/�length�pad�include_new_linesc#��# �/nURnURnU"S5n	UH�n104SU105R;a�U106R(d|U107up�n
U(anUR	S5up�nU(aU"U"X�55 U(a3U"XbX4S9nU(aURU	5 Uv� UR5 U(aMlM�M�U"U1085 M� U(a109U"XbX4S9v� gg7f)a�Split segments in to lines, and crop lines greater than a given length.110 111Args:112    segments (Iterable[Segment]): An iterable of segments, probably113        generated from console.render.114    length (int): Desired line length.115    style (Style, optional): Style to use for any padding.116    pad (bool): Enable padding of lines that are less than `length`.117 118Returns:119    Iterable[List[Segment]]: An iterable of lines of segments.120rv)rLr�N)r��adjust_line_lengthrKrMr��clear)riryr�rLr�r�rwr�r��new_line_segmentrarK�
segment_styler�r�r��cropped_lines                 rG�split_and_crop_lines�Segment.split_and_crop_lines2s����*!������ �3�3���t�9���G��w�|�|�#�G�O�O�)0�&��Q��,0�N�N�4�,@�)�E�T���s�5�8�9��'9� ��(��-�(�/�/�0@�A�*�*��121�122���d��w��! �"�$�T��H�H��s�B?C%�"C%rwc�n�[SU55nXR:a"U(aX"SX%-123-U5/-nU$USSnU$XR:�aq/nURnSnUHXnURn	XY-U:dUR(aU"U5 XY-
nM6Uup�n[	X�U-1245n125U"U"X�55  U$ U$USSnU$)a�Adjust a line to a given width (cropping or padding as required).126 127Args:128    segments (Iterable[Segment]): A list of segments in a single line.129    length (int): The desired width of the line.130    style (Style, optional): The style of padding if used (space on the end). Defaults to None.131    pad (bool, optional): Pad lines with spaces if they are shorter than `length`. Defaults to True.132 133Returns:134    List[Segment]: A line of segments with the desired length.135c3�8# �UHoRv� M g7frU)rR)r}ras  rGr�-Segment.adjust_line_length.<locals>.<genexpr>ts���B�T�'�-�-�T�s�rfNr)�sumr�rRrMr)
rirwr�rLr��line_lengthr�r�ra�segment_lengthrKr�r�s
             rGr��Segment.adjust_line_lengthas���&�B�T�B�B������3�s�f�.B�'C�U�#K�"L�L��&��# ��7��"��!�
!��H��_�_�F��K���!(�!4�!4���/�&�8�G�O�O��7�O��1�K�-4�*�D��(���/C�D�D��3�t�3�4���� ����A�w�H��rFc�:^�[m[U4SjU55$)z�Get the length of list of segments.136 137Args:138    line (List[Segment]): A line encoded as a list of Segments (assumes no '\\n' characters),139 140Returns:141    int: The length of the line.142c3�J># �UHupo3(aMT"U5v� M g7frUr/)r}rKrLrM�	_cell_lens    �rGr�*Segment.get_line_length.<locals>.<genexpr>�s ����S�t�';�t�G�7�?�9�T�?�?�t�s�
#�#)rr�)rirwr�s  @rG�get_line_length�Segment.get_line_length�s����	��S�t�S�S�SrF�linesc�r^�URmU(a[U4SjU55OSnU[U54$)z�Get the shape (enclosing rectangle) of a list of lines.143 144Args:145    lines (List[List[Segment]]): A list of lines (no '\\n' characters).146 147Returns:148    Tuple[int, int]: Width and height in characters.149c3�4># �UH
nT"U5v� M g7frUr/)r}rwr�s  �rGr�$Segment.get_shape.<locals>.<genexpr>�s����@�%�$���-�-�%�s�r)r��maxrh)rir��	max_widthr�s   @rG�	get_shape�Segment.get_shape�s3����-�-��DI�C�@�%�@�@�q�	��3�u�:�&�&rF�width�height�	new_linesc	�6�U=(d [U5nU(aU"SU-S-U5/OU"SU-U5/nURnUSUn	UV150s/sH	o�"X�US9PM sn151U	SS&[U	5U:a!U	RU/U[U	5-152-5 U	$s sn153f)a�Set the shape of a list of lines (enclosing rectangle).154 155        Args:156            lines (List[List[Segment]]): A list of lines.157            width (int): Desired width.158            height (int, optional): Desired height or None for no change.159            style (Style, optional): Style of any padding added.160            new_lines (bool, optional): Padded lines should include "161". Defaults to False.162 163        Returns:164            List[List[Segment]]: New list of lines.165        rfrvN)rL)rhr��extend)rir�r�r�rLr��_height�blankr��shaped_linesrws           rG�	set_shape�Segment.set_shape�s���*�&�C��J��1:�S��u��t�#�U�
+�,��C�%�K�QV�@W�?X�	�!�3�3���X�g���EJ�166�EJ�T��t�%�8�U�167��Q���|��w�&������7�S��5F�+F� G�H����168s�Bric��U[U5-169nU(dUSS$USUnU(aU"SU-S-U5OU"SU-U5nX//U--nU$)a�Aligns lines to top (adds extra lines to bottom as required).170 171        Args:172            lines (List[List[Segment]]): A list of lines.173            width (int): Desired width.174            height (int, optional): Desired height or None for no change.175            style (Style): Style of any padding added.176            new_lines (bool, optional): Padded lines should include "177". Defaults to False.178 179        Returns:180            List[List[Segment]]: New list of lines.181        Nrfrv�rh�rir�r�r�rLr��extra_linesr�s        rG�	align_top�Segment.align_top�sd��*�s�5�z�)�����8�O��g�v���2;��C�%�K�$�&��.��S�5�[�RW�AX����	�K�/�/���rFc��U[U5-182nU(dUSS$USUnU(aU"SU-S-U5OU"SU-U5nU//U-U-nU$)a�Aligns render to bottom (adds extra lines above as required).183 184        Args:185            lines (List[List[Segment]]): A list of lines.186            width (int): Desired width.187            height (int, optional): Desired height or None for no change.188            style (Style): Style of any padding added. Defaults to None.189            new_lines (bool, optional): Padded lines should include "190". Defaults to False.191 192        Returns:193            List[List[Segment]]: New list of lines.194        Nrfrvr�r�s        rG�align_bottom�Segment.align_bottom�sf��*�s�5�z�)�����8�O��g�v���2;��C�%�K�$�&��.��S�5�[�RW�AX����	�K�'�%�/���rFc��U[U5-195nU(dUSS$USUnU(aU"SU-S-U5OU"SU-U5nUS-nXh-196n	U//U-U-U//U	--nU$)a�Aligns lines to middle (adds extra lines to above and below as required).197 198        Args:199            lines (List[List[Segment]]): A list of lines.200            width (int): Desired width.201            height (int, optional): Desired height or None for no change.202            style (Style): Style of any padding added.203            new_lines (bool, optional): Padded lines should include "204". Defaults to False.205 206        Returns:207            List[List[Segment]]: New list of lines.208        Nrfrvr r�)209rir�r�r�rLr�r�r��	top_lines�bottom_liness210          rG�align_middle�Segment.align_middles���*�s�5�z�)�����8�O��g�v���2;��C�%�K�$�&��.��S�5�[�RW�AX���1�$�	�"�.����	�I�%��-�%��	�L�0H�H���rFc#�:# �[U5n[U5n[nUH`nURUR:Xa=UR211(d,U"URUR-UR5nMZUv� UnMb Uv� g![a gf=f7f)aSimplify an iterable of segments by combining contiguous segments with the same style.212 213Args:214    segments (Iterable[Segment]): An iterable of segments.215 216Returns:217    Iterable[Segment]: A possibly smaller iterable of segments that will render the same way.218N)�iter�next�
StopIterationrIrLrMrK)riry�
iter_segments�last_segmentrjras      rG�simplify�Segment.simplify&s�����X��
�	��
�.�L���$�G��!�!�W�]�]�2�7�?�?�'� �%�%����4�l�6H�6H� ��#�"�&��%�����	��	�s(�B�B�A1B�219B�B�B�Bc#�# �UHNnUR(d
URcUv� M'Uup4nU"X4(aURS5OS5v� MP g7f)z�Remove all links from an iterable of styles.220 221Args:222    segments (Iterable[Segment]): An iterable segments.223 224Yields:225    Segment: Segments with link removed.226N)rMrL�update_link)riryrarKrL�_controls      rG�strip_links�Segment.strip_linksAsL��� �G����'�-�-�"7��
�(/�%��X��$�5�� 1� 1�$� 7�d�K�K� �rYc#�<# �UHup#nU"USU5v� M g7f)z�Remove all styles from an iterable of segments.227 228Args:229    segments (Iterable[Segment]): An iterable segments.230 231Yields:232    Segment: Segments with styles replace with None233Nr/)riryrKrQrMs     rG�strip_styles�Segment.strip_stylesRs%���&.�!�D�'��d�D�'�*�*�&.�s�c#�# �0nUHJup4nU(a1URU5nUcURnXbU'U"X6U5v� M>U"USU5v� ML g7f)z�Remove all color from an iterable of segments.234 235Args:236    segments (Iterable[Segment]): An iterable segments.237 238Yields:239    Segment: Segments with colorless style.240N)�get�
without_color)riry�cacherKrLrM�colorless_styles       rG�remove_color�Segment.remove_color_s`���%'��$,� �D���"'�)�)�E�"2��"�*�&+�&9�&9�O�#2�%�L��$��9�9��$��g�.�.�%-�s�AA�cutsc#�# �/nURn[U5n[US5nUS:XagUS:waO/v� M SnURnURn	[241n242UH�nUup�nU(dMU(aUO	Xz"U5-nX�:aU"U5 UnM5X�:Xa@U"U5 U	"5v� U"5 Un[US5nUS:XaU(a	U	"5v�  gMzUR
Xg-2435unnUup�nU"U5 U	"5v� U"5 Un[US5nUS:XaU(a	U	"5v�  gU(aM�M� U	"5v� g7f)z�Divides an iterable of segments in to portions.244 245Args:246    cuts (Iterable[int]): Cell positions where to divide.247 248Yields:249    [Iterable[List[Segment]]]: An iterable of Segments in List.250reNr)r�r�r�r��copyrrs)riryr��split_segments�add_segment�	iter_cutsrbrl�segments_clear�
segments_copyr�rarKrQrM�end_posrms                 rG�divide�Segment.divideusd���+-��$�+�+����J�	���y�"�%�C��b�y���a�x���H�
���'�-�-��&�+�+�
�#�	��G�$+�!�D�'��$�!(�#�c�I�d�O�.C���=���(�!�C���>���(�'�/�)�"�$�!�C��y�"�-�C��b�y�)�"/�/�1���'.�&9�&9�#�)�&D�O�F�G�,3�)�D�'���'�'�/�)�"�$��C��9�b�)���"�9�%�+�o�-��C�$� �J�o��s�A*E	�0C	E	�;E	r/)rNrI)NN�F)NTT)NT)NNF)0r0r1r2r3r4�str�__annotations__rLrrrMr
�ControlCode�propertyrgrRrrWr[r\r_�classmethodrrrprsrwr	r�r�r251r�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�rEr/rFrGrIrI<s���252��I�!�E�8�E�?�!�/3�G�X�h�{�+�
,�3�
�0�S�0��0��v���$���(�D�(��(���y��-�9�-�3�-�5�AU�;V�-���-�^,�s�,�u�-A�'B�,�4�����"&�&*�	&��9�%�&����&��U�O�	&�253254�)�	�&��&�P�?D�@��	�*�@�8<�@�	�)�	�@��@�$��8�I�#6��8�D��O�;T����8� ��	�*� �	�%��Y���-�.�	/� �� �<�255"&��"&�
,I��9�%�,I��,I����	,I�256�,I� �
,I�257�$�y�/�	"�,I��,I�\�258"&��*��9�o�*��*����	*�259�*�260�i��
*��*�X�261T�4�	�?�262T�s�263T��264T��'�d�4�	�?�3�'��c�3�h��'��'��265!%�!%��
!��D��O�$�!��!���
�	!�266���!��
!�267�d�9�o�	�!��!�F� �
�
�)�_���D��O�$�����	�268���
�269�d�9�o�	����8� �
�
�)�_���D��O�$�����	�270���
�271�d�9�o�	����8� �
�
�)�_���D��O�$�����	�272���
�273�d�9�o�	����<���� 3����8K����4�L�8�I�#6�L�8�I�;N�L��L� �274+�H�Y�$7�275+�H�Y�<O�276+��277+��/�H�Y�$7�/�H�Y�<O�/��/�*�B��	�*�B�2:�3�-�B�	�$�y�/�	"�B��BrFrIc�N�\rSrSrSrS278S\\S\SS4SjjrSSjr	S	r279g)�Segmentsi�a)A simple renderable to render an iterable of segments. This class may be useful if280you want to print segments outside of a __rich_console__ method.281 282Args:283    segments (Iterable[Segment]): An iterable of segments.284    new_lines (bool, optional): Add new lines between segments. Defaults to False.285ryr�rNNc�0�[U5UlX lgrU)�listryr�)rPryr�s   rG�__init__�Segments.__init__�s���X���
�"�rFc#�# �UR(a0[R5nURHnUv� Uv� M
 gURShv�N gN7frU)r�rIrwry)rP�console�optionsrwras     rG�__rich_console__�Segments.__rich_console__�s@����>�>��<�<�>�D��=�=���
��286�)��}�}�$�$�s�AA�A�A)r�ryr��r�rr�rrNr)r0r1r2r3r4r	rIr[r�rrEr/rFrGr�r��sD���#��'�!2�#�t�#�PT�#�	%� �	%�+;�	%�	�	%rFr�c�P�\rSrSrS	S\\\S\SS4SjjrS287Sjr	Sr288g)�SegmentLinesi�r�r�rNNc�0�[U5UlX lg)aA simple renderable containing a number of lines of segments. May be used as an intermediate289in rendering process.290 291Args:292    lines (Iterable[List[Segment]]): Lists of segments forming lines.293    new_lines (bool, optional): Insert new lines after each line. Defaults to False.294N)r�r�r�)rPr�r�s   rGr��SegmentLines.__init__�s���%�[��295�"�rFc#��# �UR(a6[R5nURHnUShv�N Uv� M gURH
nUShv�N M gN+N7frU)r�rIrwr�)rPr�r�r�rws     rGr�SegmentLines.__rich_console__�sT����>�>��|�|�~�H��296�297�������#��298�299�����#� � �s!�:A,�A(�!A,�A*�300A,�*A,)r�r�r�r)r0r1r2r3r	r301rIr[r�rrEr/rFrGrr�sC��	#�h�t�G�}�5�	#�$�	#�SW�	#�302 � �303 �+;�304 �	�305 rFr�__main__)r)�Syntax)�Textz�from rich.console import Console306console = Console()307text = Text.from_markup("Hello, [bold magenta]World[/]!")308console.print(text)zHello, [bold magenta]World[/]!zrich.Segmentz]A Segment is the last step in the Rich render process before generating text with ANSI codes.z309Consider the following code:310�pythonT)�line_numberszRWhen you call [b]print()[/b], Rich [i]renders[/i] the object in to the following:311zAThe Segments are then processed to produce the following output:312zS313You will only need to know this if you are implementing your own Rich renderables.N)7�enumr�	functoolsr�	itertoolsr�operatorr�typingrrr	r314rrr
rrr�cellsrrrrr�reprrrrLrr�rrrrrgr�r�rIr�rr0�rich.console�rich.syntaxr315�	rich.textr�code�from_markuprK�rule�printr��render�	fragmentsr/rFrG�<module>rs�����!�������$���>�>��'��*�	�+��	�+�u�S�#�X��316&�'�	�+�s�C�317� �"�����{	�j�{	�
�{	�|%�%�2 � �2�z��$�"���D�318���<�=�D��i�G��L�L�� ��M�M�g���M�M�4�5��M�M�&��x�d�;�<��M�M�O��M�M�]���W�^�^�D�)�*�I��M�M�)���M�M�O��M�M�V�W��M�M�$���M�M�^��;rF
codekingpro/portable-devtools · Team Ai