mirror of https://github.com/Textualize/rich.git
pprint options
This commit is contained in:
parent
8b3c5e8b6c
commit
1d4ee64f79
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -10,12 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Added
|
||||
|
||||
- Added tracebacks_show_locals parameter to RichHandler
|
||||
- Applied dim=True to indent guide styles
|
||||
- Added max_string to Pretty
|
||||
- Factored out RichHandler.get_style_and_level to allow for overriding in subclasses
|
||||
- Added rich.ansi.AnsiDecoder
|
||||
- Added decoding of ansi codes to captured stdout in Progress
|
||||
|
||||
- Added expand_all to rich.pretty.pprint
|
||||
|
||||
### Changed
|
||||
|
||||
- Applied dim=True to indent guide styles
|
||||
- Factored out RichHandler.get_style_and_level to allow for overriding in subclasses
|
||||
- Hid progress bars from html export
|
||||
- rich.pretty.pprint now soft wraps
|
||||
|
||||
## [9.1.0] - 2020-10-23
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ class Pretty:
|
|||
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
||||
Defaults to None.
|
||||
max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to None.
|
||||
expand_all (bool, optional): Expand all containers. Defaults to False.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
@ -107,6 +108,7 @@ class Pretty:
|
|||
indent_guides: bool = False,
|
||||
max_length: int = None,
|
||||
max_string: int = None,
|
||||
expand_all: bool = False,
|
||||
) -> None:
|
||||
self._object = _object
|
||||
self.highlighter = highlighter or ReprHighlighter()
|
||||
|
@ -117,6 +119,7 @@ class Pretty:
|
|||
self.indent_guides = indent_guides
|
||||
self.max_length = max_length
|
||||
self.max_string = max_string
|
||||
self.expand_all = expand_all
|
||||
|
||||
def __rich_console__(
|
||||
self, console: "Console", options: "ConsoleOptions"
|
||||
|
@ -127,6 +130,7 @@ class Pretty:
|
|||
indent_size=self.indent_size,
|
||||
max_length=self.max_length,
|
||||
max_string=self.max_string,
|
||||
expand_all=self.expand_all,
|
||||
)
|
||||
pretty_text = Text(
|
||||
pretty_str,
|
||||
|
@ -443,9 +447,10 @@ def pprint(
|
|||
_object: Any,
|
||||
*,
|
||||
console: "Console" = None,
|
||||
indent_guides: bool = True,
|
||||
max_length: int = None,
|
||||
max_string: int = None,
|
||||
indent_guides: bool = True,
|
||||
expand_all: bool = False,
|
||||
):
|
||||
"""A convenience function for pretty printing.
|
||||
|
||||
|
@ -456,6 +461,7 @@ def pprint(
|
|||
Defaults to None.
|
||||
max_string (int, optional): Maximum length of strings before truncating, or None to disable. Defaults to None.
|
||||
indent_guides (bool, optional): Enable indentation guides. Defaults to True.
|
||||
expand_all (bool, optional): Expand all containers. Defaults to False.
|
||||
"""
|
||||
_console = get_console() if console is None else console
|
||||
_console.print(
|
||||
|
@ -464,7 +470,10 @@ def pprint(
|
|||
max_length=max_length,
|
||||
max_string=max_string,
|
||||
indent_guides=indent_guides,
|
||||
)
|
||||
expand_all=expand_all,
|
||||
overflow="ignore",
|
||||
),
|
||||
soft_wrap=True,
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue