Skip to content

Commit b8048a1

Browse files
authored
Refactor object_ attribute assignment
1 parent 2fdad8d commit b8048a1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/foamlib/_files/files.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,7 @@ def _write_header_if_needed(self, keywords: tuple[str, ...]) -> None:
522522
self.format = "ascii"
523523
self.class_ = "dictionary"
524524
self.location = f'"{self.path.parent.name}"'
525-
self.object_ = (
526-
self.path.stem if self.path.suffix == ".gz" else self.path.name
527-
)
525+
self.object_ = self.path.name.removesuffix(".gz")
528526

529527
@overload
530528
def _update_class_for_field_if_needed(

0 commit comments

Comments
 (0)