ctfsolver.find_usage.manager_gathering¶
Attributes¶
Classes¶
ManagerFunction provides utility methods for introspecting and managing functions within a class and Python source files. |
Module Contents¶
- class ManagerGathering(*args, **kwargs)[source]¶
Bases:
ctfsolver.managers.manager_functions.ManagerFunction,ctfsolver.managers.manager_folder.ManagerFolderManagerFunction provides utility methods for introspecting and managing functions within a class and Python source files.
- This class includes methods to:
List all callable functions defined in the class.
Retrieve references to function usages in a given file.
Extract function definitions from Python files using the AST module.
- get_self_functions()[source]¶
Lists all callable functions of the class instance, excluding special methods.
- get_function_reference(function, file)[source]¶
Finds and returns all lines in the specified file where the given function name appears.
- Parameters:
- Returns:
Lines from the file containing the function name.
- Return type:
- Raises:
ValueError – If the function is not found in the class.
- get_functions_from_file(file_path, function_name=None)[source]¶
Parses the given Python file and returns function definitions using AST.
- Parameters:
file_path (Path) – Path to the Python file.
function_name (str, optional) – Specific function name to search for.
- Returns:
List of function definitions, a single function definition, or None.
- Return type:
list[ast.FunctionDef] | ast.FunctionDef | None
- find_function_from_file(file_path, function_name)[source]¶
Deprecated. Use get_functions_from_file instead.
- initializing_all_ancestors(*args, **kwargs)[source]¶
- Description:
Initializes all the ancestors of the class