Skip to content

Commit

Permalink
No magic strings
Browse files Browse the repository at this point in the history
  • Loading branch information
liamhuber committed Jan 18, 2024
1 parent 2c5fbe5 commit 2cb5167
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pyiron_workflow/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ class Node(HasToDict, ABC, metaclass=AbstractHasPost):

package_identifier = None

_STORAGE_FILE_NAME = "project.h5"
# This isn't nice, just a technical necessity in the current implementation
# Eventually, of course, this needs to be _at least_ file-format independent

def __init__(
self,
label: str,
Expand Down Expand Up @@ -267,11 +271,10 @@ def __post__(
run_after_init: bool = False,
**kwargs,
):
hardcoded_tinybase_filename = "project.h5"
save_exists = self.working_directory.file_exists(hardcoded_tinybase_filename)
save_exists = self.working_directory.file_exists(self._STORAGE_FILE_NAME)

if save_exists and overwrite_save:
self.working_directory.remove_files(hardcoded_tinybase_filename)
self.working_directory.remove_files(self._STORAGE_FILE_NAME)

if self.working_directory.is_empty():
self.working_directory.delete()
Expand Down Expand Up @@ -1102,5 +1105,7 @@ def storage(self):
from pyiron_contrib.tinybase.storage import H5ioStorage
from h5io_browser import Pointer

storage_file = str((self.working_directory.path / "project.h5").resolve()) # self.label
storage_file = str(
(self.working_directory.path / self._STORAGE_FILE_NAME).resolve()
)
return H5ioStorage(Pointer(storage_file), None)

0 comments on commit 2cb5167

Please sign in to comment.