ast_path_set.py: You need to address the TODOs in this file.
is_empty method, which returns true if the path list is empty
add_path method. This method should construct a new AstPath object using the
provided
source node, target node,
and path string, then add it to the path list.
common.py
MethodContents: You don't need to modify this class definition.function_visitor.py: You need to address the TODOs in this file.
MethodContents object.
visit method. Ensure that the visitMethod is invoked
whenever a node with the method_declaration type is encountered. This will
process the method node and collect the relevant data.
path_extractor.py
extract_single_method_paths(self, method: MethodContents) -> AstPathSet: You need to address the TODOs in this method.
extract_path method you implemented in Phase 2.
Append the extracted paths to the list and return the list.
extract_methods_paths(self, methods: List[MethodContents]) -> List[AstPathSet]: You need to address the TODOs in this method.
It extracts all the paths given a list of MethodContents.
__parse_file(self, code): You don't need to modify this method. It returns the root node of the AST parsed from the given code snippet.
extract_paths(self, code: str) -> List[AstPathSet]: You don't need to modify this method.
It extract all paths of all methods in the given code snippet.
tests/test_phase3.py
test_function_visitor(): It tests the functionality of the FunctionVisitor you implemented.
test_single_method_extraction(): It tests the functionality of the extract_single_method_paths you implemented.
test_all_methods_all_paths_extraction(): It tests the functionality of the extract_methods_paths you implemented.
tests/test_phase3.py file. To run the test cases provided under the tests folder.
pytest tests/test_phase3.py