MCPcopy Index your code
hub / github.com/python/cpython / _help_message_from_doc

Method _help_message_from_doc

Lib/pdb.py:2613–2633  ·  view source on GitHub ↗
(self, doc, usage_only=False)

Source from the content-addressed store, hash-verified

2611 return lines, lineno
2612
2613 def _help_message_from_doc(self, doc, usage_only=False):
2614 lines = [line.strip() for line in doc.rstrip().splitlines()]
2615 if not lines:
2616 return "No help message found."
2617 if "" in lines:
2618 usage_end = lines.index("")
2619 else:
2620 usage_end = 1
2621 formatted = []
2622 indent = " " * len(self.prompt)
2623 for i, line in enumerate(lines):
2624 if i == 0:
2625 prefix = "Usage: "
2626 elif i < usage_end:
2627 prefix = " "
2628 else:
2629 if usage_only:
2630 break
2631 prefix = ""
2632 formatted.append(indent + prefix + line)
2633 return "\n".join(formatted)
2634
2635 def _print_invalid_arg(self, arg):
2636 """Return the usage string for a function."""

Callers 2

do_helpMethod · 0.95
_print_invalid_argMethod · 0.95

Calls 7

enumerateFunction · 0.85
stripMethod · 0.45
splitlinesMethod · 0.45
rstripMethod · 0.45
indexMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected