Method: rich.cells.set_cell_size
Calls: 198, Exceptions: 0, Paths: 12Back
Path 1: 70 calls (0.35)
' ' (7) 'Hello' (6) ' ...
0 (7) 2 (6) 77 (5) 16 (5) 69 (4) 74 (3) 53 (3) 50 (3) 78 (3) 49 (3)
'' (7) ' ' (5) ' ...
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos
Path 2: 61 calls (0.31)
'เป็นเกมที่ต้องมีความอดทนมากที่สุดตั้งเเต่เคยเล่นมา' (27) "
5 (6) 46 (6) 6 (6) 60 (6) 7 (3) 8 (2) 10 (2) 11 (2) 13 (2) 14 (2)
"
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos
Path 3: 20 calls (0.1)
'────' (4) '────────────────────────────────────────────────────────────────────────────────────────────────────' (2) '────────────────' (2) '──' (2) ...
4 (5) 16 (4) 3 (3) 100 (2) 2 (2) 5 (2) 12 (1) 1 (1)
'────' (4) '────────────────────────────────────────────────────────────────────────────────────────────────────' (2) '────────────────' (2) '──' (2) ...
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos
Path 4: 19 calls (0.1)
'เป็นเกมที่ต้องมีความอดทนมากที่สุดตั้งเเต่เคยเล่นมา' (4) '───── foo ───────' (4) '─────' (4) '────────────────────────────────────────────────────────...
16 (7) 4 (4) 100 (2) 28 (1) 33 (1) 35 (1) 37 (1) 12 (1) 18 (1)
'───── foo ──────' (4) '────' (4) '────────────────────────────────────────────────────────────────────────────────────────────────────' (2) '────────...
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos
Path 5: 14 calls (0.07)
'เป็นเกมที่ต้องมีความอดทนมากที่สุดตั้งเเต่เคยเล่นมา' (5) '───' (2) '😽😽' (1) 'ello, World!' (1) '──' (1) 'Averlongwordgoeshere' (1) 'baz' (1) 'pancakes...
1 (5) 2 (3) 3 (3) 6 (1) 9 (1) 4 (1)
'─' (3) '😽' (1) 'เ' (1) 'เป' (1) 'เป็น' (1) 'เป็นเกม' (1) 'เป็นเกมที่ต้อ' (1) 'ello' (1) 'Ave' (1) 'b' (1)
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos
Path 6: 7 calls (0.04)
'───' (2) 'เป็นเกมที่ต้องมีความอดทนมากที่สุดตั้งเเต่เคยเล่นมา' (1) '──────' (1) '────' (1) 'World!' (1) 'words' (1)
4 (2) 3 (2) 2 (2) 21 (1)
'──' (2) 'เป็นเกมที่ต้องมีความอดทนมา' (1) '────' (1) '───' (1) 'Worl' (1) 'wor' (1)
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos
Path 7: 2 calls (0.01)
'😽😽' (1) 'เป็นเกมที่ต้องมีความอดทนมากที่สุดตั้งเเต่เคยเล่นมา' (1)
0 (2)
'' (2)
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos
Path 8: 1 calls (0.01)
'Rich supports a simple bbcode-like markup for color, style, and emoji! 👍 🍎 🐜 🐻 🥖 ' (1)
84 (1)
'Rich supports a simple bbcode-like markup for color, style, and emoji! 👍 🍎 🐜 🐻 ' (1)
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos
Path 9: 1 calls (0.01)
'foo' (1)
4 (1)
'foo ' (1)
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos
Path 10: 1 calls (0.01)
'😽😽' (1)
3 (1)
'😽 ' (1)
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos
Path 11: 1 calls (0.01)
'😽😽' (1)
1 (1)
' ' (1)
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos
Path 12: 1 calls (0.01)
'😽😽' (1)
5 (1)
'😽😽 ' (1)
1def set_cell_size(text: str, total: int) -> str:
2 """Set the length of a string to fit within given number of cells."""
3
4 if _is_single_cell_widths(text):
5 size = len(text)
6 if size < total:
7 return text + " " * (total - size)
8 return text[:total]
9
10 if total <= 0:
11 return ""
12 cell_size = cell_len(text)
13 if cell_size == total:
14 return text
15 if cell_size < total:
16 return text + " " * (total - cell_size)
17
18 start = 0
19 end = len(text)
20
21 # Binary search until we find the right size
22 while True:
23 pos = (start + end) // 2
24 before = text[: pos + 1]
25 before_len = cell_len(before)
26 if before_len == total + 1 and cell_len(before[-1]) == 2:
27 return before[:-1] + " "
28 if before_len == total:
29 return before
30 if before_len > total:
31 end = pos
32 else:
33 start = pos