Im trying to get all the function names, with their arguments, and return's of a python file, using python script.
Tried to use AST library with FunctionDef class but couldn't able to extract the information I'm looking for.
Thanks.
Im trying to get all the function names, with their arguments, and return's of a python file, using python script.
Tried to use AST library with FunctionDef class but couldn't able to extract the information I'm looking for.
Thanks.
This answer recommends the inspect
module for getting a list of functions; it can be used (but isn't required) for accessing function parameter names. To the best of my knowledge, Python's design doesn't really allow getting this information about a function's return values; so you might have to annotate those yourself, be it with a docstring, custom attribute, type hint, etc.