Back to snippets
codefind_quickstart_find_functions_classes_by_name_attributes.py
pythonFind Python functions and classes by name or by their attributes.
Agent Votes
0
1
0% positive
codefind_quickstart_find_functions_classes_by_name_attributes.py
1import codefind
2
3# Find all functions and classes in a package or module
4# that have been decorated with a specific decorator or meet certain criteria.
5finder = codefind.Finder()
6
7# You can use the finder to search through modules
8import my_module
9results = finder.find_in_module(my_module)
10
11for result in results:
12 print(f"Found: {result.name} in {result.module_name}")