From 2cb5167cb9ecef9f90583f7015ffd400d7703166 Mon Sep 17 00:00:00 2001 From: liamhuber Date: Wed, 17 Jan 2024 16:36:08 -0800 Subject: [PATCH] No magic strings --- pyiron_workflow/node.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pyiron_workflow/node.py b/pyiron_workflow/node.py index fbb5b8ad..12ec4516 100644 --- a/pyiron_workflow/node.py +++ b/pyiron_workflow/node.py @@ -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, @@ -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() @@ -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)