Skip to content

Commit

Permalink
Remove 'all' default for datatype for make_sub_folders and change to …
Browse files Browse the repository at this point in the history
…'' which will make no datatype by default.
  • Loading branch information
JoeZiminski committed Oct 20, 2023
1 parent a451f36 commit 19cf7a6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion datashuttle/command_line_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def construct_parser():
type=str,
nargs="+",
required=False,
default="all", # TODO: this is not nice, should read the default from API NOT duplicate in CLI
default="", # TODO: this is not nice, should read the default from API NOT duplicate in CLI
help=help("required_str_single_or_multiple_or_all"),
)

Expand Down
5 changes: 3 additions & 2 deletions datashuttle/datashuttle.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def make_folders(
self,
sub_names: Union[str, list],
ses_names: Optional[Union[str, list]] = None,
datatype: Union[List[str], str] = "all",
datatype: str = "",
) -> None:
"""
Create a subject / session folder tree in the project
Expand All @@ -182,7 +182,8 @@ def make_folders(
The datatype to make in the sub / ses folders.
(e.g. "ephys", "behav", "histology"). If "all"
is selected, all datatypes permitted in
NeuroBlueprint will be created.
NeuroBlueprint will be created. If "" is passed
no datatype will be created.
Notes
-----
Expand Down
7 changes: 5 additions & 2 deletions tests/tests_integration/test_filesystem_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,8 @@ def test_rclone_overwrite_modified_file(
Path("rawdata") / "sub-001" / "histology" / "test_file.txt"
)

project.make_folders("sub-001")
project.make_folders("sub-001", datatype="histology")

local_test_file_path = project.cfg["local_path"] / path_to_test_file
central_test_file_path = (
project.cfg["central_path"] / path_to_test_file
Expand Down Expand Up @@ -554,7 +555,9 @@ def test_specific_file_or_folder(

def setup_specific_file_or_folder_files(self, project):
""" """
project.make_folders(["sub-001", "sub-002"], "ses-003")
project.make_folders(
["sub-001", "sub-002"], "ses-003", ["behav", "ephys"]
)

path_to_test_file_behav = (
Path("rawdata")
Expand Down
8 changes: 5 additions & 3 deletions tests/tests_integration/test_make_folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ def test_explicitly_session_list(self, project):
"""
subs = ["sub-001", "sub-002"]
sessions = ["ses-001", "50432"]
project.make_folders(subs, sessions)

project.make_folders(subs, sessions, "all")
base_folder = test_utils.get_top_level_folder_path(project)

for sub in subs:
Expand Down Expand Up @@ -224,7 +225,8 @@ def test_custom_folder_names(self, project):
# Make the folders
sub = "sub-001"
ses = "ses-001"
project.make_folders(sub, ses)

project.make_folders(sub, ses, "all")

# Check the folders were not made / made.
base_folder = test_utils.get_top_level_folder_path(project)
Expand Down Expand Up @@ -359,7 +361,7 @@ def test_all_top_level_folders(self, project, folder_name):
subs = ["sub-001", "sub-2"]
sessions = ["ses-001", "ses-03"]

project.make_folders(subs, sessions)
project.make_folders(subs, sessions, "all")

# Check folder tree is made in the desired top level folder
test_utils.check_working_top_level_folder_only_exists(
Expand Down

0 comments on commit 19cf7a6

Please sign in to comment.