Method: rich.syntax.Syntax.__rich_measure__
Calls: 13, Exceptions: 0, Paths: 3Back
Path 1: 6 calls (0.46)
Console (6)
ConsoleOptions (6)
Measurement (6)
1def __rich_measure__(
2 self, console: "Console", options: "ConsoleOptions"
3 ) -> "Measurement":
4
5 _, right, _, left = Padding.unpack(self.padding)
6 padding = left + right
7 if self.code_width is not None:
8 width = self.code_width + self._numbers_column_width + padding + 1
9 return Measurement(self._numbers_column_width, width)
10 lines = self.code.splitlines()
11 width = (
12 self._numbers_column_width
13 + padding
14 + (max(cell_len(line) for line in lines) if lines else 0)
15 )
16 if self.line_numbers:
17 width += 1
18 return Measurement(self._numbers_column_width, width)
Path 2: 6 calls (0.46)
Console (6)
ConsoleOptions (6)
Measurement (6)
1def __rich_measure__(
2 self, console: "Console", options: "ConsoleOptions"
3 ) -> "Measurement":
4
5 _, right, _, left = Padding.unpack(self.padding)
6 padding = left + right
7 if self.code_width is not None:
8 width = self.code_width + self._numbers_column_width + padding + 1
9 return Measurement(self._numbers_column_width, width)
10 lines = self.code.splitlines()
11 width = (
12 self._numbers_column_width
13 + padding
14 + (max(cell_len(line) for line in lines) if lines else 0)
15 )
16 if self.line_numbers:
17 width += 1
18 return Measurement(self._numbers_column_width, width)
Path 3: 1 calls (0.08)
Console (1)
ConsoleOptions (1)
Measurement (1)
1def __rich_measure__(
2 self, console: "Console", options: "ConsoleOptions"
3 ) -> "Measurement":
4
5 _, right, _, left = Padding.unpack(self.padding)
6 padding = left + right
7 if self.code_width is not None:
8 width = self.code_width + self._numbers_column_width + padding + 1
9 return Measurement(self._numbers_column_width, width)
10 lines = self.code.splitlines()
11 width = (
12 self._numbers_column_width
13 + padding
14 + (max(cell_len(line) for line in lines) if lines else 0)
15 )
16 if self.line_numbers:
17 width += 1
18 return Measurement(self._numbers_column_width, width)