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

Function pprint

rich/pretty.py:918–952  ·  view source on GitHub ↗

A convenience function for pretty printing. Args: _object (Any): Object to pretty print. console (Console, optional): Console instance, or None to use default. Defaults to None. max_length (int, optional): Maximum length of containers before abbreviating, or None for no

(
    _object: Any,
    *,
    console: Optional["Console"] = None,
    indent_guides: bool = True,
    max_length: Optional[int] = None,
    max_string: Optional[int] = None,
    max_depth: Optional[int] = None,
    expand_all: bool = False,
)

Source from the content-addressed store, hash-verified

916
917
918def pprint(
919 _object: Any,
920 *,
921 console: Optional["Console"] = None,
922 indent_guides: bool = True,
923 max_length: Optional[int] = None,
924 max_string: Optional[int] = None,
925 max_depth: Optional[int] = None,
926 expand_all: bool = False,
927) -> None:
928 """A convenience function for pretty printing.
929
930 Args:
931 _object (Any): Object to pretty print.
932 console (Console, optional): Console instance, or None to use default. Defaults to None.
933 max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
934 Defaults to None.
935 max_string (int, optional): Maximum length of strings before truncating, or None to disable. Defaults to None.
936 max_depth (int, optional): Maximum depth for nested data structures, or None for unlimited depth. Defaults to None.
937 indent_guides (bool, optional): Enable indentation guides. Defaults to True.
938 expand_all (bool, optional): Expand all containers. Defaults to False.
939 """
940 _console = get_console() if console is None else console
941 _console.print(
942 Pretty(
943 _object,
944 max_length=max_length,
945 max_string=max_string,
946 max_depth=max_depth,
947 indent_guides=indent_guides,
948 expand_all=expand_all,
949 overflow="ignore",
950 ),
951 soft_wrap=True,
952 )
953
954
955if __name__ == "__main__": # pragma: no cover

Callers 5

test_pprintFunction · 0.90
test_pprint_max_valuesFunction · 0.90
test_pprint_max_itemsFunction · 0.90
test_pprint_max_stringFunction · 0.90
test_tuplesFunction · 0.90

Calls 3

get_consoleFunction · 0.90
PrettyClass · 0.85
printMethod · 0.80

Tested by 5

test_pprintFunction · 0.72
test_pprint_max_valuesFunction · 0.72
test_pprint_max_itemsFunction · 0.72
test_pprint_max_stringFunction · 0.72
test_tuplesFunction · 0.72