Method: rich._inspect.Inspect._get_formatted_doc
Calls: 31, Exceptions: 0, Paths: 2Back
Path 1: 21 calls (0.68)
builtin_function_or_method (7) test_can_handle_special_characters_in_docstrings.
'int([x]) -> integer\nint(x, base=10) -> integer' (3) 'Foo test' (1) 'constructor docs.' (1) 'Multi line' (1) "str(object='') -> str\nstr(bytes_or_buf...
1def _get_formatted_doc(self, object_: Any) -> Optional[str]:
2 """
3 Extract the docstring of an object, process it and returns it.
4 The processing consists in cleaning up the doctring's indentation,
5 taking only its 1st paragraph if `self.help` is not True,
6 and escape its control codes.
7
8 Args:
9 object_ (Any): the object to get the docstring from.
10
11 Returns:
12 Optional[str]: the processed docstring, or None if no docstring was found.
13 """
14 docs = getdoc(object_)
15 if docs is None:
16 return None
17 docs = cleandoc(docs).strip()
18 if not self.help:
19 docs = _first_paragraph(docs)
20 return escape_control_codes(docs)
Path 2: 10 calls (0.32)
test_can_handle_special_characters_in_docstrings. None (10)
1def _get_formatted_doc(self, object_: Any) -> Optional[str]:
2 """
3 Extract the docstring of an object, process it and returns it.
4 The processing consists in cleaning up the doctring's indentation,
5 taking only its 1st paragraph if `self.help` is not True,
6 and escape its control codes.
7
8 Args:
9 object_ (Any): the object to get the docstring from.
10
11 Returns:
12 Optional[str]: the processed docstring, or None if no docstring was found.
13 """
14 docs = getdoc(object_)
15 if docs is None:
16 return None
17 docs = cleandoc(docs).strip()
18 if not self.help:
19 docs = _first_paragraph(docs)
20 return escape_control_codes(docs)