Method: rich._wrap.divide_line
Calls: 1464, Exceptions: 0, Paths: 9Back
Path 1: 1175 calls (0.8)
'Step 0' (77) 'Step 1' (70) 'Step 2' (63) 'Step 3' (56) 'Step 4' (49) 'foo' (45) 'Step 5' (42) 'bar' (39) 'Step 6' (35) 'Step 7' (28)
60 (490) 80 (85) 100 (67) 3 (55) 88 (40) 1 (39) 8 (27) 7 (27) 4 (24) 20 (24)
True (867) False (308)
[] (1175)
1def divide_line(text: str, width: int, fold: bool = True) -> List[int]:
2 divides: List[int] = []
3 append = divides.append
4 line_position = 0
5 _cell_len = cell_len
6 for start, _end, word in words(text):
7 word_length = _cell_len(word.rstrip())
8 if line_position + word_length > width:
9 if word_length > width:
10 if fold:
11 chopped_words = chop_cells(word, max_size=width, position=0)
12 for last, line in loop_last(chopped_words):
13 if start:
14 append(start)
15
16 if last:
17 line_position = _cell_len(line)
18 else:
19 start += len(line)
20 else:
21 if start:
22 append(start)
23 line_position = _cell_len(word)
24 elif line_position and start:
25 append(start)
26 line_position = _cell_len(word)
27 else:
28 line_position += _cell_len(word)
29 return divides
Path 2: 206 calls (0.14)
'' (195) ' ' (4) ' ' (4) ' ' (2) ' ' (1)
60 (79) 3 (25) 8 (18) 96 (18) 46 (11) 100 (11) 15 (8) 88 (6) 30 (5) 19 (4)
True (140) False (66)
[] (206)
1def divide_line(text: str, width: int, fold: bool = True) -> List[int]:
2 divides: List[int] = []
3 append = divides.append
4 line_position = 0
5 _cell_len = cell_len
6 for start, _end, word in words(text):
7 word_length = _cell_len(word.rstrip())
8 if line_position + word_length > width:
9 if word_length > width:
10 if fold:
11 chopped_words = chop_cells(word, max_size=width, position=0)
12 for last, line in loop_last(chopped_words):
13 if start:
14 append(start)
15
16 if last:
17 line_position = _cell_len(line)
18 else:
19 start += len(line)
20 else:
21 if start:
22 append(start)
23 line_position = _cell_len(word)
24 elif line_position and start:
25 append(start)
26 line_position = _cell_len(word)
27 else:
28 line_position += _cell_len(word)
29 return divides
Path 3: 58 calls (0.04)
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque in metus sed sapien ultricies pretium a at justo. Maecenas luctus velit et auctor ma...
96 (13) 46 (11) 27 (6) 20 (3) 31 (3) 88 (3) 85 (2) 42 (2) 87 (2) 60 (2)
True (40) False (18)
[88] (11) [31] (4) [18, 28, 40, 57, 78, 95, 115, 131, 147] (3) [85] (3) [80] (2) [29] (2) [45] (2) [37] (2) [86] (2) [7] (2)
1def divide_line(text: str, width: int, fold: bool = True) -> List[int]:
2 divides: List[int] = []
3 append = divides.append
4 line_position = 0
5 _cell_len = cell_len
6 for start, _end, word in words(text):
7 word_length = _cell_len(word.rstrip())
8 if line_position + word_length > width:
9 if word_length > width:
10 if fold:
11 chopped_words = chop_cells(word, max_size=width, position=0)
12 for last, line in loop_last(chopped_words):
13 if start:
14 append(start)
15
16 if last:
17 line_position = _cell_len(line)
18 else:
19 start += len(line)
20 else:
21 if start:
22 append(start)
23 line_position = _cell_len(word)
24 elif line_position and start:
25 append(start)
26 line_position = _cell_len(word)
27 else:
28 line_position += _cell_len(word)
29 return divides
Path 4: 10 calls (0.01)
'class test_can_handle_special_characters_in_docstrings.
46 (5) 4 (2) 7 (1) 10 (1) 76 (1)
True (10)
[6, 52] (5) [5, 12] (1) [3, 7, 11] (1) [7, 17] (1) [2, 6, 10] (1) [76] (1)
1def divide_line(text: str, width: int, fold: bool = True) -> List[int]:
2 divides: List[int] = []
3 append = divides.append
4 line_position = 0
5 _cell_len = cell_len
6 for start, _end, word in words(text):
7 word_length = _cell_len(word.rstrip())
8 if line_position + word_length > width:
9 if word_length > width:
10 if fold:
11 chopped_words = chop_cells(word, max_size=width, position=0)
12 for last, line in loop_last(chopped_words):
13 if start:
14 append(start)
15
16 if last:
17 line_position = _cell_len(line)
18 else:
19 start += len(line)
20 else:
21 if start:
22 append(start)
23 line_position = _cell_len(word)
24 elif line_position and start:
25 append(start)
26 line_position = _cell_len(word)
27 else:
28 line_position += _cell_len(word)
29 return divides
Path 5: 10 calls (0.01)
'Layout(' (3) " name='foo'" (2) 'わさび' (2) " name='bar'" (1) 'abracadabra' (1) ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
6 (6) 4 (2) 3 (1) 100 (1)
True (10)
[6] (3) [6, 12] (3) [2] (1) [1, 2] (1) [4, 8] (1) [100] (1)
1def divide_line(text: str, width: int, fold: bool = True) -> List[int]:
2 divides: List[int] = []
3 append = divides.append
4 line_position = 0
5 _cell_len = cell_len
6 for start, _end, word in words(text):
7 word_length = _cell_len(word.rstrip())
8 if line_position + word_length > width:
9 if word_length > width:
10 if fold:
11 chopped_words = chop_cells(word, max_size=width, position=0)
12 for last, line in loop_last(chopped_words):
13 if start:
14 append(start)
15
16 if last:
17 line_position = _cell_len(line)
18 else:
19 start += len(line)
20 else:
21 if start:
22 append(start)
23 line_position = _cell_len(word)
24 elif line_position and start:
25 append(start)
26 line_position = _cell_len(word)
27 else:
28 line_position += _cell_len(word)
29 return divides
Path 6: 2 calls (0.0)
'baz' (1) 'bigwordbigwordbigwordbigwordbigwordbigwordbigwordbigwordbigwordbigword' (1)
2 (1) 4 (1)
False (2)
[] (2)
1def divide_line(text: str, width: int, fold: bool = True) -> List[int]:
2 divides: List[int] = []
3 append = divides.append
4 line_position = 0
5 _cell_len = cell_len
6 for start, _end, word in words(text):
7 word_length = _cell_len(word.rstrip())
8 if line_position + word_length > width:
9 if word_length > width:
10 if fold:
11 chopped_words = chop_cells(word, max_size=width, position=0)
12 for last, line in loop_last(chopped_words):
13 if start:
14 append(start)
15
16 if last:
17 line_position = _cell_len(line)
18 else:
19 start += len(line)
20 else:
21 if start:
22 append(start)
23 line_position = _cell_len(word)
24 elif line_position and start:
25 append(start)
26 line_position = _cell_len(word)
27 else:
28 line_position += _cell_len(word)
29 return divides
Path 7: 1 calls (0.0)
'banana pancakes' (1)
3 (1)
False (1)
[7] (1)
1def divide_line(text: str, width: int, fold: bool = True) -> List[int]:
2 divides: List[int] = []
3 append = divides.append
4 line_position = 0
5 _cell_len = cell_len
6 for start, _end, word in words(text):
7 word_length = _cell_len(word.rstrip())
8 if line_position + word_length > width:
9 if word_length > width:
10 if fold:
11 chopped_words = chop_cells(word, max_size=width, position=0)
12 for last, line in loop_last(chopped_words):
13 if start:
14 append(start)
15
16 if last:
17 line_position = _cell_len(line)
18 else:
19 start += len(line)
20 else:
21 if start:
22 append(start)
23 line_position = _cell_len(word)
24 elif line_position and start:
25 append(start)
26 line_position = _cell_len(word)
27 else:
28 line_position += _cell_len(word)
29 return divides
Path 8: 1 calls (0.0)
'banana pancakes' (1)
7 (1)
False (1)
[7] (1)
1def divide_line(text: str, width: int, fold: bool = True) -> List[int]:
2 divides: List[int] = []
3 append = divides.append
4 line_position = 0
5 _cell_len = cell_len
6 for start, _end, word in words(text):
7 word_length = _cell_len(word.rstrip())
8 if line_position + word_length > width:
9 if word_length > width:
10 if fold:
11 chopped_words = chop_cells(word, max_size=width, position=0)
12 for last, line in loop_last(chopped_words):
13 if start:
14 append(start)
15
16 if last:
17 line_position = _cell_len(line)
18 else:
19 start += len(line)
20 else:
21 if start:
22 append(start)
23 line_position = _cell_len(word)
24 elif line_position and start:
25 append(start)
26 line_position = _cell_len(word)
27 else:
28 line_position += _cell_len(word)
29 return divides
Path 9: 1 calls (0.0)
'Some more words' (1)
4 (1)
False (1)
[5, 10] (1)
1def divide_line(text: str, width: int, fold: bool = True) -> List[int]:
2 divides: List[int] = []
3 append = divides.append
4 line_position = 0
5 _cell_len = cell_len
6 for start, _end, word in words(text):
7 word_length = _cell_len(word.rstrip())
8 if line_position + word_length > width:
9 if word_length > width:
10 if fold:
11 chopped_words = chop_cells(word, max_size=width, position=0)
12 for last, line in loop_last(chopped_words):
13 if start:
14 append(start)
15
16 if last:
17 line_position = _cell_len(line)
18 else:
19 start += len(line)
20 else:
21 if start:
22 append(start)
23 line_position = _cell_len(word)
24 elif line_position and start:
25 append(start)
26 line_position = _cell_len(word)
27 else:
28 line_position += _cell_len(word)
29 return divides