Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def find_method(module,searchstr,print_doc=True):
- """
- Returns a list of methods inside 'module' which contain 'searchstr' in their docstring
- Input: Module name and and string to search for, optionally prints the help for the methods (default=True)
- Output: List of methods
- """
- methods = []
- for submod_name in dir(module):
- submod = module.__getattribute__(submod_name)
- if submod.__doc__ and searchstr in submod.__doc__:
- methods += [submod]
- # print output
- if print_doc:
- print "%d methods founds. Show their help? [Y/n]"%(len(methods))
- inp = raw_input()
- if not inp or inp.lower() == "y":
- for method in methods:
- help(method)
- return methods
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement