Skip to content

Commit 91e4ad5

Browse files
Update RemoteStashData and subclasses
Notes: - all submodels share the same fields. Consider lifting up to base class. Ping @khsrali
1 parent 8c8e7b0 commit 91e4ad5

4 files changed

Lines changed: 33 additions & 16 deletions

File tree

src/aiida/orm/nodes/data/remote/stash/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class RemoteStashData(Data):
3737
_storable = False
3838

3939
class Model(Data.Model):
40-
stash_mode: StashMode = MetadataField(description='The mode with which the data was stashed')
40+
stash_mode: StashMode = MetadataField(
41+
description='The mode with which the data was stashed',
42+
)
4143

4244
def __init__(self, stash_mode: StashMode, **kwargs):
4345
"""Construct a new instance

src/aiida/orm/nodes/data/remote/stash/compress.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class RemoteStashCompressedData(RemoteStashData):
2626

2727
class Model(RemoteStashData.Model):
2828
target_basepath: str = MetadataField(
29-
description='The the target basepath',
29+
description='The target basepath',
3030
)
3131
source_list: List[str] = MetadataField(
3232
description='The list of source files that were stashed',
@@ -39,7 +39,7 @@ def __init__(
3939
self,
4040
stash_mode: StashMode,
4141
target_basepath: str,
42-
source_list: List,
42+
source_list: List[str],
4343
dereference: bool,
4444
**kwargs,
4545
):

src/aiida/orm/nodes/data/remote/stash/custom.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,32 @@ class RemoteStashCustomData(RemoteStashData):
2525
_storable = True
2626

2727
class Model(RemoteStashData.Model):
28-
target_basepath: str = MetadataField(description='The the target basepath')
29-
source_list: List[str] = MetadataField(description='The list of source files that were stashed')
28+
target_basepath: str = MetadataField(
29+
description='The target basepath',
30+
)
31+
source_list: List[str] = MetadataField(
32+
description='The list of source files that were stashed',
33+
)
3034

3135
def __init__(
3236
self,
3337
stash_mode: StashMode,
3438
target_basepath: str,
35-
source_list: List,
39+
source_list: List[str],
3640
**kwargs,
3741
):
3842
"""Construct a new instance
3943
4044
:param stash_mode: the stashing mode with which the data was stashed on the remote.
4145
"""
46+
if stash_mode != StashMode.SUBMIT_CUSTOM_CODE:
47+
raise ValueError('`RemoteStashCustomData` can only be used with `stash_mode == StashMode.COPY`.')
48+
4249
super().__init__(stash_mode, **kwargs)
4350

4451
self.target_basepath = target_basepath
4552
self.source_list = source_list
4653

47-
if stash_mode != StashMode.SUBMIT_CUSTOM_CODE:
48-
raise ValueError('`RemoteStashCustomData` can only be used with `stash_mode == StashMode.COPY`.')
49-
5054
@property
5155
def target_basepath(self) -> str:
5256
"""Return the target basepath.

src/aiida/orm/nodes/data/remote/stash/folder.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,34 @@ class RemoteStashFolderData(RemoteStashData):
2828
_storable = True
2929

3030
class Model(RemoteStashData.Model):
31-
target_basepath: str = MetadataField(description='The the target basepath')
32-
source_list: List[str] = MetadataField(description='The list of source files that were stashed')
33-
34-
def __init__(self, stash_mode: StashMode, target_basepath: str, source_list: List, **kwargs):
31+
target_basepath: str = MetadataField(
32+
description='The target basepath',
33+
)
34+
source_list: List[str] = MetadataField(
35+
description='The list of source files that were stashed',
36+
)
37+
38+
def __init__(
39+
self,
40+
stash_mode: StashMode,
41+
target_basepath: str,
42+
source_list: List,
43+
**kwargs,
44+
):
3545
"""Construct a new instance
3646
3747
:param stash_mode: the stashing mode with which the data was stashed on the remote.
3848
:param target_basepath: the target basepath.
3949
:param source_list: the list of source files.
4050
"""
51+
if stash_mode != StashMode.COPY:
52+
raise ValueError('`RemoteStashFolderData` can only be used with `stash_mode == StashMode.COPY`.')
53+
4154
super().__init__(stash_mode, **kwargs)
55+
4256
self.target_basepath = target_basepath
4357
self.source_list = source_list
4458

45-
if stash_mode != StashMode.COPY:
46-
raise ValueError('`RemoteStashFolderData` can only be used with `stash_mode == StashMode.COPY`.')
47-
4859
@property
4960
def target_basepath(self) -> str:
5061
"""Return the target basepath.

0 commit comments

Comments
 (0)