We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6ad70df commit c8df4e3Copy full SHA for c8df4e3
src/commoncode/resource.py
@@ -1352,11 +1352,18 @@ def has_parent(self):
1352
"""
1353
return not self.is_root
1354
1355
+ def parent_path(self):
1356
+ """
1357
+ Return the parent Resource object for this Resource or None.
1358
1359
+ return self.has_parent() and parent_directory(self.path, with_trail=False)
1360
+
1361
def parent(self, codebase):
1362
1363
Return the parent Resource object for this Resource or None.
1364
- return codebase.get_resource(parent_directory(self.path, with_trail=False))
1365
+ parent_path = self.parent_path()
1366
+ return parent_path and codebase.get_resource(parent_path)
1367
1368
def has_siblings(self, codebase):
1369
0 commit comments