2bi^ S SK Jr S SKJr S SKJr S SKJr S SKJ r S SK
JrJrJ
r
JrJrJrJrJrJrJr SSKJrJrJrJrJr SS KJrJr SS
KJr \( a
SSK J!r!J"r"J#r# \" S5 r$ " S
S\5 r%\\\% \\%\\&\'4 4 \\%\&\&4 4 r(\" 5 " S S\5 5 r) " S S5 r* " S S5 r+\,S:X Ga S SK-J!r! S SK.J/r/ S SK0J1r1 Sr2\1Rf " S5 r4\!" 5 r \ Rk S5 \ Rm S5 \ Rm S5 \ Rm \/" \2SSS 95 \ Rm 5 \ Rm S!5 \7" \ Rq \45 5 r9\ Rm \95 \ Rm 5 \ Rm S"5 \ Rm \45 \ Rm S#5 g$g$)% )IntEnum) lru_cache)filterfalse) getLogger)
attrgetter)
TYPE_CHECKINGDictIterableList
NamedTupleOptionalSequenceTupleTypeUnion )_is_single_cell_widthscached_cell_lencell_lenget_character_cell_size
set_cell_size)Result rich_repr)Style)ConsoleConsoleOptionsRenderResultrichc X \ rS rSrSrSrSrSrSrSr Sr
S rS
rSr
SrS
rSrSrSrSrSrSrg)ControlType# zDNon-printable control codes which typically translate to ANSI codes.r
N)__name__
__module____qualname____firstlineno____doc__BELLCARRIAGE_RETURNHOMECLEARSHOW_CURSORHIDE_CURSORENABLE_ALT_SCREENDISABLE_ALT_SCREEN CURSOR_UPCURSOR_DOWNCURSOR_FORWARDCURSOR_BACKWARDCURSOR_MOVE_TO_COLUMNCURSOR_MOVE_TO
ERASE_IN_LINESET_WINDOW_TITLE__static_attributes__r1 ڊ/builddir/build/BUILDROOT/alt-python313-pip-23.3.1-3.el8.x86_64/opt/alt/python313/lib/python3.13/site-packages/pip/_vendor/rich/segment.pyr r # sY NDOD
EKKIKNONMrH r c \ rS rSr% Sr\\S' Sr\\ \S' Sr
\\\ \S' \
S\4S j5 rS\4S jrS\4S
jr\
S\4S j5 r\\" S5 S
S S\S\S 4S j5 5 rS\S\S 4S jr\S1S j5 r\ S2S\S S\\ S\\ S\S 4S jj5 r\ S3S\S S\S\S 4S jj5 r\S\S S\\S 4S j5 r\ S4S\S S\S\\ S\S\S\\S 4S jj5 r \ S5S\S S\S\\ S\S\S 4
S jj5 r!\S\S S\4S j5 r"\S \\S S\\\4 4S! j5 r#\ S6S \\S S"\S#\\ S\\ S$\S\\S 4S% jj5 r$\ S3S&\%S S \\S S"\S#\S\ S$\S\\S 4S' jj5 r&\ S3S&\%S S \\S S"\S#\S\ S$\S\\S 4S( jj5 r'\ S3S&\%S S \\S S"\S#\S\ S$\S\\S 4S) jj5 r(\S\S S\S 4S* j5 r)\S\S S\S 4S+ j5 r*\S\S S\S 4S, j5 r+\S\S S\S 4S- j5 r,\S\S S.\\ S\\S 4S/ j5 r-S0r.g)7Segment? a A piece of text with associated style. Segments are produced by the Console render process and
are ultimately converted in to strings to be written to the terminal.
Args:
text (str): A piece of text.
style (:class:`~rich.style.Style`, optional): An optional style to apply to the text.
control (Tuple[ControlCode], optional): Optional sequence of control codes.
Attributes:
cell_length (int): The cell length of this Segment.
textNstylecontrolreturnc 4 U u pnU( a S$ [ U5 $ )zbThe number of terminal cells required to display self.text.
Returns:
int: A number of cells.
r )r )selfrM _stylerO s rI cell_lengthSegment.cell_lengthQ s !%gq/$/rH c # # U R v U R c U R b U R v g g U R v U R v g 7fN)rM rO rN rR s rI
__rich_repr__Segment.__rich_repr__[ sG ii<<zz%jj & **,, AAc , [ U R 5 $ )z#Check if the segment contains text.)boolrM rX s rI __bool__Segment.__bool__d s DIIrH c U R SL$ )z,Check if the segment contains control codes.N)rO rX s rI
is_controlSegment.is_controlh s ||4''rH i @ segmentcut)rK rK c Uu p4n[ nUR nX': a
X" SXE5 4$ [ n[ X'- [ U5 S-
- 5 n US U n
[ U
5 nX:X a U" XU5 U" X9S XE5 4$ U [ U5 : ag X9 nU S-
n X" U5 -
nUS U n
X:X a U" XU5 U" X9S XE5 4$ X: a U" U
S U S-
S- XE5 U" SX9S - XE5 4$ U [ U5 : a Mg [
S5 e)N r zWill never reach here)rK rT r intlenr AssertionError)
clsrc rd rM rN rO _SegmentrT cell_sizeposbeforecell_poschars
rI _split_cellsSegment._split_cellsm sG 'W))HR888+ 3$TQ78dsF#?0dU4
CIo9D1HC $'H$3ZFVG4T$Z8 ~VIcAg.4eES4:-u> CIo 455rH c U u p#n[ U5 ( a: U[ U5 : a U [ SX45 4$ [ USU X45 [ X!S X45 4$ U R X5 $ )a Split segment in to two segments at the specified column.
If the cut point falls in the middle of a 2-cell wide character then it is replaced
by two spaces, to preserve the display width of the parent segment.
Returns:
Tuple[Segment, Segment]: Two segments.
rf N)r ri rK rr )rR rd rM rN rO s rI split_cellsSegment.split_cells sr $W!$''c$iWR888Tc
E3T
E3
++rH c U " S5 $ )zMake a new line segment.
r1 )rk s rI lineSegment.line s 4yrH segments
post_stylec x ^ ^^ UnU( a UR mUU 4S jU 5 nT( a
U U4S jU 5 nU$ )a Apply style(s) to an iterable of segments.
Returns an iterable of segments where the style is replaced by ``style + segment.style + post_style``.
Args:
segments (Iterable[Segment]): Segments to process.
style (Style, optional): Base style. Defaults to None.
post_style (Style, optional): Style to apply on top of segment style. Defaults to None.
Returns:
Iterable[Segments]: A new iterable of segments (possibly the same iterable).
c 3 Z ># U H u pnT" X( a S OT" U5 U5 v M" g 7frW r1 ).0rM rS rO applyrk s rI