Skip to content

Commit

Permalink
fix subconverter stubbing
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD committed Jun 21, 2024
1 parent bc62a54 commit acc6b84
Showing 1 changed file with 34 additions and 14 deletions.
48 changes: 34 additions & 14 deletions src/pyflask/manageNeuroconv/manage_neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit acc6b84

Please sign in to comment.