Skip to content

Commit b6ecb3b

Browse files
authored
Merge pull request #121 from ArcanaFramework/parent-bugfix
fixed up parent property for files with side-car/headers
2 parents aac78a0 + ba43915 commit b6ecb3b

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

fileformats/core/fileset.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ def parent(self) -> Path:
261261
"A common parent directory for all the top-level paths in the file-set"
262262
return Path(os.path.commonpath([p.parent for p in self.fspaths]))
263263

264+
@property
265+
def parents(self) -> ty.Sequence[Path]:
266+
return [self.parent] + list(self.parent.parents)
267+
264268
@property
265269
def relative_fspaths(self) -> ty.Iterator[Path]:
266270
"Paths for all top-level paths in the file-set relative to the common parent directory"

fileformats/generic/fsobject.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,6 @@ def owner(self) -> ty.Optional[str]:
8181
return None
8282
return self.fspath.owner()
8383

84-
@property
85-
def parent(self) -> Path:
86-
return self.fspath.parent
87-
88-
@property
89-
def parents(self) -> ty.Sequence[Path]:
90-
return self.fspath.parents
91-
9284
@property
9385
def parts(self) -> ty.Tuple[str, ...]:
9486
return self.fspath.parts

0 commit comments

Comments
 (0)