Skip to content

Commit 5c452b0

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

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
@@ -2854,7 +2854,7 @@ def get_path_segments_with_subpath(self):
28542854

28552855
return part_and_subpath
28562856

2857-
def parent_path(self):
2857+
def parent_directory(self):
28582858
"""Return the parent path for this CodebaseResource or None."""
28592859
return parent_directory(self.path, with_trail=False)
28602860

@@ -2863,7 +2863,7 @@ def has_parent(self):
28632863
Return True if this CodebaseResource has a parent CodebaseResource or
28642864
False otherwise.
28652865
"""
2866-
parent_path = self.parent_path()
2866+
parent_path = self.parent_directory()
28672867
if not parent_path:
28682868
return False
28692869
if self.project.codebaseresources.filter(path=parent_path).exists():
@@ -2878,7 +2878,7 @@ def parent(self, codebase=None):
28782878
`codebase` is not used in this context but required for compatibility
28792879
with the commoncode.resource.Codebase class API.
28802880
"""
2881-
parent_path = self.parent_path()
2881+
parent_path = self.parent_directory()
28822882
return parent_path and self.project.codebaseresources.get(path=parent_path)
28832883

28842884
def siblings(self, codebase=None):

scanpipe/tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2059,7 +2059,7 @@ def test_scanpipe_codebase_resource_model_walk_method(self):
20592059
path="asgiref-3.3.0.whl-extract/asgiref/compatibility.py"
20602060
)
20612061
expected_parent_path = "asgiref-3.3.0.whl-extract/asgiref"
2062-
self.assertEqual(expected_parent_path, asgiref_resource.parent_path())
2062+
self.assertEqual(expected_parent_path, asgiref_resource.parent_directory())
20632063
self.assertTrue(asgiref_resource.has_parent())
20642064
expected_parent = self.project_asgiref.codebaseresources.get(
20652065
path="asgiref-3.3.0.whl-extract/asgiref"

0 commit comments

Comments
 (0)