Skip to content

Commit

Permalink
Remove old files and rename files with correct extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
mpvanderschelling committed Jun 26, 2024
1 parent 1eaae8b commit 0678959
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/f3dasm/_src/design/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ def store(self, filename: Path) -> None:
with open(filename.with_suffix('.tmp'), 'wb') as f:
pickle.dump(self, f)

# remove old file if it exists
filename.with_suffix('.pkl').unlink(missing_ok=True)

# rename the file to the correct extension
filename.with_suffix('.tmp').rename(filename.with_suffix('.pkl'))

Expand Down
3 changes: 3 additions & 0 deletions src/f3dasm/_src/experimentdata/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ def store(self, filename: Path) -> None:
# TODO: The column information is not saved in the .csv!
self.to_dataframe().to_csv(filename.with_suffix('.tmp'))

# remove the old file if it exists
filename.with_suffix('.csv').unlink(missing_ok=True)

# rename the file to the correct extension
filename.with_suffix('.tmp').rename(filename.with_suffix('.csv'))

Expand Down
3 changes: 3 additions & 0 deletions src/f3dasm/_src/experimentdata/_jobqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ def store(self, filename: Path) -> None:
"""
self.jobs.to_pickle(filename.with_suffix('.tmp'))

# remove old file if it exists
filename.with_suffix('.pkl').unlink(missing_ok=True)

# rename the file to the correct extension
filename.with_suffix('.tmp').rename(filename.with_suffix('.pkl'))

Expand Down

0 comments on commit 0678959

Please sign in to comment.