Skip to content

Commit

Permalink
Revert changes to PortableCode constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
GeigerJ2 committed Oct 2, 2024
1 parent 17073b7 commit 5e08600
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions src/aiida/orm/nodes/data/code/portable.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ def __init__(self, filepath_executable: str, filepath_files: pathlib.Path | str,
super().__init__(**kwargs)
type_check(filepath_files, pathlib.Path)
self.filepath_executable = filepath_executable # type: ignore[assignment]
# self.base.repository.put_object_from_tree(str(filepath_files))
self.filepath_files = filepath_files
self.base.repository.put_object_from_tree(str(filepath_files))

def _validate(self):
"""Validate the instance by checking that an executable is defined and it is part of the repository files.
Expand Down Expand Up @@ -178,29 +177,3 @@ def filepath_executable(self, value: str) -> None:
raise ValueError('The `filepath_executable` should not be absolute.')

self.base.attributes.set(self._KEY_ATTRIBUTE_FILEPATH_EXECUTABLE, value)

@property
def filepath_files(self) -> str | pathlib.Path:
"""Return the absolute path of the directory that contains the code files.
:return: The directory of the code files required for the `filepath_executable`.
"""
return self._filepath_files

@filepath_files.setter
def filepath_files(self, value: t.Union[str, pathlib.Path]) -> None:
"""Set the absolute path of the directory that contains the code files.
:param value: The absolute filepath of the directory of the uploaded code files.
"""
type_check(value, (str, pathlib.Path))

if not pathlib.PurePosixPath(value).is_absolute():
raise ValueError('`filepath_files` must be an absolute path.')

if not pathlib.Path(value).is_dir():
raise ValueError('`filepath_files` must be an existing directory.')

self.base.repository.erase()
self.base.repository.put_object_from_tree(str(value))
self._filepath_files = value

0 comments on commit 5e08600

Please sign in to comment.