From cf8e8674c4a12856fccccdc04923c46beee667b9 Mon Sep 17 00:00:00 2001 From: Cor Zuurmond Date: Thu, 6 Feb 2025 16:07:03 +0100 Subject: [PATCH] Remove redundant if-condition in graph walker iter one --- .../ucx/source_code/linters/graph_walkers.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/databricks/labs/ucx/source_code/linters/graph_walkers.py b/src/databricks/labs/ucx/source_code/linters/graph_walkers.py index c3e61b6cba..b068a93b0c 100644 --- a/src/databricks/labs/ucx/source_code/linters/graph_walkers.py +++ b/src/databricks/labs/ucx/source_code/linters/graph_walkers.py @@ -56,16 +56,15 @@ def _iter_one(self, dependency: Dependency, graph: DependencyGraph, root_path: P self._lineage.append(dependency) self._walked_paths.add(dependency.path) self._log_walk_one(dependency) - if dependency.path.is_file() or is_a_notebook(dependency.path): - inherited_tree = graph.root.build_inherited_tree(root_path, dependency.path) - path_lookup = self._path_lookup.change_directory(dependency.path.parent) - yield from self._process_dependency(dependency, path_lookup, inherited_tree) - maybe_graph = graph.locate_dependency(dependency.path) - # missing graph problems have already been reported while building the graph - if maybe_graph.graph: - child_graph = maybe_graph.graph - for child_dependency in child_graph.local_dependencies: - yield from self._iter_one(child_dependency, child_graph, root_path) + inherited_tree = graph.root.build_inherited_tree(root_path, dependency.path) + path_lookup = self._path_lookup.change_directory(dependency.path.parent) + yield from self._process_dependency(dependency, path_lookup, inherited_tree) + maybe_graph = graph.locate_dependency(dependency.path) + # missing graph problems have already been reported while building the graph + if maybe_graph.graph: + child_graph = maybe_graph.graph + for child_dependency in child_graph.local_dependencies: + yield from self._iter_one(child_dependency, child_graph, root_path) self._lineage.pop() def _log_walk_one(self, dependency: Dependency) -> None: