From acc6b84becab38bc2d86d2ebdb35d9700e5b79d9 Mon Sep 17 00:00:00 2001 From: codycbakerphd Date: Fri, 21 Jun 2024 16:08:36 -0400 Subject: [PATCH] fix subconverter stubbing --- .../manageNeuroconv/manage_neuroconv.py | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/src/pyflask/manageNeuroconv/manage_neuroconv.py b/src/pyflask/manageNeuroconv/manage_neuroconv.py index 007491060..a277275dd 100644 --- a/src/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/src/pyflask/manageNeuroconv/manage_neuroconv.py @@ -924,20 +924,40 @@ def update_conversion_progress(message): options = {interface: {} for interface in info["source_data"]} for interface in options: - available_opts = available_options.get("properties").get(interface).get("properties", {}) - - # Specify if stub test - if run_stub_test: - if available_opts.get("stub_test"): - options[interface]["stub_test"] = True - - # Specify if iterator options are available - elif available_opts.get("iterator_opts"): - options[interface]["iterator_opts"] = dict( - display_progress=True, - progress_bar_class=TQDMProgressSubscriber, - progress_bar_options=progress_bar_options, - ) + print(f"{interface} entered") + + options_per_interface_or_converter = available_options.get("properties").get(interface) + # Nested converters + if "properties" not in options_per_interface_or_converter: + for subinterface in options_per_interface_or_converter: + available_opts = options_per_interface_or_converter[subinterface].get("properties", {}) + options_to_update = options[interface][subinterface] + + if run_stub_test and "stub_test" in available_opts: + options_to_update["stub_test"] = True + + if "iterator_opts" in available_opts: + options_to_update["iterator_opts"] = dict( + display_progress=True, + progress_bar_class=TQDMProgressSubscriber, + progress_bar_options=progress_bar_options, + ) + + print(f"{interface} has been stubbed") + # Standard interface + else: + available_opts = options_per_interface_or_converter.get("properties", {}) + options_to_update = options[interface] + + if run_stub_test and "stub_test" in available_opts: + options_to_update["stub_test"] = True + + if "iterator_opts" in available_opts: + options_to_update["iterator_opts"] = dict( + display_progress=True, + progress_bar_class=TQDMProgressSubscriber, + progress_bar_options=progress_bar_options, + ) # Add GUIDE watermark package_json_file_path = resource_path("package.json" if is_packaged() else "../package.json")