Skip to content

Commit e52ddfb

Browse files
authored
Rename the parent_path function to parent_directory #1691 (#1694)
In preparation of adding parent_path as a field #1691 Signed-off-by: tdruez <tdruez@nexb.com>
1 parent d076340 commit e52ddfb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

scanpipe/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,7 +2849,7 @@ def get_path_segments_with_subpath(self):
28492849

28502850
return part_and_subpath
28512851

2852-
def parent_path(self):
2852+
def parent_directory(self):
28532853
"""Return the parent path for this CodebaseResource or None."""
28542854
return parent_directory(self.path, with_trail=False)
28552855

@@ -2858,7 +2858,7 @@ def has_parent(self):
28582858
Return True if this CodebaseResource has a parent CodebaseResource or
28592859
False otherwise.
28602860
"""
2861-
parent_path = self.parent_path()
2861+
parent_path = self.parent_directory()
28622862
if not parent_path:
28632863
return False
28642864
if self.project.codebaseresources.filter(path=parent_path).exists():
@@ -2873,7 +2873,7 @@ def parent(self, codebase=None):
28732873
`codebase` is not used in this context but required for compatibility
28742874
with the commoncode.resource.Codebase class API.
28752875
"""
2876-
parent_path = self.parent_path()
2876+
parent_path = self.parent_directory()
28772877
return parent_path and self.project.codebaseresources.get(path=parent_path)
28782878

28792879
def siblings(self, codebase=None):

scanpipe/tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2053,7 +2053,7 @@ def test_scanpipe_codebase_resource_model_walk_method(self):
20532053
path="asgiref-3.3.0.whl-extract/asgiref/compatibility.py"
20542054
)
20552055
expected_parent_path = "asgiref-3.3.0.whl-extract/asgiref"
2056-
self.assertEqual(expected_parent_path, asgiref_resource.parent_path())
2056+
self.assertEqual(expected_parent_path, asgiref_resource.parent_directory())
20572057
self.assertTrue(asgiref_resource.has_parent())
20582058
expected_parent = self.project_asgiref.codebaseresources.get(
20592059
path="asgiref-3.3.0.whl-extract/asgiref"

0 commit comments

Comments
 (0)