Files
ServerSync/lib/rich/__pycache__/cells.cpython-314.pyc

115 lines
11 KiB
Plaintext
Raw Normal View History

2026-02-12 02:28:23 +02:00
+
<00> <0C>ib*<00><01>a<03>0t$^RIHt^RIHt^RIHt^RIHtH t H
t
H t ^RI H t] ]]]3,t]!^4t.R!OtR]R&]!]UUUu.uF$wr]!]]!W^,44FpVNK K& uppp4t]P2tR]R &!R
R ] 4t]!R R 7R"RRll4t]!R 4R"RRll4tR"RRlltRRltR"RRllt R"RRllt!R"RRllt"R"RRllt#R"RRllt$R #uupppi)#<23>)<01> annotations)<01> lru_cache)<01>
itemgetter)<04>Callable<6C>
NamedTuple<EFBFBD>Sequence<63>Tuple)<01>loadzlist[tuple[int, int]]<5D>_SINGLE_CELL_UNICODE_RANGESzCallable[[str], bool]<5D>_is_single_cell_widthsc<01>:<00>]tRt^&t$RtR]R&R]R&R]R&RtR #)
<EFBFBD> CellTablezDContains unicode data required to measure the cell widths of glyphs.<2E>str<74>unicode_versionzSequence[tuple[int, int, int]]<5D>widthszfrozenset[str]<5D>narrow_to_wide<64>N)<07>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__firstlineno__<5F>__doc__<5F>__annotations__<5F>__static_attributes__r<00><00>1/tmp/pip-target-qd_sq_1j/lib/python/rich/cells.pyrr&s<00><00>N<><18><18> *<2A>*<2A>"<22>"rri)<01>maxsizec<01>$<00>V^8<>dQhRRRRRR/#)<06><00> characterrr<00>return<72>intr)<01>formats"r<00> __annotate__r$/s!<00><00> <0A> <0A>s<EFBFBD> <0A>S<EFBFBD> <0A>c<EFBFBD> rc<05>p<00>\V4pV'dV^ 8g^Tu;8:d
^<5E>8d^#M^#\V4PpVR,pW$^,8<>d^#^p\V4^,
pWV8:d?WV,^, pW7,wr<>p
W(8d V^,
pK1W)8<>d V^,pKBV
#^#)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.
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<04>ord<72>load_cell_tabler<00>len) r r<00> codepoint<6E>table<6C>
last_entry<EFBFBD> lower_bound<6E> upper_bound<6E>index<65>start<72>end<6E>widths && r<00>get_character_cell_sizer3.s<><00><00><14>I<EFBFBD><0E>I<EFBFBD><10>Y<EFBFBD><12>^<5E>u<EFBFBD> <09>'A<>E<EFBFBD>'A<><10>(B<01><10> <1B>O<EFBFBD> ,<2C> 3<> 3<>E<EFBFBD><16>r<EFBFBD><19>J<EFBFBD><10>a<EFBFBD>=<3D> <20><10><13>K<EFBFBD><15>e<EFBFBD>*<2A>q<EFBFBD>.<2E>K<EFBFBD>
<15>
$<24><1C>*<2A>q<EFBFBD>0<><05>!<21>L<EFBFBD><19><05>E<EFBFBD> <14> <1C><1F>!<21>)<29>K<EFBFBD> <16>_<EFBFBD><1F>!<21>)<29>K<EFBFBD><18>L<EFBFBD> rc<01>$<00>V^8<>dQhRRRRRR/#<00>r<00>textrrr!r"r)r#s"rr$r$Rs!<00><00> ,<2C> ,<2C>#<23> ,<2C><03> ,<2C><13> ,rc<05><00>\W4#)a}Get 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.
)<01> _cell_len<65>r6rs&&r<00>cached_cell_lenr:Qs<00><00> <15>T<EFBFBD> +<2B>+rc<01>$<00>V^8<>dQhRRRRRR/#r5r)r#s"rr$r$bs!<00><00> ,<2C> ,<2C>3<EFBFBD> ,<2C><13> ,<2C>#<23> ,rc<05>N<00>\V4R8d \W4#\W4#)<02>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)r)r:r8r9s&&r<00>cell_lenr>bs%<00><00> <0B>4<EFBFBD>y<EFBFBD>3<EFBFBD><EFBFBD><1E>t<EFBFBD>5<>5<> <14>T<EFBFBD> +<2B>+rc<01>$<00>V^8<>dQhRRRRRR/#r5r)r#s"rr$r$qs!<00><00>-<17>-<17>C<EFBFBD>-<17>#<23>-<17>#<23>-rc<05><>a<01>\V4'd \V4#RV9dRV9d\V3RlV44#\S4p^pRpRR0p^p\V4pWg8diW,pW<>9d2VR8Xd V^, pM>V'dW4VP9, pRpM\ VS4;p 'd TpW9, pV^, pKnV#)r=<00><>c3<01><<"<00>TFp\VS4x<00>K R#5i)N)r3)<03>.0r rs& <20>r<00> <genexpr><3E>_cell_len.<locals>.<genexpr><3E>s <00><><00><00>
<EFBFBD>QU<EFBFBD>I<EFBFBD> #<23>I<EFBFBD><EFBFBD> ?<3F> ?<3F>QU<51>s<00>N)r r)<00>sumr(rr3)
r6r<00>
cell_table<EFBFBD> total_width<74>last_measured_character<65>SPECIALr/<00>character_countr <00>character_widths
&f rr8r8qs<><00><><00><1E>d<EFBFBD>#<23>#<23><12>4<EFBFBD>y<EFBFBD><18><10>t<EFBFBD><1B><08><04> 4<><12>
<EFBFBD>QU<EFBFBD>
<EFBFBD>
<EFBFBD>
<EFBFBD>!<21><1F>1<>J<EFBFBD><13>K<EFBFBD>*.<2E><1B><17><18>"<22>G<EFBFBD> <0A>E<EFBFBD><19>$<24>i<EFBFBD>O<EFBFBD>
<0F>
!<21><18>K<EFBFBD> <09> <14> <1F><18>H<EFBFBD>$<24><15><11>
<EFBFBD><05>(<28><1B>*<2A>:S<>:S<>S<>S<> <0B>*.<2E>'<27><>"9<>)<29>_<EFBFBD>"U<>U<><EFBFBD>U<>*3<>'<27><1B>.<2E> <0B> <0A><11>
<EFBFBD><05> <16>rc<01>$<00>V^8<>dQhRRRRRR/#)rr6rrr!z'tuple[list[CellSpan], int]'r)r#s"rr$r$<00>s$<00><00>2 <20>2 <20>
<0A>2 <20> #<23>2 <20>!<21>2 rc<05>2<00>\V4p\V4p^pRp^p.pRR0pWC8d<>W,;q<>9dV R8Xd&V^, pV'dVR,wr<>p W<>V 3VR&MPV'dIV^, pV'd8VR,wr<>p WRP9dRpV ^, p V^, pW<>V 3VR&K<>\W<>4;p 'd(T pVP YD^,;qM34Wm, pK<>V'gK<>VR,wr<>p W<>^,;qL3VR&K<>Wv3#)z<>Divide text into spans that define a single grapheme.
Args:
text: String to split.
unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version.
Returns:
List of spans.
NrArBr&)r(r)rr3<00>append)r6rrH<00>codepoint_countr/rJrI<00>spansrKr r0<00>_end<6E> cell_lengthrMs&& r<00>split_graphemesrU<00>s5<00><00>!<21><1F>1<>J<EFBFBD><19>$<24>i<EFBFBD>O<EFBFBD> <0A>E<EFBFBD>*.<2E><1B><13>K<EFBFBD>(*<2A>E<EFBFBD><17><18>"<22>G<EFBFBD>
<0F>
!<21><1D><1B> $<24>I<EFBFBD> 0<><18>H<EFBFBD>$<24><15><11>
<EFBFBD><05><18>/4<>R<EFBFBD>y<EFBFBD>,<2C>E<EFBFBD><1B>!&<26>{<7B> ;<3B>E<EFBFBD>"<22>I<EFBFBD><49>(<28><15><11>
<EFBFBD><05><18>/4<>R<EFBFBD>y<EFBFBD>,<2C>E<EFBFBD><1B>.<2E>2K<32>2K<32>K<>26<32>/<2F>#<23>q<EFBFBD>(<28> <0B>#<23>q<EFBFBD>(<28> <0B>!&<26>{<7B> ;<3B>E<EFBFBD>"<22>I<EFBFBD> <14>5<>i<EFBFBD>Q<> Q<>?<3F> Q<>&/<2F> #<23> <11>L<EFBFBD>L<EFBFBD>%<25>!<21>)<29>!3<><15>E<> F<> <17> *<2A>K<EFBFBD> <12>U<EFBFBD>',<2C>R<EFBFBD>y<EFBFBD> $<24>E<EFBFBD><1B><1E><11><19> 2<><05>@<40>E<EFBFBD>"<22>I<EFBFBD> <11> <1F>rc<01>(<00>V^8<>dQhRRRRRRRR/#<00>rr6r<00> cell_positionr"rr!ztuple[str, str]r)r#s"rr$r$<00>s,<00><00>)#<23>)#<23>
<0A>)#<23>!<21>)#<23>47<34>)#<23><14>)#rc<05>4<00>V^8:dRV3#\W4wr4\W, \V4,4p\\ \
VRV44pWa8Xd-V\V48<>dVR3#W5,^,pVRVWR3#Wa8dCW5,wr<>p
Wj,V8<>dVRVR,RW R,3#V^, pWj, pK{W5^,
,wr<>p
Wj,
V8dVRVR,RW R,3#V^,pWj,pK<>)<04>PSplit text by cell position.
If the cell position falls within a double width character, it is converted to two spaces.
Args:
text: Text to split.
cell_position Offset in cells.
unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version.
Returns:
Tuple to two split strings.
<EFBFBD>N<> )rUr"r)rG<00>map<61>_span_get_cell_len) r6rXrrRrT<00>offset<65> left_size<7A> split_indexr0r1<00> cell_sizes &&& r<00> _split_textrc<00>s,<00><00><15><01><19><11>4<EFBFBD>x<EFBFBD><0F>(<28><14>?<3F><16>E<EFBFBD><11>-<2D>-<2D><13>U<EFBFBD><1A>;<3B> <<3C>F<EFBFBD><13>C<EFBFBD>*<2A>E<EFBFBD>'<27>6<EFBFBD>N<EFBFBD>;<3B><<3C>I<EFBFBD>
<0E> <14> %<25><15><13>U<EFBFBD><1A>#<23><1B>R<EFBFBD>x<EFBFBD><0F><1F>-<2D><01>*<2A>K<EFBFBD><17> <0C><1B>%<25>t<EFBFBD>L<EFBFBD>'9<>9<> 9<> <14> $<24>$)<29>M<EFBFBD> !<21>E<EFBFBD> <09><18>$<24>}<7D>4<><1B>F<EFBFBD>U<EFBFBD>|<7C>c<EFBFBD>)<29>3<EFBFBD><14>d<EFBFBD><1A>+;<3B>;<3B>;<3B> <12>a<EFBFBD>K<EFBFBD>F<EFBFBD> <15> "<22>I<EFBFBD>$)<29>1<EFBFBD>*<2A>$5<> !<21>E<EFBFBD> <09><18>$<24>}<7D>4<><1B>F<EFBFBD>U<EFBFBD>|<7C>c<EFBFBD>)<29>3<EFBFBD><14>d<EFBFBD><1A>+;<3B>;<3B>;<3B> <12>a<EFBFBD>K<EFBFBD>F<EFBFBD> <15> "<22>Irc<01>(<00>V^8<>dQhRRRRRRRR/#rWr)r#s"rr$r$s,<00><00>=<3D>=<3D>
<0A>=<3D>!<21>=<3D>47<34>=<3D><14>=rc<05>N<00>\V4'd
VRVWR3#\WV4#)rZN)r rc)r6rXrs&&&r<00>
split_textrfs3<00><00><1E>d<EFBFBD>#<23>#<23><13>N<EFBFBD>]<5D>#<23>T<EFBFBD>.<2E>%9<>9<>9<> <16>t<EFBFBD>O<EFBFBD> <<3C><rc<01>(<00>V^8<>dQhRRRRRRRR/#)rr6r<00>totalr"rr!r)r#s"rr$r$s(<00><00><10><10><03><10>C<EFBFBD><10>#<23><10>3<EFBFBD>rc<05> <00>\V4'd-\V4pW18dVRW,
,,#VRV#V^8:dR#\V4pWA8XdV#WA8dVRW,
,,#\WV4wrV#)aAdjust a string by cropping or padding with spaces such that it fits within the given number of cells.
Args:
text: String to adjust.
total: Desired size in cells.
unicode_version: Unicode version.
Returns:
A string with cell size equal to total.
r\Nr[)r r)r>rc)r6rhr<00>sizerb<00>_s&&& r<00> set_cell_sizerls<><00><00><1E>d<EFBFBD>#<23>#<23><12>4<EFBFBD>y<EFBFBD><04> <0F><<3C><17>#<23><15><1C>.<2E>.<2E> .<2E><13>F<EFBFBD>U<EFBFBD>|<7C><1B> <0C><01>z<EFBFBD><11><18><14><0E>I<EFBFBD><10><19><13> <0B><10><18><13>c<EFBFBD>U<EFBFBD>.<2E>/<2F>/<2F>/<2F><19>$<24><EFBFBD>7<>G<EFBFBD>D<EFBFBD> <0F>Krc<01>(<00>V^8<>dQhRRRRRRRR/#)rr6rr2r"rr!z list[str]r)r#s"rr$r$1s(<00><00><11><11>S<EFBFBD><11><13><11>s<EFBFBD><11> <09>rc<05>Z<00>\V4'd/\^\V4V4Uu.uF q0W3V,NK up#\W4wrE^p.p^pVF2wr<>p Wk,V8<>dVP WV 4T p^pWk, pK4 V'dVP WR4V#uupi)aLSplit text into lines such that each line fits within the available (cell) width.
Args:
text: The text to fold such that it fits in the given width.
width: The width available (number of cells).
Returns:
A list of strings such that each string in the list has cell width
less than or equal to the available width.
N)r <00>ranger)rUrP) r6r2rr/rRrk<00> line_size<7A>lines<65> line_offsetr0r1rbs &&& r<00>
chop_cellsrs1s<><00><00><1E>d<EFBFBD>#<23>#<23>9><3E>q<EFBFBD>#<23>d<EFBFBD>)<29>U<EFBFBD>9S<39>T<>9S<39><05>U<EFBFBD>U<EFBFBD>]<5D>+<2B>9S<39>T<>T<><1E>t<EFBFBD>5<>H<EFBFBD>E<EFBFBD><11>I<EFBFBD><19>E<EFBFBD><13>K<EFBFBD>!&<26><1D><05>I<EFBFBD> <14> <20>5<EFBFBD> (<28> <11>L<EFBFBD>L<EFBFBD><14>%<25>0<> 1<><1F>K<EFBFBD><19>I<EFBFBD><11><1E> <09> "'<27> <11> <0A> <0C> <0C>T<EFBFBD>,<2C>'<27>(<28> <10>L<EFBFBD><4C>Us<00>B(N))<02> <00>~)<02><><00><>)<02><>i<>)ipi<>)i%i<>%)i(i<>()<01>auto)%<25>__conditional_annotations__<5F>
__future__r<00> functoolsr<00>operatorr<00>typingrrrr <00>rich._unicode_datar
r(r"<00>CellSpanr^r r<00> frozensetr]<00>chrro<00> _SINGLE_CELLS<4C>
issupersetr rr3r:r>r8rUrcrfrlrs)<04>_startrSr rzs000@r<00><module>r<>s<00><><01>"<22>"<22><1F><1F>8<>8<>6<> <10><13>c<EFBFBD>3<EFBFBD><1D> <1F><08><1F><01>]<5D><12>6<02><1B>2<><02><1A>8<><06>7<>L<EFBFBD>F<EFBFBD><1C>S<EFBFBD>%<25><06>q<EFBFBD><08>"9<>:<3A>I<EFBFBD> <12>:<3A> <12>7<><06><02> <0A>1><3E>0H<30>0H<30><16>-<2D>H<>#<23>
<EFBFBD>#<23> <0B>4<EFBFBD><18> <0A><19> <0A>D <0B>4<EFBFBD><1F> ,<2C><11> ,<2C> ,<2C>-<17>`2 <20>j)#<23>X=<3D>(<10>6<11><11><>os<00>*C<