Method: rich.inspect
Calls: 16, Exceptions: 0, Paths: 1Back
Path 1: 16 calls (1.0)
test_can_handle_special_characters_in_docstrings.
Console (15) None (1)
None (16)
False (16)
False (8) True (8)
True (16)
False (16)
False (16)
True (16)
False (15) True (1)
False (14) True (2)
1def inspect(
2 obj: Any,
3 *,
4 console: Optional["Console"] = None,
5 title: Optional[str] = None,
6 help: bool = False,
7 methods: bool = False,
8 docs: bool = True,
9 private: bool = False,
10 dunder: bool = False,
11 sort: bool = True,
12 all: bool = False,
13 value: bool = True,
14) -> None:
15 """Inspect any Python object.
16
17 * inspect(<OBJECT>) to see summarized info.
18 * inspect(<OBJECT>, methods=True) to see methods.
19 * inspect(<OBJECT>, help=True) to see full (non-abbreviated) help.
20 * inspect(<OBJECT>, private=True) to see private attributes (single underscore).
21 * inspect(<OBJECT>, dunder=True) to see attributes beginning with double underscore.
22 * inspect(<OBJECT>, all=True) to see all attributes.
23
24 Args:
25 obj (Any): An object to inspect.
26 title (str, optional): Title to display over inspect result, or None use type. Defaults to None.
27 help (bool, optional): Show full help text rather than just first paragraph. Defaults to False.
28 methods (bool, optional): Enable inspection of callables. Defaults to False.
29 docs (bool, optional): Also render doc strings. Defaults to True.
30 private (bool, optional): Show private attributes (beginning with underscore). Defaults to False.
31 dunder (bool, optional): Show attributes starting with double underscore. Defaults to False.
32 sort (bool, optional): Sort attributes alphabetically. Defaults to True.
33 all (bool, optional): Show all attributes. Defaults to False.
34 value (bool, optional): Pretty print value. Defaults to True.
35 """
36 _console = console or get_console()
37 from rich._inspect import Inspect
38
39 # Special case for inspect(inspect)
40 is_inspect = obj is inspect
41
42 _inspect = Inspect(
43 obj,
44 title=title,
45 help=is_inspect or help,
46 methods=is_inspect or methods,
47 docs=is_inspect or docs,
48 private=private,
49 dunder=dunder,
50 sort=sort,
51 all=all,
52 value=value,
53 )
54 _console.print(_inspect)