Skip to content

Rename the parent_path function to parent_directory #1691 #1694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scanpipe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2849,7 +2849,7 @@ def get_path_segments_with_subpath(self):

return part_and_subpath

def parent_path(self):
def parent_directory(self):
"""Return the parent path for this CodebaseResource or None."""
return parent_directory(self.path, with_trail=False)

Expand All @@ -2858,7 +2858,7 @@ def has_parent(self):
Return True if this CodebaseResource has a parent CodebaseResource or
False otherwise.
"""
parent_path = self.parent_path()
parent_path = self.parent_directory()
if not parent_path:
return False
if self.project.codebaseresources.filter(path=parent_path).exists():
Expand All @@ -2873,7 +2873,7 @@ def parent(self, codebase=None):
`codebase` is not used in this context but required for compatibility
with the commoncode.resource.Codebase class API.
"""
parent_path = self.parent_path()
parent_path = self.parent_directory()
return parent_path and self.project.codebaseresources.get(path=parent_path)

def siblings(self, codebase=None):
Expand Down
2 changes: 1 addition & 1 deletion scanpipe/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2053,7 +2053,7 @@ def test_scanpipe_codebase_resource_model_walk_method(self):
path="asgiref-3.3.0.whl-extract/asgiref/compatibility.py"
)
expected_parent_path = "asgiref-3.3.0.whl-extract/asgiref"
self.assertEqual(expected_parent_path, asgiref_resource.parent_path())
self.assertEqual(expected_parent_path, asgiref_resource.parent_directory())
self.assertTrue(asgiref_resource.has_parent())
expected_parent = self.project_asgiref.codebaseresources.get(
path="asgiref-3.3.0.whl-extract/asgiref"
Expand Down