Method: rich.text.Text.stylize
Calls: 269, Exceptions: 0, Paths: 5Back
Path 1: 188 calls (0.7)
Style (164) 'repr.indent' (15) 'dim green' (5) 'bold' (3) 'italic' (1)
0 (179) 1 (2) 7 (2) 9 (1) 14 (1) 302 (1) 247 (1) 343 (1)
4 (99) 8 (64) 12 (14) 5 (2) 2 (1) 19 (1) 175 (1) 310 (1) 260 (1) 366 (1)
1def stylize(
2 self,
3 style: Union[str, Style],
4 start: int = 0,
5 end: Optional[int] = None,
6 ) -> None:
7 """Apply a style to the text, or a portion of the text.
8
9 Args:
10 style (Union[str, Style]): Style instance or style definition to apply.
11 start (int): Start offset (negative indexing is supported). Defaults to 0.
12 end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None.
13 """
14 if style:
15 length = len(self)
16 if start < 0:
17 start = length + start
18 if end is None:
19 end = length
20 if end < 0:
21 end = length + end
22 if start >= length or end <= start:
23 # Span not in text or not valid
24 return
25 self._spans.append(Span(start, min(length, end), style))
Path 2: 46 calls (0.17)
'logging.level.error' (16) 'inspect.doc' (14) 'link file:///Users/andrehora/Documents/git/projects-pathspotter/rich/tests/test_inspect.py' (9) Style (...
0 (46)
None (46)
1def stylize(
2 self,
3 style: Union[str, Style],
4 start: int = 0,
5 end: Optional[int] = None,
6 ) -> None:
7 """Apply a style to the text, or a portion of the text.
8
9 Args:
10 style (Union[str, Style]): Style instance or style definition to apply.
11 start (int): Start offset (negative indexing is supported). Defaults to 0.
12 end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None.
13 """
14 if style:
15 length = len(self)
16 if start < 0:
17 start = length + start
18 if end is None:
19 end = length
20 if end < 0:
21 end = length + end
22 if start >= length or end <= start:
23 # Span not in text or not valid
24 return
25 self._spans.append(Span(start, min(length, end), style))
Path 3: 28 calls (0.1)
'repr.indent' (16) Style (7) 'dim green' (3) 'bold' (1) 'bold underline' (1)
0 (27) 20 (1)
0 (27) 25 (1)
None (28)
1def stylize(
2 self,
3 style: Union[str, Style],
4 start: int = 0,
5 end: Optional[int] = None,
6 ) -> None:
7 """Apply a style to the text, or a portion of the text.
8
9 Args:
10 style (Union[str, Style]): Style instance or style definition to apply.
11 start (int): Start offset (negative indexing is supported). Defaults to 0.
12 end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None.
13 """
14 if style:
15 length = len(self)
16 if start < 0:
17 start = length + start
18 if end is None:
19 end = length
20 if end < 0:
21 end = length + end
22 if start >= length or end <= start:
23 # Span not in text or not valid
24 return
25 self._spans.append(Span(start, min(length, end), style))
Path 4: 6 calls (0.02)
'link file:///Users/andrehora/Documents/git/projects-pathspotter/rich/tests/test_inspect.py' (6)
0 (6)
None (6)
None (6)
1def stylize(
2 self,
3 style: Union[str, Style],
4 start: int = 0,
5 end: Optional[int] = None,
6 ) -> None:
7 """Apply a style to the text, or a portion of the text.
8
9 Args:
10 style (Union[str, Style]): Style instance or style definition to apply.
11 start (int): Start offset (negative indexing is supported). Defaults to 0.
12 end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None.
13 """
14 if style:
15 length = len(self)
16 if start < 0:
17 start = length + start
18 if end is None:
19 end = length
20 if end < 0:
21 end = length + end
22 if start >= length or end <= start:
23 # Span not in text or not valid
24 return
25 self._spans.append(Span(start, min(length, end), style))
Path 5: 1 calls (0.0)
'bold' (1)
-6 (1)
-1 (1)
1def stylize(
2 self,
3 style: Union[str, Style],
4 start: int = 0,
5 end: Optional[int] = None,
6 ) -> None:
7 """Apply a style to the text, or a portion of the text.
8
9 Args:
10 style (Union[str, Style]): Style instance or style definition to apply.
11 start (int): Start offset (negative indexing is supported). Defaults to 0.
12 end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None.
13 """
14 if style:
15 length = len(self)
16 if start < 0:
17 start = length + start
18 if end is None:
19 end = length
20 if end < 0:
21 end = length + end
22 if start >= length or end <= start:
23 # Span not in text or not valid
24 return
25 self._spans.append(Span(start, min(length, end), style))