MCPcopy
hub / github.com/Textualize/rich / Console

Class Console

rich/console.py:581–2642  ·  view source on GitHub ↗

A high level console interface. Args: color_system (str, optional): The color system supported by your terminal, either ``"standard"``, ``"256"`` or ``"truecolor"``. Leave as ``"auto"`` to autodetect. force_terminal (Optional[bool], optional): Enable/disable terminal

Source from the content-addressed store, hash-verified

579
580
581class Console:
582 """A high level console interface.
583
584 Args:
585 color_system (str, optional): The color system supported by your terminal,
586 either ``"standard"``, ``"256"`` or ``"truecolor"``. Leave as ``"auto"`` to autodetect.
587 force_terminal (Optional[bool], optional): Enable/disable terminal control codes, or None to auto-detect terminal. Defaults to None.
588 force_jupyter (Optional[bool], optional): Enable/disable Jupyter rendering, or None to auto-detect Jupyter. Defaults to None.
589 force_interactive (Optional[bool], optional): Enable/disable interactive mode, or None to auto detect. Defaults to None.
590 soft_wrap (Optional[bool], optional): Set soft wrap default on print method. Defaults to False.
591 theme (Theme, optional): An optional style theme object, or ``None`` for default theme.
592 stderr (bool, optional): Use stderr rather than stdout if ``file`` is not specified. Defaults to False.
593 file (IO, optional): A file object where the console should write to. Defaults to stdout.
594 quiet (bool, Optional): Boolean to suppress all output. Defaults to False.
595 width (int, optional): The width of the terminal. Leave as default to auto-detect width.
596 height (int, optional): The height of the terminal. Leave as default to auto-detect height.
597 style (StyleType, optional): Style to apply to all output, or None for no style. Defaults to None.
598 no_color (Optional[bool], optional): Enabled no color mode, or None to auto detect. Defaults to None.
599 tab_size (int, optional): Number of spaces used to replace a tab character. Defaults to 8.
600 record (bool, optional): Boolean to enable recording of terminal output,
601 required to call :meth:`export_html`, :meth:`export_svg`, and :meth:`export_text`. Defaults to False.
602 markup (bool, optional): Boolean to enable :ref:`console_markup`. Defaults to True.
603 emoji (bool, optional): Enable emoji code. Defaults to True.
604 emoji_variant (str, optional): Optional emoji variant, either "text" or "emoji". Defaults to None.
605 highlight (bool, optional): Enable automatic highlighting. Defaults to True.
606 log_time (bool, optional): Boolean to enable logging of time by :meth:`log` methods. Defaults to True.
607 log_path (bool, optional): Boolean to enable the logging of the caller by :meth:`log`. Defaults to True.
608 log_time_format (Union[str, TimeFormatterCallable], optional): If ``log_time`` is enabled, either string for strftime or callable that formats the time. Defaults to "[%X] ".
609 highlighter (HighlighterType, optional): Default highlighter.
610 legacy_windows (bool, optional): Enable legacy Windows mode, or ``None`` to auto detect. Defaults to ``None``.
611 safe_box (bool, optional): Restrict box options that don't render on legacy Windows.
612 get_datetime (Callable[[], datetime], optional): Callable that gets the current time as a datetime.datetime object (used by Console.log),
613 or None for datetime.now.
614 get_time (Callable[[], time], optional): Callable that gets the current time in seconds, default uses time.monotonic.
615 """
616
617 _environ: Mapping[str, str] = os.environ
618
619 def __init__(
620 self,
621 *,
622 color_system: Optional[
623 Literal["auto", "standard", "256", "truecolor", "windows"]
624 ] = "auto",
625 force_terminal: Optional[bool] = None,
626 force_jupyter: Optional[bool] = None,
627 force_interactive: Optional[bool] = None,
628 soft_wrap: bool = False,
629 theme: Optional[Theme] = None,
630 stderr: bool = False,
631 file: Optional[IO[str]] = None,
632 quiet: bool = False,
633 width: Optional[int] = None,
634 height: Optional[int] = None,
635 style: Optional[StyleType] = None,
636 no_color: Optional[bool] = None,
637 tab_size: int = 8,
638 record: bool = False,

Callers 15

profile_pretty.pyFile · 0.90
renderFunction · 0.90
test_console_widthFunction · 0.90
test_fixed_widthFunction · 0.90
test_render_sizeFunction · 0.90
test_title_textFunction · 0.90
test_expand_falseFunction · 0.90
test_rich_consoleFunction · 0.90
test_align_leftFunction · 0.90

Calls

no outgoing calls

Tested by 15

renderFunction · 0.72
test_console_widthFunction · 0.72
test_fixed_widthFunction · 0.72
test_render_sizeFunction · 0.72
test_title_textFunction · 0.72
test_expand_falseFunction · 0.72
test_rich_consoleFunction · 0.72
test_align_leftFunction · 0.72
test_align_centerFunction · 0.72
test_align_rightFunction · 0.72