From edeb4d25bd27c484e924d54587d62c26ffd353a8 Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Tue, 5 Nov 2024 11:53:29 +0000 Subject: [PATCH] Remove walkers subpackage Following the refactor of the old walkers into functions using the new walk() and visit() functionality, there is no longer a need to maintain the walkers/ subpackage. Signed-off-by: John Pennycook --- codebasin/walkers/__init__.py | 2 -- codebasin/walkers/tree_mapper.py | 35 -------------------------------- codebasin/walkers/tree_walker.py | 16 --------------- 3 files changed, 53 deletions(-) delete mode 100644 codebasin/walkers/__init__.py delete mode 100644 codebasin/walkers/tree_mapper.py delete mode 100644 codebasin/walkers/tree_walker.py diff --git a/codebasin/walkers/__init__.py b/codebasin/walkers/__init__.py deleted file mode 100644 index 93af6d4..0000000 --- a/codebasin/walkers/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# Copyright (C) 2019 Intel Corporation -# SPDX-License-Identifier: BSD-3-Clause diff --git a/codebasin/walkers/tree_mapper.py b/codebasin/walkers/tree_mapper.py deleted file mode 100644 index 77a44de..0000000 --- a/codebasin/walkers/tree_mapper.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) 2019-2024 Intel Corporation -# SPDX-License-Identifier: BSD-3-Clause - -import collections -import logging - -from codebasin.walkers.tree_walker import TreeWalker - -log = logging.getLogger("codebasin") - - -class TreeMapper(TreeWalker): - """ - Used to build a dictionary of associations, along with how many - lines of code each is associated with. - """ - - def __init__(self, _tree, _node_associations): - super().__init__(_tree, _node_associations) - self.line_map = collections.defaultdict(int) - - def walk(self, state): - """ - Generic tree mapping method. Returns the constructed map. - """ - if not self.line_map: - for fn in state.get_filenames(): - self._map_node(state.get_tree(fn).root, state.get_map(fn)) - return self.line_map - - def _map_node(self, node, _map): - """ - Map a specific node, and descend into the children nodes. - """ - # pass diff --git a/codebasin/walkers/tree_walker.py b/codebasin/walkers/tree_walker.py deleted file mode 100644 index 9ef46ed..0000000 --- a/codebasin/walkers/tree_walker.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2019-2024 Intel Corporation -# SPDX-License-Identifier: BSD-3-Clause - -import logging - -log = logging.getLogger("codebasin") - - -class TreeWalker: - """ - Generic tree walker class. - """ - - def __init__(self, _tree, _node_associations): - self.tree = _tree - self._node_associations = _node_associations