Skip to content

Commit af80bf3

Browse files
committed
Grouped all skippable keys under a single 'if' block
1 parent aba0618 commit af80bf3

File tree

1 file changed

+28
-33
lines changed

1 file changed

+28
-33
lines changed

src/murfey/cli/create_config.py

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,17 +1101,10 @@ def set_up_machine_config(debug: bool = False):
11011101
new_config[key] = add_calibrations(key, field, debug)
11021102
continue
11031103

1104-
# Acquisition software block
1104+
# Acquisition software section
11051105
if key == "acquisition_software":
11061106
new_config = add_software_packages(new_config, debug)
11071107
continue
1108-
if key in (
1109-
"software_versions",
1110-
"software_settings_output_directories",
1111-
"data_required_substrings",
1112-
):
1113-
continue
1114-
# End of software block
11151108

11161109
if key == "data_directories":
11171110
new_config[key] = add_data_directories(key, field, debug)
@@ -1123,27 +1116,43 @@ def set_up_machine_config(debug: bool = False):
11231116
new_config[key] = add_analyse_created_directories(key, field, debug)
11241117
continue
11251118

1126-
# Data transfer block
1119+
# Data transfer section
11271120
if key == "data_transfer_enabled":
11281121
new_config = set_up_data_transfer(new_config, debug)
11291122
continue
1123+
1124+
# Data processing section
1125+
if key == "processing_enabled":
1126+
new_config = set_up_data_processing(new_config, debug)
1127+
continue
1128+
1129+
# External plugins and executables section
1130+
if key in ("external_executables", "external_executables_eer"):
1131+
new_config[key] = add_external_executables(key, field, debug)
1132+
continue
1133+
if key == "external_environment":
1134+
new_config[key] = add_external_environment(key, field, debug)
1135+
continue
1136+
1137+
if key == "plugin_packages":
1138+
new_config[key] = add_murfey_plugins(key, field, debug)
1139+
continue
1140+
1141+
# All the keys that can be skipped
11301142
if key in (
1143+
# Acquisition software section
1144+
"software_versions",
1145+
"software_settings_output_directories",
1146+
"data_required_substrings",
1147+
# Data transfer section
11311148
"allow_removal",
11321149
"rsync_basepath",
11331150
"rsync_module",
11341151
"rsync_url",
11351152
"upstream_data_directories",
11361153
"upstream_data_download_directory",
11371154
"upstream_data_tiff_locations",
1138-
):
1139-
continue
1140-
# End of data transfer block
1141-
1142-
# Data processing block
1143-
if key == "processing_enabled":
1144-
new_config = set_up_data_processing(new_config, debug)
1145-
continue
1146-
if key in (
1155+
# Data processing section
11471156
"process_by_default",
11481157
"gain_directory_name",
11491158
"processed_directory_name",
@@ -1155,27 +1164,13 @@ def set_up_machine_config(debug: bool = False):
11551164
"initial_model_search_directory",
11561165
):
11571166
continue
1158-
# End of data processing block
1159-
1160-
# External plugins and executables block
1161-
if key in ("external_executables", "external_executables_eer"):
1162-
new_config[key] = add_external_executables(key, field, debug)
1163-
continue
1164-
if key == "external_environment":
1165-
new_config[key] = add_external_environment(key, field, debug)
1166-
continue
1167-
# End of external executables block
1168-
1169-
if key == "plugin_packages":
1170-
new_config[key] = add_murfey_plugins(key, field, debug)
1171-
continue
11721167

11731168
"""
11741169
Standard method of inputting values
11751170
"""
11761171
new_config[key] = populate_field(key, field, debug)
11771172

1178-
# Validate the entire config again and convert into JSON/YAML-safe dict
1173+
# Validate the entire config and convert into JSON/YAML-safe dict
11791174
try:
11801175
new_config_safe: dict = json.loads(MachineConfig(**new_config).json())
11811176
except ValidationError as exception:

0 commit comments

Comments
 (0)