Method: rich.pretty.Node.check_length
Calls: 87, Exceptions: 0, Paths: 2Back
Path 1: 65 calls (0.75)
0 (51) 6 (14)
80 (42) 100 (7) 86 (4) 85 (2) 56 (2) 41 (1) 26 (1) 20 (1) 60 (1) 19 (1)
True (65)
1def check_length(self, start_length: int, max_length: int) -> bool:
2 """Check the length fits within a limit.
3
4 Args:
5 start_length (int): Starting length of the line (indent, prefix, suffix).
6 max_length (int): Maximum length.
7
8 Returns:
9 bool: True if the node can be rendered within max length, otherwise False.
10 """
11 total_length = start_length
12 for token in self.iter_tokens():
13 total_length += cell_len(token)
14 if total_length > max_length:
15 return False
16 return True
Path 2: 22 calls (0.25)
0 (17) 6 (3) 10 (2)
6 (6) 80 (4) 41 (3) 100 (2) 86 (2) 16 (2) 85 (1) 10 (1) 8 (1)
False (22)
1def check_length(self, start_length: int, max_length: int) -> bool:
2 """Check the length fits within a limit.
3
4 Args:
5 start_length (int): Starting length of the line (indent, prefix, suffix).
6 max_length (int): Maximum length.
7
8 Returns:
9 bool: True if the node can be rendered within max length, otherwise False.
10 """
11 total_length = start_length
12 for token in self.iter_tokens():
13 total_length += cell_len(token)
14 if total_length > max_length:
15 return False
16 return True