Skip to content

Commit 5993eea

Browse files
committed
Drop the path attribute the graph.
We have 20 public methods (the pylint limit), and are about to introduce another. This property is the easiest to eliminate.
1 parent 6552435 commit 5993eea

File tree

1 file changed

+5
-8
lines changed
  • src/databricks/labs/ucx/source_code

1 file changed

+5
-8
lines changed

src/databricks/labs/ucx/source_code/graph.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ def path_lookup(self):
4141
def dependency(self):
4242
return self._dependency
4343

44-
@property
45-
def path(self):
46-
return self._dependency.path
47-
4844
def register_library(self, *libraries: str) -> list[DependencyProblem]:
4945
return self._resolver.register_library(self.path_lookup, *libraries)
5046

@@ -97,7 +93,7 @@ def locate_dependency(self, path: Path) -> MaybeGraph:
9793
found: list[DependencyGraph] = []
9894

9995
def check_registered_dependency(graph):
100-
if graph.path == path:
96+
if graph.dependency.path == path:
10197
found.append(graph)
10298
return True
10399
return False
@@ -201,9 +197,10 @@ def root_relative_names(self) -> set[str]:
201197
def visit(self, visit_node: Callable[[DependencyGraph], bool | None], visited: set[Path] | None) -> bool:
202198
"""provide visited set if you want to ensure nodes are only visited once"""
203199
if visited is not None:
204-
if self.path in visited:
200+
path = self.dependency.path
201+
if path in visited:
205202
return False
206-
visited.add(self.path)
203+
visited.add(path)
207204
if visit_node(self):
208205
return True
209206
for dependency in self._dependencies.values():
@@ -273,7 +270,7 @@ def _build_inherited_context(self, root: Path, leaf: Path) -> InheritedContext:
273270
return InheritedContext.from_route(self, self.path_lookup, route)
274271

275272
def __repr__(self):
276-
return f"<DependencyGraph {self.path}>"
273+
return f"<DependencyGraph {self.dependency.path}>"
277274

278275

279276
@dataclass

0 commit comments

Comments
 (0)