Method: rich.style.Style.render
Calls: 5444, Exceptions: 0, Paths: 3Back
Path 1: 3523 calls (0.65)
'│' (694) ' ' (371) '1' (108) '0' (93) '' (83) '│ ' (82) ' ' (73) '2' (69) '(' (60) ')' (58)
None (3523)
False (3523)
'│' (694) ' ' (371) '1' (108) '0' (93) '' (83) '│ ' (82) ' ' (73) '2' (69) '(' (60) ')' (58)
1def render(
2 self,
3 text: str = "",
4 *,
5 color_system: Optional[ColorSystem] = ColorSystem.TRUECOLOR,
6 legacy_windows: bool = False,
7 ) -> str:
8 """Render the ANSI codes for the style.
9
10 Args:
11 text (str, optional): A string to style. Defaults to "".
12 color_system (Optional[ColorSystem], optional): Color system to render to. Defaults to ColorSystem.TRUECOLOR.
13
14 Returns:
15 str: A string containing ANSI style codes.
16 """
17 if not text or color_system is None:
18 return text
19 attrs = self._ansi or self._make_ansi_codes(color_system)
20 rendered = f"\x1b[{attrs}m{text}\x1b[0m" if attrs else text
21 if self._link and not legacy_windows:
22 rendered = (
23 f"\x1b]8;id={self._link_id};{self._link}\x1b\\{rendered}\x1b]8;;\x1b\\"
24 )
25 return rendered
Path 2: 1906 calls (0.35)
'▄' (275) ' ' (235) '━' (120) ' ' (68) ' ' (58) '│' (40) ' ' (35) ':' (32) '=' (30) '│ ' (28)
ColorSystem (1906)
False (1906)
'\x1b[38;2;248;248;242;48;2;39;40;34m \x1b[0m' (111) '\x1b[1;31m \x1b[0m' (51) '\x1b[1;38;2;227;227;221;48;2;39;40;34m \x1b[0m' (42) '\x...
1def render(
2 self,
3 text: str = "",
4 *,
5 color_system: Optional[ColorSystem] = ColorSystem.TRUECOLOR,
6 legacy_windows: bool = False,
7 ) -> str:
8 """Render the ANSI codes for the style.
9
10 Args:
11 text (str, optional): A string to style. Defaults to "".
12 color_system (Optional[ColorSystem], optional): Color system to render to. Defaults to ColorSystem.TRUECOLOR.
13
14 Returns:
15 str: A string containing ANSI style codes.
16 """
17 if not text or color_system is None:
18 return text
19 attrs = self._ansi or self._make_ansi_codes(color_system)
20 rendered = f"\x1b[{attrs}m{text}\x1b[0m" if attrs else text
21 if self._link and not legacy_windows:
22 rendered = (
23 f"\x1b]8;id={self._link_id};{self._link}\x1b\\{rendered}\x1b]8;;\x1b\\"
24 )
25 return rendered
Path 3: 15 calls (0.0)
'test_log.py' (3) 'test_logging.py' (3) 'bar' (1) '32' (1) '33' (1) '34' (1) '145' (1) '152' (1) '159' (1) 'example' (1)
ColorSystem (15)
False (15)
'\x1b]8;id=216776;http://example.org\x1b\\bar\x1b]8;;\x1b\\' (1) '\x1b]8;id=560836;file:///Users/andrehora/Documents/git/projects-pathspotter/rich/tes...
1def render(
2 self,
3 text: str = "",
4 *,
5 color_system: Optional[ColorSystem] = ColorSystem.TRUECOLOR,
6 legacy_windows: bool = False,
7 ) -> str:
8 """Render the ANSI codes for the style.
9
10 Args:
11 text (str, optional): A string to style. Defaults to "".
12 color_system (Optional[ColorSystem], optional): Color system to render to. Defaults to ColorSystem.TRUECOLOR.
13
14 Returns:
15 str: A string containing ANSI style codes.
16 """
17 if not text or color_system is None:
18 return text
19 attrs = self._ansi or self._make_ansi_codes(color_system)
20 rendered = f"\x1b[{attrs}m{text}\x1b[0m" if attrs else text
21 if self._link and not legacy_windows:
22 rendered = (
23 f"\x1b]8;id={self._link_id};{self._link}\x1b\\{rendered}\x1b]8;;\x1b\\"
24 )
25 return rendered