zQi/0UddlmZddlmZddlmZddlmZmZm Z m Z ddl m Z e eeefZedZgdZded <ed eDZejZd ed <Gd deZedd(d)dZedd(d*dZd(d*dZd*dZ d(d+dZ d(d,d Z d(d,d!Zd(d-d#Zd(d.d&Z d'S)/) annotations) lru_cache) itemgetter)Callable NamedTupleSequenceTuple)load)) ~))i)ipi)i%i%)i(i(zlist[tuple[int, int]]_SINGLE_CELL_UNICODE_RANGESc jg|]0\}}ttt||dzD]}|1S))mapchrrange).0_start_end characters Z/home/jenkins/workspace/simtester-sanitize/venv/lib/python3.11/site-packages/rich/cells.py rs[ FDS%q"9"9::  zCallable[[str], bool]_is_single_cell_widthsc2eZdZUdZded<ded<ded<dS) CellTablezDContains unicode data required to measure the cell widths of glyphs.strunicode_versionzSequence[tuple[int, int, int]]widthszfrozenset[str]narrow_to_wideN)__name__ __module__ __qualname____doc____annotations__rrr r &s<NN****""""""rr i)maxsizeautorr!r"returnintcHt|}|r|dksd|cxkrdkrnndSt|j}|d}||dkrdSd}t|dz }||kr4||zdz }||\}} } ||kr|dz }n|| kr|dz}n| S||k4dS)aGet the cell size of a character. Args: character (str): A single character. unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version. Returns: int: Number of cells (0, 1 or 2) occupied by that character. r rrr)ordload_cell_tabler#len) rr" codepointtable last_entry lower_bound upper_boundindexstartendwidths rget_character_cell_sizer>.sIIY^^u 'A'A'A'AE'A'A'A'A'Aq O , , 3ErJ:a=  qKe**q.K  $ ${*q0!%LsE u  !)KK __!)KKL  $ $ 1rtextc"t||S)aGet 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. unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version. Returns: int: Get the number of cells required to display text. ) _cell_lenr?r"s rcached_cell_lenrCQs T? + ++rcht|dkrt||St||S) Get the cell length of a string (length as it appears in the terminal). Args: text: String to measure. unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version. Returns: Length of string in terminal cells. i)r4rCrArBs rcell_lenrFbs3 4yy3t_555 T? + ++rct|rt|Sd|vrd|vrtfd|DSt}d}d}ddh}d}t|}||krM||}||vr|dkr|dz }n*|r|||jvz }d}nt |x} r|}|| z }|dz }||kM|S)rE‍️c38K|]}t|VdS)N)r>)rrr"s r z_cell_len..s?  DM #I ? ?      rrNr)rr4sumr3r$r>) r?r" cell_table total_widthlast_measured_characterSPECIALr:character_countrcharacter_widths ` rrArAqs@d##4yyt 4 4    QU      !11JK*."G E$iiO / ! !K   H$$ ( /6*:SSS *.'"9)_"U"UU /*3'.    / ! ! r'tuple[list[CellSpan], int]'ct|}t|}d}d}d}g}ddh}||kr||x} |vr|s|||dzx}df3| dkr%|||dz krdndz }|d\} } } | || f|d<nE|dz }|r*|d\} } } ||jvr d}| dz } |dz }| || f|d<n|d\} } } | || f|d<t | |x} r%| }|||dzx}| f|| z }n9|r|d\} } } | |dzx}| f|d<n|||dzx}df||k||fS)aTDivide text into spans that define a single grapheme, and additionally return the cell length of the whole string. The returned spans will cover every index in the string, with no gaps. It is possible for some graphemes to have a cell length of zero. This can occur for nonsense strings like two zero width joiners, or for control codes that don't contribute to the grapheme size. Args: text: String to split. unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version. Returns: A tuple of a list of *spans* and the cell length of the entire string. A span is a list of tuples of three values consisting of (, , ), where START and END are string indices, and CELL LENGTH is the cell length of the single grapheme. rNrHrIrr r1)r3r4appendr$r>)r?r"rMcodepoint_countr:rOrNspansrPrr;r cell_lengthrRs rsplit_graphemesrYs$!11J$iiO E*.K(*E"G / ! !e $I 0 0  eeai%7U;<<<H$$e':;;B+09(t["E;7b  * .Rs'TTTUUU]*+TTTrrN)rrr4rYrU) r?r=r"rWrk line_sizelines line_offsetr;r<rds `` r chop_cellsrsFsd##UTTTTTq#d))U9S9STTTTt_55HE1IEK!&sI y 5 ( ( LLk%/0 1 1 1KIY ) T+,,'((( LrN)r,)rr!r"r!r-r.)r?r!r"r!r-r.)r?r!r"r!r-rS)r?r!rZr.r"r!r-r[)r?r!rhr.r"r!r-r!)r?r!r=r.r"r!r-rm)! __future__r functoolsroperatorrtypingrrrr rich._unicode_datar r3r.CellSpanr`rr) frozenset _SINGLE_CELLS issupersetrr r>rCrFrArYrergrlrsr*rrr}sV"""""""888888888888666666 c3 Z]]666 7 1>0HHHHH##### ### 4     D 4 , , , , , , , , , ,----b'-G G G G G V;A)#)#)#)#)#Z;A=====(6r