Skip to content

Commit 08bc95a

Browse files
author
Andrei Neagu
committed
rename
1 parent ff2cd1b commit 08bc95a

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

services/storage/src/simcore_service_storage/simcore_s3_dsm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
compute_file_id_prefix,
8787
create_and_upload_export,
8888
create_random_export_name,
89-
ensure_same_parent_in_user_selection,
89+
ensure_user_selection_from_same_base_directory,
9090
expand_directory,
9191
get_accessible_project_ids,
9292
get_directory_file_id,
@@ -1255,7 +1255,7 @@ async def create_s3_export(
12551255
source_object_keys: set[tuple[UserSelectionStr, StorageFileID]] = set()
12561256

12571257
# ensure all selected items have the same parent
1258-
if not ensure_same_parent_in_user_selection(object_keys):
1258+
if not ensure_user_selection_from_same_base_directory(object_keys):
12591259
raise SelectionNotAllowedError(selection=object_keys)
12601260

12611261
# check access rights

services/storage/src/simcore_service_storage/utils/simcore_s3_dsm_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ def create_random_export_name(user_id: UserID) -> StorageFileID:
145145
)
146146

147147

148-
def ensure_same_parent_in_user_selection(object_keys: list[S3ObjectKey]) -> bool:
148+
def ensure_user_selection_from_same_base_directory(
149+
object_keys: list[S3ObjectKey],
150+
) -> bool:
149151
parents = [Path(x).parent for x in object_keys]
150152
return len(set(parents)) <= 1
151153

services/storage/tests/unit/test_simcore_s3_dsm_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
UserSelectionStr,
77
_base_path_parent,
88
compute_file_id_prefix,
9-
ensure_same_parent_in_user_selection,
9+
ensure_user_selection_from_same_base_directory,
1010
)
1111

1212

@@ -66,10 +66,10 @@ def test__base_path_parent(selection: Path | str, s3_object: Path, expected: str
6666
(["a/a.txt", "a.txt", "c.txt", "a/d.txt"], False),
6767
],
6868
)
69-
def test_ensure_same_parent_in_user_selection(
69+
def test_ensure_user_selection_from_same_base_directory(
7070
user_selection: list[S3ObjectKey | Path], expected: bool
7171
):
7272
assert (
73-
ensure_same_parent_in_user_selection([f"{x}" for x in user_selection])
73+
ensure_user_selection_from_same_base_directory([f"{x}" for x in user_selection])
7474
== expected
7575
)

0 commit comments

Comments
 (0)