Method: rich.console.Console.print
Calls: 427, Exceptions: 1, Paths: 11Back
Path 1: 277 calls (0.65)
' ' (274) '' (3)
'\n' (255) '' (19) 'X' (3)
None (277)
None (267) 'left' (3) 'center' (3) 'right' (3) 'full' (1)
None (277)
None (256) False (17) True (4)
None (261) True (16)
None (261) True (16)
None (277)
None (266) 8 (1) 10 (1) 15 (1) 20 (1) 25 (1) 30 (1) 35 (1) 40 (1) 45 (1)
None (270) 5 (4) 10 (2) 12 (1)
True (277)
None (277)
False (277)
tuple (221) ('foo',) (7) ('FOO',) (4) ('Hello',) (3) ('[b red on blue reverse]foo[/] [blink][link=https://example.org]Click[/link]',) (3) ('foo', 'bar...
UnicodeEncodeError (1)
1def print(
2 self,
3 *objects: Any,
4 sep: str = " ",
5 end: str = "\n",
6 style: Optional[Union[str, Style]] = None,
7 justify: Optional[JustifyMethod] = None,
8 overflow: Optional[OverflowMethod] = None,
9 no_wrap: Optional[bool] = None,
10 emoji: Optional[bool] = None,
11 markup: Optional[bool] = None,
12 highlight: Optional[bool] = None,
13 width: Optional[int] = None,
14 height: Optional[int] = None,
15 crop: bool = True,
16 soft_wrap: Optional[bool] = None,
17 new_line_start: bool = False,
18 ) -> None:
19 """Print to the console.
20
21 Args:
22 objects (positional args): Objects to log to the terminal.
23 sep (str, optional): String to write between print data. Defaults to " ".
24 end (str, optional): String to write at end of print data. Defaults to "\\\\n".
25 style (Union[str, Style], optional): A style to apply to output. Defaults to None.
26 justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
27 overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
28 no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
29 emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
30 markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
31 highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
32 width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
33 crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
34 soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
35 Console default. Defaults to ``None``.
36 new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
37 """
38 if not objects:
39 objects = (NewLine(),)
40
41 if soft_wrap is None:
42 soft_wrap = self.soft_wrap
43 if soft_wrap:
44 if no_wrap is None:
45 no_wrap = True
46 if overflow is None:
47 overflow = "ignore"
48 crop = False
49 render_hooks = self._render_hooks[:]
50 with self:
51 renderables = self._collect_renderables(
52 objects,
53 sep,
54 end,
55 justify=justify,
56 emoji=emoji,
57 markup=markup,
58 highlight=highlight,
59 )
60 for hook in render_hooks:
61 renderables = hook.process_renderables(renderables)
62 render_options = self.options.update(
63 justify=justify,
64 overflow=overflow,
65 width=min(width, self.width) if width is not None else NO_CHANGE,
66 height=height,
67 no_wrap=no_wrap,
68 markup=markup,
69 highlight=highlight,
70 )
71
72 new_segments: List[Segment] = []
73 extend = new_segments.extend
74 render = self.render
75 if style is None:
76 for renderable in renderables:
77 extend(render(renderable, render_options))
78 else:
79 for renderable in renderables:
80 extend(
81 Segment.apply_style(
82 render(renderable, render_options), self.get_style(style)
83 )
84 )
85 if new_line_start:
86 if (
87 len("".join(segment.text for segment in new_segments).splitlines())
88 > 1
89 ):
90 new_segments.insert(0, Segment.line())
91 if crop:
92 buffer_extend = self._buffer.extend
93 for line in Segment.split_and_crop_lines(
94 new_segments, self.width, pad=False
95 ):
96 buffer_extend(line)
97 else:
98 self._buffer.extend(new_segments)
Path 2: 110 calls (0.26)
' ' (110)
'\n' (110)
None (110)
None (110)
None (110)
None (110)
None (110)
None (110)
None (110)
None (110)
None (110)
True (110)
None (110)
False (110)
tuple (100) ('Running step 0',) (1) ('Running step 1',) (1) ('Running step 2',) (1) ('Running step 3',) (1) ('Running step 4',) (1) ('Running step 5',...
1def print(
2 self,
3 *objects: Any,
4 sep: str = " ",
5 end: str = "\n",
6 style: Optional[Union[str, Style]] = None,
7 justify: Optional[JustifyMethod] = None,
8 overflow: Optional[OverflowMethod] = None,
9 no_wrap: Optional[bool] = None,
10 emoji: Optional[bool] = None,
11 markup: Optional[bool] = None,
12 highlight: Optional[bool] = None,
13 width: Optional[int] = None,
14 height: Optional[int] = None,
15 crop: bool = True,
16 soft_wrap: Optional[bool] = None,
17 new_line_start: bool = False,
18 ) -> None:
19 """Print to the console.
20
21 Args:
22 objects (positional args): Objects to log to the terminal.
23 sep (str, optional): String to write between print data. Defaults to " ".
24 end (str, optional): String to write at end of print data. Defaults to "\\\\n".
25 style (Union[str, Style], optional): A style to apply to output. Defaults to None.
26 justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
27 overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
28 no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
29 emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
30 markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
31 highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
32 width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
33 crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
34 soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
35 Console default. Defaults to ``None``.
36 new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
37 """
38 if not objects:
39 objects = (NewLine(),)
40
41 if soft_wrap is None:
42 soft_wrap = self.soft_wrap
43 if soft_wrap:
44 if no_wrap is None:
45 no_wrap = True
46 if overflow is None:
47 overflow = "ignore"
48 crop = False
49 render_hooks = self._render_hooks[:]
50 with self:
51 renderables = self._collect_renderables(
52 objects,
53 sep,
54 end,
55 justify=justify,
56 emoji=emoji,
57 markup=markup,
58 highlight=highlight,
59 )
60 for hook in render_hooks:
61 renderables = hook.process_renderables(renderables)
62 render_options = self.options.update(
63 justify=justify,
64 overflow=overflow,
65 width=min(width, self.width) if width is not None else NO_CHANGE,
66 height=height,
67 no_wrap=no_wrap,
68 markup=markup,
69 highlight=highlight,
70 )
71
72 new_segments: List[Segment] = []
73 extend = new_segments.extend
74 render = self.render
75 if style is None:
76 for renderable in renderables:
77 extend(render(renderable, render_options))
78 else:
79 for renderable in renderables:
80 extend(
81 Segment.apply_style(
82 render(renderable, render_options), self.get_style(style)
83 )
84 )
85 if new_line_start:
86 if (
87 len("".join(segment.text for segment in new_segments).splitlines())
88 > 1
89 ):
90 new_segments.insert(0, Segment.line())
91 if crop:
92 buffer_extend = self._buffer.extend
93 for line in Segment.split_and_crop_lines(
94 new_segments, self.width, pad=False
95 ):
96 buffer_extend(line)
97 else:
98 self._buffer.extend(new_segments)
Path 3: 16 calls (0.04)
' ' (16)
'\n' (16)
None (16)
None (16)
None (16)
None (16)
None (16)
None (16)
None (16)
None (16)
None (16)
True (16)
True (16)
False (16)
tuple (15) ('foo bar baz egg',) (1)
1def print(
2 self,
3 *objects: Any,
4 sep: str = " ",
5 end: str = "\n",
6 style: Optional[Union[str, Style]] = None,
7 justify: Optional[JustifyMethod] = None,
8 overflow: Optional[OverflowMethod] = None,
9 no_wrap: Optional[bool] = None,
10 emoji: Optional[bool] = None,
11 markup: Optional[bool] = None,
12 highlight: Optional[bool] = None,
13 width: Optional[int] = None,
14 height: Optional[int] = None,
15 crop: bool = True,
16 soft_wrap: Optional[bool] = None,
17 new_line_start: bool = False,
18 ) -> None:
19 """Print to the console.
20
21 Args:
22 objects (positional args): Objects to log to the terminal.
23 sep (str, optional): String to write between print data. Defaults to " ".
24 end (str, optional): String to write at end of print data. Defaults to "\\\\n".
25 style (Union[str, Style], optional): A style to apply to output. Defaults to None.
26 justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
27 overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
28 no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
29 emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
30 markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
31 highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
32 width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
33 crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
34 soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
35 Console default. Defaults to ``None``.
36 new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
37 """
38 if not objects:
39 objects = (NewLine(),)
40
41 if soft_wrap is None:
42 soft_wrap = self.soft_wrap
43 if soft_wrap:
44 if no_wrap is None:
45 no_wrap = True
46 if overflow is None:
47 overflow = "ignore"
48 crop = False
49 render_hooks = self._render_hooks[:]
50 with self:
51 renderables = self._collect_renderables(
52 objects,
53 sep,
54 end,
55 justify=justify,
56 emoji=emoji,
57 markup=markup,
58 highlight=highlight,
59 )
60 for hook in render_hooks:
61 renderables = hook.process_renderables(renderables)
62 render_options = self.options.update(
63 justify=justify,
64 overflow=overflow,
65 width=min(width, self.width) if width is not None else NO_CHANGE,
66 height=height,
67 no_wrap=no_wrap,
68 markup=markup,
69 highlight=highlight,
70 )
71
72 new_segments: List[Segment] = []
73 extend = new_segments.extend
74 render = self.render
75 if style is None:
76 for renderable in renderables:
77 extend(render(renderable, render_options))
78 else:
79 for renderable in renderables:
80 extend(
81 Segment.apply_style(
82 render(renderable, render_options), self.get_style(style)
83 )
84 )
85 if new_line_start:
86 if (
87 len("".join(segment.text for segment in new_segments).splitlines())
88 > 1
89 ):
90 new_segments.insert(0, Segment.line())
91 if crop:
92 buffer_extend = self._buffer.extend
93 for line in Segment.split_and_crop_lines(
94 new_segments, self.width, pad=False
95 ):
96 buffer_extend(line)
97 else:
98 self._buffer.extend(new_segments)
Path 4: 9 calls (0.02)
' ' (9)
'\n' (9)
None (9)
None (9)
None (9)
None (9)
None (9)
None (9)
None (9)
None (9)
None (9)
True (9)
None (9)
False (9)
() (9)
1def print(
2 self,
3 *objects: Any,
4 sep: str = " ",
5 end: str = "\n",
6 style: Optional[Union[str, Style]] = None,
7 justify: Optional[JustifyMethod] = None,
8 overflow: Optional[OverflowMethod] = None,
9 no_wrap: Optional[bool] = None,
10 emoji: Optional[bool] = None,
11 markup: Optional[bool] = None,
12 highlight: Optional[bool] = None,
13 width: Optional[int] = None,
14 height: Optional[int] = None,
15 crop: bool = True,
16 soft_wrap: Optional[bool] = None,
17 new_line_start: bool = False,
18 ) -> None:
19 """Print to the console.
20
21 Args:
22 objects (positional args): Objects to log to the terminal.
23 sep (str, optional): String to write between print data. Defaults to " ".
24 end (str, optional): String to write at end of print data. Defaults to "\\\\n".
25 style (Union[str, Style], optional): A style to apply to output. Defaults to None.
26 justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
27 overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
28 no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
29 emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
30 markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
31 highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
32 width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
33 crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
34 soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
35 Console default. Defaults to ``None``.
36 new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
37 """
38 if not objects:
39 objects = (NewLine(),)
40
41 if soft_wrap is None:
42 soft_wrap = self.soft_wrap
43 if soft_wrap:
44 if no_wrap is None:
45 no_wrap = True
46 if overflow is None:
47 overflow = "ignore"
48 crop = False
49 render_hooks = self._render_hooks[:]
50 with self:
51 renderables = self._collect_renderables(
52 objects,
53 sep,
54 end,
55 justify=justify,
56 emoji=emoji,
57 markup=markup,
58 highlight=highlight,
59 )
60 for hook in render_hooks:
61 renderables = hook.process_renderables(renderables)
62 render_options = self.options.update(
63 justify=justify,
64 overflow=overflow,
65 width=min(width, self.width) if width is not None else NO_CHANGE,
66 height=height,
67 no_wrap=no_wrap,
68 markup=markup,
69 highlight=highlight,
70 )
71
72 new_segments: List[Segment] = []
73 extend = new_segments.extend
74 render = self.render
75 if style is None:
76 for renderable in renderables:
77 extend(render(renderable, render_options))
78 else:
79 for renderable in renderables:
80 extend(
81 Segment.apply_style(
82 render(renderable, render_options), self.get_style(style)
83 )
84 )
85 if new_line_start:
86 if (
87 len("".join(segment.text for segment in new_segments).splitlines())
88 > 1
89 ):
90 new_segments.insert(0, Segment.line())
91 if crop:
92 buffer_extend = self._buffer.extend
93 for line in Segment.split_and_crop_lines(
94 new_segments, self.width, pad=False
95 ):
96 buffer_extend(line)
97 else:
98 self._buffer.extend(new_segments)
Path 5: 5 calls (0.01)
' ' (5)
'\n' (5)
None (5)
None (5)
None (5)
None (5)
None (5)
None (5)
None (5)
None (5)
None (5)
True (5)
None (5)
False (5)
tuple (5)
1def print(
2 self,
3 *objects: Any,
4 sep: str = " ",
5 end: str = "\n",
6 style: Optional[Union[str, Style]] = None,
7 justify: Optional[JustifyMethod] = None,
8 overflow: Optional[OverflowMethod] = None,
9 no_wrap: Optional[bool] = None,
10 emoji: Optional[bool] = None,
11 markup: Optional[bool] = None,
12 highlight: Optional[bool] = None,
13 width: Optional[int] = None,
14 height: Optional[int] = None,
15 crop: bool = True,
16 soft_wrap: Optional[bool] = None,
17 new_line_start: bool = False,
18 ) -> None:
19 """Print to the console.
20
21 Args:
22 objects (positional args): Objects to log to the terminal.
23 sep (str, optional): String to write between print data. Defaults to " ".
24 end (str, optional): String to write at end of print data. Defaults to "\\\\n".
25 style (Union[str, Style], optional): A style to apply to output. Defaults to None.
26 justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
27 overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
28 no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
29 emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
30 markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
31 highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
32 width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
33 crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
34 soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
35 Console default. Defaults to ``None``.
36 new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
37 """
38 if not objects:
39 objects = (NewLine(),)
40
41 if soft_wrap is None:
42 soft_wrap = self.soft_wrap
43 if soft_wrap:
44 if no_wrap is None:
45 no_wrap = True
46 if overflow is None:
47 overflow = "ignore"
48 crop = False
49 render_hooks = self._render_hooks[:]
50 with self:
51 renderables = self._collect_renderables(
52 objects,
53 sep,
54 end,
55 justify=justify,
56 emoji=emoji,
57 markup=markup,
58 highlight=highlight,
59 )
60 for hook in render_hooks:
61 renderables = hook.process_renderables(renderables)
62 render_options = self.options.update(
63 justify=justify,
64 overflow=overflow,
65 width=min(width, self.width) if width is not None else NO_CHANGE,
66 height=height,
67 no_wrap=no_wrap,
68 markup=markup,
69 highlight=highlight,
70 )
71
72 new_segments: List[Segment] = []
73 extend = new_segments.extend
74 render = self.render
75 if style is None:
76 for renderable in renderables:
77 extend(render(renderable, render_options))
78 else:
79 for renderable in renderables:
80 extend(
81 Segment.apply_style(
82 render(renderable, render_options), self.get_style(style)
83 )
84 )
85 if new_line_start:
86 if (
87 len("".join(segment.text for segment in new_segments).splitlines())
88 > 1
89 ):
90 new_segments.insert(0, Segment.line())
91 if crop:
92 buffer_extend = self._buffer.extend
93 for line in Segment.split_and_crop_lines(
94 new_segments, self.width, pad=False
95 ):
96 buffer_extend(line)
97 else:
98 self._buffer.extend(new_segments)
Path 6: 4 calls (0.01)
' ' (4)
'\n' (3) 'X' (1)
None (4)
None (4)
'ignore' (2) None (2)
True (2) None (2)
None (3) False (1)
None (3) False (1)
None (4)
None (4)
None (4)
False (4)
None (4)
False (4)
tuple (3) ('foo bar.foo bar.foo bar.foo bar.foo bar',) (1)
1def print(
2 self,
3 *objects: Any,
4 sep: str = " ",
5 end: str = "\n",
6 style: Optional[Union[str, Style]] = None,
7 justify: Optional[JustifyMethod] = None,
8 overflow: Optional[OverflowMethod] = None,
9 no_wrap: Optional[bool] = None,
10 emoji: Optional[bool] = None,
11 markup: Optional[bool] = None,
12 highlight: Optional[bool] = None,
13 width: Optional[int] = None,
14 height: Optional[int] = None,
15 crop: bool = True,
16 soft_wrap: Optional[bool] = None,
17 new_line_start: bool = False,
18 ) -> None:
19 """Print to the console.
20
21 Args:
22 objects (positional args): Objects to log to the terminal.
23 sep (str, optional): String to write between print data. Defaults to " ".
24 end (str, optional): String to write at end of print data. Defaults to "\\\\n".
25 style (Union[str, Style], optional): A style to apply to output. Defaults to None.
26 justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
27 overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
28 no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
29 emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
30 markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
31 highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
32 width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
33 crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
34 soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
35 Console default. Defaults to ``None``.
36 new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
37 """
38 if not objects:
39 objects = (NewLine(),)
40
41 if soft_wrap is None:
42 soft_wrap = self.soft_wrap
43 if soft_wrap:
44 if no_wrap is None:
45 no_wrap = True
46 if overflow is None:
47 overflow = "ignore"
48 crop = False
49 render_hooks = self._render_hooks[:]
50 with self:
51 renderables = self._collect_renderables(
52 objects,
53 sep,
54 end,
55 justify=justify,
56 emoji=emoji,
57 markup=markup,
58 highlight=highlight,
59 )
60 for hook in render_hooks:
61 renderables = hook.process_renderables(renderables)
62 render_options = self.options.update(
63 justify=justify,
64 overflow=overflow,
65 width=min(width, self.width) if width is not None else NO_CHANGE,
66 height=height,
67 no_wrap=no_wrap,
68 markup=markup,
69 highlight=highlight,
70 )
71
72 new_segments: List[Segment] = []
73 extend = new_segments.extend
74 render = self.render
75 if style is None:
76 for renderable in renderables:
77 extend(render(renderable, render_options))
78 else:
79 for renderable in renderables:
80 extend(
81 Segment.apply_style(
82 render(renderable, render_options), self.get_style(style)
83 )
84 )
85 if new_line_start:
86 if (
87 len("".join(segment.text for segment in new_segments).splitlines())
88 > 1
89 ):
90 new_segments.insert(0, Segment.line())
91 if crop:
92 buffer_extend = self._buffer.extend
93 for line in Segment.split_and_crop_lines(
94 new_segments, self.width, pad=False
95 ):
96 buffer_extend(line)
97 else:
98 self._buffer.extend(new_segments)
Path 7: 2 calls (0.0)
' ' (2)
'\n' (2)
None (2)
None (2)
None (2)
None (2)
None (2)
None (2)
None (2)
None (2)
None (2)
False (2)
None (2)
True (2)
tuple (2)
1def print(
2 self,
3 *objects: Any,
4 sep: str = " ",
5 end: str = "\n",
6 style: Optional[Union[str, Style]] = None,
7 justify: Optional[JustifyMethod] = None,
8 overflow: Optional[OverflowMethod] = None,
9 no_wrap: Optional[bool] = None,
10 emoji: Optional[bool] = None,
11 markup: Optional[bool] = None,
12 highlight: Optional[bool] = None,
13 width: Optional[int] = None,
14 height: Optional[int] = None,
15 crop: bool = True,
16 soft_wrap: Optional[bool] = None,
17 new_line_start: bool = False,
18 ) -> None:
19 """Print to the console.
20
21 Args:
22 objects (positional args): Objects to log to the terminal.
23 sep (str, optional): String to write between print data. Defaults to " ".
24 end (str, optional): String to write at end of print data. Defaults to "\\\\n".
25 style (Union[str, Style], optional): A style to apply to output. Defaults to None.
26 justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
27 overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
28 no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
29 emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
30 markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
31 highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
32 width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
33 crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
34 soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
35 Console default. Defaults to ``None``.
36 new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
37 """
38 if not objects:
39 objects = (NewLine(),)
40
41 if soft_wrap is None:
42 soft_wrap = self.soft_wrap
43 if soft_wrap:
44 if no_wrap is None:
45 no_wrap = True
46 if overflow is None:
47 overflow = "ignore"
48 crop = False
49 render_hooks = self._render_hooks[:]
50 with self:
51 renderables = self._collect_renderables(
52 objects,
53 sep,
54 end,
55 justify=justify,
56 emoji=emoji,
57 markup=markup,
58 highlight=highlight,
59 )
60 for hook in render_hooks:
61 renderables = hook.process_renderables(renderables)
62 render_options = self.options.update(
63 justify=justify,
64 overflow=overflow,
65 width=min(width, self.width) if width is not None else NO_CHANGE,
66 height=height,
67 no_wrap=no_wrap,
68 markup=markup,
69 highlight=highlight,
70 )
71
72 new_segments: List[Segment] = []
73 extend = new_segments.extend
74 render = self.render
75 if style is None:
76 for renderable in renderables:
77 extend(render(renderable, render_options))
78 else:
79 for renderable in renderables:
80 extend(
81 Segment.apply_style(
82 render(renderable, render_options), self.get_style(style)
83 )
84 )
85 if new_line_start:
86 if (
87 len("".join(segment.text for segment in new_segments).splitlines())
88 > 1
89 ):
90 new_segments.insert(0, Segment.line())
91 if crop:
92 buffer_extend = self._buffer.extend
93 for line in Segment.split_and_crop_lines(
94 new_segments, self.width, pad=False
95 ):
96 buffer_extend(line)
97 else:
98 self._buffer.extend(new_segments)
Path 8: 1 calls (0.0)
' ' (1)
'\n' (1)
'bold' (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
True (1)
None (1)
False (1)
('foo',) (1)
1def print(
2 self,
3 *objects: Any,
4 sep: str = " ",
5 end: str = "\n",
6 style: Optional[Union[str, Style]] = None,
7 justify: Optional[JustifyMethod] = None,
8 overflow: Optional[OverflowMethod] = None,
9 no_wrap: Optional[bool] = None,
10 emoji: Optional[bool] = None,
11 markup: Optional[bool] = None,
12 highlight: Optional[bool] = None,
13 width: Optional[int] = None,
14 height: Optional[int] = None,
15 crop: bool = True,
16 soft_wrap: Optional[bool] = None,
17 new_line_start: bool = False,
18 ) -> None:
19 """Print to the console.
20
21 Args:
22 objects (positional args): Objects to log to the terminal.
23 sep (str, optional): String to write between print data. Defaults to " ".
24 end (str, optional): String to write at end of print data. Defaults to "\\\\n".
25 style (Union[str, Style], optional): A style to apply to output. Defaults to None.
26 justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
27 overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
28 no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
29 emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
30 markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
31 highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
32 width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
33 crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
34 soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
35 Console default. Defaults to ``None``.
36 new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
37 """
38 if not objects:
39 objects = (NewLine(),)
40
41 if soft_wrap is None:
42 soft_wrap = self.soft_wrap
43 if soft_wrap:
44 if no_wrap is None:
45 no_wrap = True
46 if overflow is None:
47 overflow = "ignore"
48 crop = False
49 render_hooks = self._render_hooks[:]
50 with self:
51 renderables = self._collect_renderables(
52 objects,
53 sep,
54 end,
55 justify=justify,
56 emoji=emoji,
57 markup=markup,
58 highlight=highlight,
59 )
60 for hook in render_hooks:
61 renderables = hook.process_renderables(renderables)
62 render_options = self.options.update(
63 justify=justify,
64 overflow=overflow,
65 width=min(width, self.width) if width is not None else NO_CHANGE,
66 height=height,
67 no_wrap=no_wrap,
68 markup=markup,
69 highlight=highlight,
70 )
71
72 new_segments: List[Segment] = []
73 extend = new_segments.extend
74 render = self.render
75 if style is None:
76 for renderable in renderables:
77 extend(render(renderable, render_options))
78 else:
79 for renderable in renderables:
80 extend(
81 Segment.apply_style(
82 render(renderable, render_options), self.get_style(style)
83 )
84 )
85 if new_line_start:
86 if (
87 len("".join(segment.text for segment in new_segments).splitlines())
88 > 1
89 ):
90 new_segments.insert(0, Segment.line())
91 if crop:
92 buffer_extend = self._buffer.extend
93 for line in Segment.split_and_crop_lines(
94 new_segments, self.width, pad=False
95 ):
96 buffer_extend(line)
97 else:
98 self._buffer.extend(new_segments)
Path 9: 1 calls (0.0)
' ' (1)
'\n' (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
0 (1)
None (1)
True (1)
None (1)
False (1)
('Hello',) (1)
1def print(
2 self,
3 *objects: Any,
4 sep: str = " ",
5 end: str = "\n",
6 style: Optional[Union[str, Style]] = None,
7 justify: Optional[JustifyMethod] = None,
8 overflow: Optional[OverflowMethod] = None,
9 no_wrap: Optional[bool] = None,
10 emoji: Optional[bool] = None,
11 markup: Optional[bool] = None,
12 highlight: Optional[bool] = None,
13 width: Optional[int] = None,
14 height: Optional[int] = None,
15 crop: bool = True,
16 soft_wrap: Optional[bool] = None,
17 new_line_start: bool = False,
18 ) -> None:
19 """Print to the console.
20
21 Args:
22 objects (positional args): Objects to log to the terminal.
23 sep (str, optional): String to write between print data. Defaults to " ".
24 end (str, optional): String to write at end of print data. Defaults to "\\\\n".
25 style (Union[str, Style], optional): A style to apply to output. Defaults to None.
26 justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
27 overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
28 no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
29 emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
30 markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
31 highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
32 width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
33 crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
34 soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
35 Console default. Defaults to ``None``.
36 new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
37 """
38 if not objects:
39 objects = (NewLine(),)
40
41 if soft_wrap is None:
42 soft_wrap = self.soft_wrap
43 if soft_wrap:
44 if no_wrap is None:
45 no_wrap = True
46 if overflow is None:
47 overflow = "ignore"
48 crop = False
49 render_hooks = self._render_hooks[:]
50 with self:
51 renderables = self._collect_renderables(
52 objects,
53 sep,
54 end,
55 justify=justify,
56 emoji=emoji,
57 markup=markup,
58 highlight=highlight,
59 )
60 for hook in render_hooks:
61 renderables = hook.process_renderables(renderables)
62 render_options = self.options.update(
63 justify=justify,
64 overflow=overflow,
65 width=min(width, self.width) if width is not None else NO_CHANGE,
66 height=height,
67 no_wrap=no_wrap,
68 markup=markup,
69 highlight=highlight,
70 )
71
72 new_segments: List[Segment] = []
73 extend = new_segments.extend
74 render = self.render
75 if style is None:
76 for renderable in renderables:
77 extend(render(renderable, render_options))
78 else:
79 for renderable in renderables:
80 extend(
81 Segment.apply_style(
82 render(renderable, render_options), self.get_style(style)
83 )
84 )
85 if new_line_start:
86 if (
87 len("".join(segment.text for segment in new_segments).splitlines())
88 > 1
89 ):
90 new_segments.insert(0, Segment.line())
91 if crop:
92 buffer_extend = self._buffer.extend
93 for line in Segment.split_and_crop_lines(
94 new_segments, self.width, pad=False
95 ):
96 buffer_extend(line)
97 else:
98 self._buffer.extend(new_segments)
Path 10: 1 calls (0.0)
' ' (1)
'\n' (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
True (1)
None (1)
True (1)
('Foo',) (1)
1def print(
2 self,
3 *objects: Any,
4 sep: str = " ",
5 end: str = "\n",
6 style: Optional[Union[str, Style]] = None,
7 justify: Optional[JustifyMethod] = None,
8 overflow: Optional[OverflowMethod] = None,
9 no_wrap: Optional[bool] = None,
10 emoji: Optional[bool] = None,
11 markup: Optional[bool] = None,
12 highlight: Optional[bool] = None,
13 width: Optional[int] = None,
14 height: Optional[int] = None,
15 crop: bool = True,
16 soft_wrap: Optional[bool] = None,
17 new_line_start: bool = False,
18 ) -> None:
19 """Print to the console.
20
21 Args:
22 objects (positional args): Objects to log to the terminal.
23 sep (str, optional): String to write between print data. Defaults to " ".
24 end (str, optional): String to write at end of print data. Defaults to "\\\\n".
25 style (Union[str, Style], optional): A style to apply to output. Defaults to None.
26 justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
27 overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
28 no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
29 emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
30 markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
31 highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
32 width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
33 crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
34 soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
35 Console default. Defaults to ``None``.
36 new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
37 """
38 if not objects:
39 objects = (NewLine(),)
40
41 if soft_wrap is None:
42 soft_wrap = self.soft_wrap
43 if soft_wrap:
44 if no_wrap is None:
45 no_wrap = True
46 if overflow is None:
47 overflow = "ignore"
48 crop = False
49 render_hooks = self._render_hooks[:]
50 with self:
51 renderables = self._collect_renderables(
52 objects,
53 sep,
54 end,
55 justify=justify,
56 emoji=emoji,
57 markup=markup,
58 highlight=highlight,
59 )
60 for hook in render_hooks:
61 renderables = hook.process_renderables(renderables)
62 render_options = self.options.update(
63 justify=justify,
64 overflow=overflow,
65 width=min(width, self.width) if width is not None else NO_CHANGE,
66 height=height,
67 no_wrap=no_wrap,
68 markup=markup,
69 highlight=highlight,
70 )
71
72 new_segments: List[Segment] = []
73 extend = new_segments.extend
74 render = self.render
75 if style is None:
76 for renderable in renderables:
77 extend(render(renderable, render_options))
78 else:
79 for renderable in renderables:
80 extend(
81 Segment.apply_style(
82 render(renderable, render_options), self.get_style(style)
83 )
84 )
85 if new_line_start:
86 if (
87 len("".join(segment.text for segment in new_segments).splitlines())
88 > 1
89 ):
90 new_segments.insert(0, Segment.line())
91 if crop:
92 buffer_extend = self._buffer.extend
93 for line in Segment.split_and_crop_lines(
94 new_segments, self.width, pad=False
95 ):
96 buffer_extend(line)
97 else:
98 self._buffer.extend(new_segments)
Path 11: 1 calls (0.0)
' ' (1)
'\n' (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
None (1)
True (1)
None (1)
True (1)
('Foo\nbar\n',) (1)
1def print(
2 self,
3 *objects: Any,
4 sep: str = " ",
5 end: str = "\n",
6 style: Optional[Union[str, Style]] = None,
7 justify: Optional[JustifyMethod] = None,
8 overflow: Optional[OverflowMethod] = None,
9 no_wrap: Optional[bool] = None,
10 emoji: Optional[bool] = None,
11 markup: Optional[bool] = None,
12 highlight: Optional[bool] = None,
13 width: Optional[int] = None,
14 height: Optional[int] = None,
15 crop: bool = True,
16 soft_wrap: Optional[bool] = None,
17 new_line_start: bool = False,
18 ) -> None:
19 """Print to the console.
20
21 Args:
22 objects (positional args): Objects to log to the terminal.
23 sep (str, optional): String to write between print data. Defaults to " ".
24 end (str, optional): String to write at end of print data. Defaults to "\\\\n".
25 style (Union[str, Style], optional): A style to apply to output. Defaults to None.
26 justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
27 overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
28 no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
29 emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
30 markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
31 highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
32 width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
33 crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
34 soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
35 Console default. Defaults to ``None``.
36 new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
37 """
38 if not objects:
39 objects = (NewLine(),)
40
41 if soft_wrap is None:
42 soft_wrap = self.soft_wrap
43 if soft_wrap:
44 if no_wrap is None:
45 no_wrap = True
46 if overflow is None:
47 overflow = "ignore"
48 crop = False
49 render_hooks = self._render_hooks[:]
50 with self:
51 renderables = self._collect_renderables(
52 objects,
53 sep,
54 end,
55 justify=justify,
56 emoji=emoji,
57 markup=markup,
58 highlight=highlight,
59 )
60 for hook in render_hooks:
61 renderables = hook.process_renderables(renderables)
62 render_options = self.options.update(
63 justify=justify,
64 overflow=overflow,
65 width=min(width, self.width) if width is not None else NO_CHANGE,
66 height=height,
67 no_wrap=no_wrap,
68 markup=markup,
69 highlight=highlight,
70 )
71
72 new_segments: List[Segment] = []
73 extend = new_segments.extend
74 render = self.render
75 if style is None:
76 for renderable in renderables:
77 extend(render(renderable, render_options))
78 else:
79 for renderable in renderables:
80 extend(
81 Segment.apply_style(
82 render(renderable, render_options), self.get_style(style)
83 )
84 )
85 if new_line_start:
86 if (
87 len("".join(segment.text for segment in new_segments).splitlines())
88 > 1
89 ):
90 new_segments.insert(0, Segment.line())
91 if crop:
92 buffer_extend = self._buffer.extend
93 for line in Segment.split_and_crop_lines(
94 new_segments, self.width, pad=False
95 ):
96 buffer_extend(line)
97 else:
98 self._buffer.extend(new_segments)