Method: rich.highlighter.Highlighter.__call__
Calls: 394, Exceptions: 1, Paths: 3Back
Path 1: 307 calls (0.78)
'foo' (35) '():' (16) 'Step 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep 9\n' (14) 'division by zero' (13) 'Step 0\n' (7) '...
Text (307)
1def __call__(self, text: Union[str, Text]) -> Text:
2 """Highlight a str or Text instance.
3
4 Args:
5 text (Union[str, ~Text]): Text to highlight.
6
7 Raises:
8 TypeError: If not called with text or str.
9
10 Returns:
11 Text: A test instance with highlighting applied.
12 """
13 if isinstance(text, str):
14 highlight_text = Text(text)
15 elif isinstance(text, Text):
16 highlight_text = text.copy()
17 else:
18 raise TypeError(f"str or Text instance required, not {text!r}")
19 self.highlight(highlight_text)
20 return highlight_text
Path 2: 86 calls (0.22)
Text (86)
Text (86)
1def __call__(self, text: Union[str, Text]) -> Text:
2 """Highlight a str or Text instance.
3
4 Args:
5 text (Union[str, ~Text]): Text to highlight.
6
7 Raises:
8 TypeError: If not called with text or str.
9
10 Returns:
11 Text: A test instance with highlighting applied.
12 """
13 if isinstance(text, str):
14 highlight_text = Text(text)
15 elif isinstance(text, Text):
16 highlight_text = text.copy()
17 else:
18 raise TypeError(f"str or Text instance required, not {text!r}")
19 self.highlight(highlight_text)
20 return highlight_text
Path 3: 1 calls (0.0)
[] (1)
TypeError (1)
1def __call__(self, text: Union[str, Text]) -> Text:
2 """Highlight a str or Text instance.
3
4 Args:
5 text (Union[str, ~Text]): Text to highlight.
6
7 Raises:
8 TypeError: If not called with text or str.
9
10 Returns:
11 Text: A test instance with highlighting applied.
12 """
13 if isinstance(text, str):
14 highlight_text = Text(text)
15 elif isinstance(text, Text):
16 highlight_text = text.copy()
17 else:
18 raise TypeError(f"str or Text instance required, not {text!r}")
19 self.highlight(highlight_text)
20 return highlight_text