I want to search the python help menu inside python fns. I mostly want to search fn names and signatures (type annotations included).
def foo(x: str) -> int:
"""foo doesn't do much"""
return 42
In repl type help(foo)
or pydoc.help(foo)
. Both yield the same. Toggles to an interactive view. See this:
Help on function foo in module __main__:
foo(x: str) -> int
foo doesn't do much
This is a nice help menu. I want to parse and search it for arbitrary help()
queries. Find pydoc.render_doc
for this purpose. Find the output is not nice.
>>> pydoc.render_doc(foo)
"Python Library Documentation: function foo in module __main__\n\nf\x08fo\x08oo\x08o(x: str) -> int\n foo doesn't do much\n"
See those byte chars or something? How do I parse this? How can I search it? Even the fn name looks obfuscated?