pelicun.tests.maintenance.search_in_functions
Code inspection methods/functions.
Functions
|
Finds functions in a Python file that contain a specific string in their body. |
|
Visit a function definition node and check if it contains the search string. |
- pelicun.tests.maintenance.search_in_functions.find_functions_with_string(filename: str, search_string: str) list[str] [source]
Finds functions in a Python file that contain a specific string in their body.
- Parameters:
- filename: str
The path to the Python file to be searched.
- search_string: str
The string to search for within the function bodies.
- Returns:
- list[str]
A list of function names that contain the search string in their bodies.
- pelicun.tests.maintenance.search_in_functions.visit_FunctionDef(node: FunctionDef, filename: str, search_string: str, functions_with_string: list[str]) None [source]
Visit a function definition node and check if it contains the search string.
- Parameters:
- node: ast.FunctionDef
The AST node representing the function definition.
- filename: str
The path to the Python file to be searched.
- search_string: str
The string to search for within the function bodies.
- functions_with_string: list[str]
The list to append function names that contain the search string.