diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 2045f2d42..c128938a3 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -528,40 +528,18 @@ def inspect_nwb_file(payload): from nwbinspector import inspect_nwbfile from nwbinspector.nwbinspector import InspectorOutputJSONEncoder - return json.loads( - json.dumps( - list( - inspect_nwbfile( - ignore=[ - "check_description", - "check_data_orientation", - ], # TODO: remove when metadata control is exposed - **payload, - ) - ), - cls=InspectorOutputJSONEncoder, + messages = list( + inspect_nwbfile( + ignore=[ + "check_description", + "check_data_orientation", + ], # TODO: remove when metadata control is exposed + config="dandi", + **payload, ) ) - -def inspect_nwb_file(payload): - from nwbinspector import inspect_nwbfile - from nwbinspector.nwbinspector import InspectorOutputJSONEncoder - - return json.loads( - json.dumps( - list( - inspect_nwbfile( - ignore=[ - "check_description", - "check_data_orientation", - ], # TODO: remove when metadata control is exposed - **payload, - ) - ), - cls=InspectorOutputJSONEncoder, - ) - ) + return json.loads(json.dumps(obj=messages, cls=InspectorOutputJSONEncoder)) def inspect_nwb_folder(payload): @@ -575,16 +553,15 @@ def inspect_nwb_folder(payload): "check_description", "check_data_orientation", ], # TODO: remove when metadata control is exposed + config="dandi", **payload, ) ) - # messages = organize_messages(messages, levels=["importance", "message"]) - - return json.loads(json.dumps(messages, cls=InspectorOutputJSONEncoder)) + return json.loads(json.dumps(obj=messages, cls=InspectorOutputJSONEncoder)) -def aggregate_symlinks_in_new_directory(paths, reason="", folder_path=None): +def _aggregate_symlinks_in_new_directory(paths, reason="", folder_path=None): if folder_path is None: folder_path = GUIDE_ROOT_FOLDER / ".temp" / reason / f"temp_{datetime.now().strftime('%Y%m%d-%H%M%S')}" @@ -594,7 +571,7 @@ def aggregate_symlinks_in_new_directory(paths, reason="", folder_path=None): path = Path(path) new_path = folder_path / path.name if path.is_dir(): - aggregate_symlinks_in_new_directory( + _aggregate_symlinks_in_new_directory( list(map(lambda name: os.path.join(path, name), os.listdir(path))), None, new_path ) else: @@ -604,7 +581,7 @@ def aggregate_symlinks_in_new_directory(paths, reason="", folder_path=None): def inspect_multiple_filesystem_objects(paths): - tmp_folder_path = aggregate_symlinks_in_new_directory(paths, "inspect") + tmp_folder_path = _aggregate_symlinks_in_new_directory(paths, "inspect") result = inspect_nwb_folder({"path": tmp_folder_path}) rmtree(tmp_folder_path) return result